Core functions
xxf:document-id()
xxf:document-id() as xs:string`Each time an XForms document is created, typically when a user requests a page, it is assigned a unique id.
This function returns the current XForms document (or page)'s unique id.
xxf:evaluate-avt()
xxf:evaluate-avt(
$avt-expression as xs:string
) as item()*This function is similar to saxon:evaluate() or xxf:evaluate(), but instead of evaluating an XPath expression, it evaluates a string representing an attribute value template.
<xf:output
value="
xxf:evaluate-avt(
'/xforms-sandbox/service/zip-zips?state-abbreviation={state}&city={city}'
)"/>xxf:format-message()
xxf:format-message($template as xs:string, $parameters as item()*) as xs:stringThe xxf:format-message() function allows you to format a localized message based on a template and parameters.
the first parameter is a template string following the syntax of the Java MessageFormat class
the second parameter is a sequence of parameters that can be referenced from the template string
The following types are supported:
string (the default)
number (including currency and percent)
date
time
The function uses the current language as would be obtained by the xxf:lang() function to determine a locale.
Example with number, date, time, and string:
This produces the following output with an en-US locale:
Example including a choice:
This produces the following outputs, depending on the value provided:
NOTE: It is important to pass dates and times as typed values. Use xs:dateTime(), xs:date(), or xs:time() if needed to convert from a string.
xxf:lang()
The xxf:lang() function returns the current language as specified with the xml:lang attribute.
The xml:lang value to use is determined this way:
if the element containing the
xxf:lang()function has anxml:langattribute, that attribute is usedotherwise, the first ancestor element of the element containing the
xxf:lang()function that has anxml:langattribute is used
xml:lang is supported in the following locations:
for a static
xml:langvalueon any XForms element
on the top-level
<xh:html>element
for a dynamic xml:lang value (using an AVT)
only on the top-level
<xh:html>element
NOTE: xml:lang attributes on HTML elements other than the top-level <xh:html> are ignored for the purpose of the xxf:lang() function.
NOTE: Format of the locale is currently restricted to the form "en" or "en-GB". Support for BCP 47 would be desirable.
Example of static values:
Example with an AVT:
When calling the xxf:lang() function from an XBL component:
xml:langis first searched as described aboveif no
xml:langvalue is found in the XBL component, then thexml:langvalue of the XBL bound element is searched
Example:
xxf:property()
The xxf:property() function retrieves the value of a property defined in properties-local.xml.
This function returns the following:
empty sequence if the property is not found
xs:string,xs:integer,xs:booleanorxs:anyURIdepending on the actual type of the property
xxf:r()
The purpose of this function is to automatically resolve resources by name given the current language and an XForms instance containing localized resources.
$resource-name: resource path of the formfoo.bar.baz. The path is relative to theresourceelement corresponding to the current language in the resources instance.$instance-name: name of the resources instance. If omitted, searchorbeon-resourcesand thenfr-form-resources.
The function:
determines the current language based on
xml:langattribute in scope where the function is in usedresolves the closest relevant resources instance
specified instance name if present
orbeon-resourcesorfr-form-resources(for Form Runner compatibility) if absent
uses the resource name specified to find a resource located in the resources instance, relative to the
resourceelement with the matching language
Example:
xxf:rewrite-resource-uri()
Rewrite a URI as an Orbeon Forms resource URI.
Last updated