Comment on page
Orbeon Forms supports exposing MIP type annotations to XPath 2.0.
This means that if you have a type associated with a node, e.g.:
<xf:bind ref="age" type="xs:integer">
then the type is not only used for validation, but also determines the typed value of the element node age.
This means that earlier, you had to write the following:
constraint="xs:integer(.) le 150"/>
With exposing type annotations, you can simply write:
constraint=". le 150"/>
constraint=". le (current-date() + xdt:dayTimeDuration('P2D'))"/>
NOTE: Type annotations are not automatically enabled for backward compatibility reasons. However, they are enabled by default for new forms created with Form Builder.
The following property controls whether instance types annotations are exposed to XPath 2.0 expressions:
- If set to
false(the default), instance types are not made available to XPath expressions.
- If set to
true, they are made available.
You can as usual enable this on a per-page basis:
[SINCE Orbeon Forms 4.2]
You can also enable this on a per-instance basis:
Static type annotations (with
xsi:type) can be used by all XPath expressions, including
NOTE: Here is the order in which the XForms engine processes type annotations in the model:
- during a model rebuild, all
xf:bindpoint to their associated instance nodes if any
- static type annotations with
xsi:typeare available just after a rebuild
- this means that type annotations can be used during subsequent model recalculate _and _revalidate
- however, annotations done via a schema are not reliably available during recalculate