Model Item Properties
An individual property that can be applied to a node is called a model item property. Some of the properties are XPath expressions (called computed expressions in the specification), which the XForms Processor tracks and reevaluates as necessary:
readonly
required
relevant
calculate
constraint
The remaining properties are static, and don’t get reevaluated:
type
p3ptype
Some of the model item properties have an effect on child nodes as well. The rules for this behavior can be summarized like this:
Setting a node to
readonly
sets all child nodes to readonly, unless specifically overridden.Setting a node to non-
relevant
sets all child nodes to non-relevant, unless specifically overridden.For all other model item properties, setting that property on a node has no effect on child nodes.
Warning
A common mistake is to write code like this:
required="true"
This almost certainly doesn’t have the intended effect of making the node always required. Computed model item properties are XPath expressions, and under XPath rules, "
true
" is interpreted as a node-set matching all element nodes namedtrue
. Unless there is such an element, the expression will evaluate to an empty node-set, which is interpreted as an XPath booleanfalse
! Always use the functionstrue( )
andfalse( )
, which return the expected XPath boolean values.required="true( )"
Get XForms Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.