Standard functions
Last updated
Last updated
These functions are documented in .
Orbeon Forms supports the XPath functions from .
Example of use:
Namespaces:
These functions are available in the default function namespace.
These function are also available in the XPath functions namespace (http://www.w3.org/2005/xpath-functions
), usually associated with the fn
prefix.
This means that it is usually not necessary to declare a namespace for these functions, nor is it necessary to use a prefix in calls to these functions.
We recommend not prefixing calls to the standard XPath functions.
Orbeon Forms supports the XPath constructors from .
Example of use:
These constructors are in the http://www.w3.org/2001/XMLSchema
namespace, usually associated with the xs
prefix. This means that using a prefix is required.
[SINCE Orbeon Forms 2020.1]
This version doesn't yet support XPath 3.0, but it supports a subset of XPath 3.0 math functions. These functions are in the http://www.w3.org/2005/xpath-functions/math
namespace, which maps to the math
prefix:
math:log()
math:sin()
math:cos()
math:tan()
math:asin()
math:acos()
math:atan()
math:atan2()
math:log()
math:exp()
[SINCE Orbeon Forms 2020.1]
These functions are available in the default function namespace.
These function are also available in the XForms namespace (http://www.w3.org/2002/xforms
), usually associated with the xf
prefix.
This means that it is usually not necessary to declare a namespace for these functions in the form, nor is it necessary to use a prefix in calls to the core XPath functions:
For extra clarity, you can prefix calls to XForms functions. For example:
[SINCE Orbeon Forms 4.5]
This function returns the sequence of nodes associated with the bind specified by the id
parameter.
[SINCE Orbeon Forms 4.3]
The valid()
function returns the validity of XPath items, including instance data nodes.
xf:boolean-from-string()
xf:is-card-number()
xf:count-non-empty()
xf:index()
xf:power()
xf:random()
xf:property()
This function supports extension property names in the http://orbeon.org/oxf/xml/xforms
namespace (usually mapped to the xxf
prefix). Any such property name will return the value of an XForms engine property. Example:
NOTE: The standard XForms function returns an XPath 1.0 string
. The Orbeon Forms implementation returns the following:
empty sequence (if the property is not found)
xs:string
, xs:integer
, xs:boolean
or xs:anyURI
depending on the type of the property
xf:digest()
xf:hmac()
NOTE: Prefer the XPath 2.0 date and time functions when possible.
xf:local-date()
xf:local-dateTime()
xf:now()
xf:days-from-date()
xf:days-to-date()
xf:seconds-from-dateTime()
available as xf:seconds-from-dateTime()
only
xf:seconds-to-dateTime()
xf:seconds()
xf:months()
xf:instance()
xf:current()
xf:context()
xf:event()
The following functions from XForms 1.1 are obsolete:
xf:adjust-dateTime-to-timezone()
xf:avg()
use the standard XPath 2.0 function instead (avg()
)
the XForms 1.1 version of this function is not implemented in Orbeon Forms
xf:choose()
use the native XPath 2.0 if (...) then ... else ...
construct instead
xf:id()
xf:if()
available as xf:if()
only
use the native XPath 2.0 if (...) then ... else ...
construct instead
xf:min()
, xf:max()
use the standard XPath 2.0 functions instead (min()
and max()
)
the XForms 1.1 versions of these functions are not implemented in Orbeon Forms
These functions are available in the default function namespace.
Example:
The following functions from XSLT 2.0 and XPath 3 are available:
NOTE: Orbeon Forms, as of version 2021.1, still uses XPath 2.0. Even so, the functions above are available.
These functions are available in the http://www.exforms.org/exf/1-0
namespace, usually associated with the exf
prefix.
eXForms was a suggested set of extensions to XForms 1.0, grouped into different modules.
Orbeon Forms supports the exf:mip
module, which includes the following functions:
exf:relevant()
exf:readonly()
exf:required()
NOTE: XPath 2.0-compatible versions of these functions will be available as part of XForms 2.0.
Orbeon Forms also supports the following from the sorting module:
Note that the second argument is interpreted as a string, unlike with xxf:sort()
:
For more information, see .
This function returns the value of the specified environment variable. Before using this function, you'll want to set the to true
. If that property isn't set to true, or the variable isn't defined, or the Java security doesn't allow access to environment variables, then the function returns an empty sequence.
These functions are documented in XForms 2.0's .
use the , which offer similar functionality
use the native instead
format-dateTime()
()
format-date()
()
format-time()
()
format-number()
()
For an example, see .