Model functions
xxf:bind()
Or, with its XForms 2.0 definition:
The bind()
function returns the node-set of a given bind:
xxf:bind()
is particularly useful when referring to a bind is subject to a condition:
xxf:custom-mip
Return the value of the custom MIP of the first item specified, if any.
The name of the property must match the qualified name used on the xf:bind
that sets the property.
xxf:evaluate-bind-property()
The xxf:evaluate-bind-property()
function evaluates a property of a given bind. Depending on the property, it returns:
xs:string
calculate
xxf:default
custom MIPs
xs:boolean
relevant
readonly
required
constraint
xs:QName
If the property is not present on the bind, an empty sequence is returned.
NOTE: The property is instantly evaluated, which means that it might be different from the value evaluated during the previous model recalculation or revalidation.
xxf:instance()
The xxf:instance()
function works like the standard instance()
function except that it searches for instances:
independently from the current in-scope model specified by the
model
attributeacross ancestor XBL scopes
The search works as follows:
first, in a given XBL scope, the function searches all models within that scope
second, it recursively searches ancestor XBL scopes
For example, if there are no XBL components, and 2 top-level models:
[SINCE Orbeon Forms 4.5] The xxf:instance()
function can also take an absolute id as parameter.
xxf:invalid-binds()
The xxf:invalid-binds()
function returns a sequence of strings. If the node was made invalid because of an <xf:bind>
element, then the id of that bind element is present in the list.
This function is useful to help determine the reason why a node is invalid:
You can also use this function to show bind-specific errors:
Note however that the function actually only returns the first invalid bind at the moment, not all of them. So this works for scenarios where error messages go from general to specific.
xxf:type()
The xxf:type()
function returns the type of the instance data node passed as parameter. If an empty sequence is passed, the function returns an empty sequence. Otherwise, the type of the instance data node is searched. If no type information is available, the function returns an empty sequence. Otherwise, a QName associated with the type is returned.
xxf:valid()
The xxf:valid()
function returns the validity of an instance data node or of a subtree of instance data specified by the first argument.
If the first argument is specified, its first item is obtained, if any.
If the first argument is not specified, the context item is used, if any
If the second argument is specified and true()
, the function recurses into attributes and descendant nodes.
If no item is available, or if the item is an atomic value, the function returns true()
.
If the optional third argument is specified and set to true(), non-relevant nodes are ignored, as in the case of xf:submission
.
Because of the way the XForms processing model is defined, the evaluation of calculate
, required
, readonly
and relevant
takes place during the processing of the xforms-recalculate
event, which generally takes place before the processing of validation with the xforms-revalidate
event. This means that by default using xxf:valid()
to control, for example, whether a button is read-only or relevant will not work.