Model item property is somewhat unwieldy name an XForms gives to the XPath nodes that
have an additional XForms properties.
A D V E R T I S E M E N T
An XForms defines the number of such properties
which, through the flexibility of a XPath, can be applied readily to the instance of
the data.
The List of Properties
An XForms 1.0 defines these following useful properties:
A required
This property is when set to true() or 1, the signals that the attached instance of data
should not be blank, and will prevent the submission until a condition is been met.
A relevant
This property of the controls whether an attached instance of data is relevant or not.
Non-relevant items are not rendered usually (although this can also be fine-tuned with
the stylesheets) and not even submitted.
A readonly
This property controls whether the attached instance data is a read-only, in which
case it cannot be user-modified.
A calculate
This property bears the full XPath expression, which can include the mathematical operators
and function of the calls, which is used to automatically provide the value to an attached
instance of the data nodes. Multiple calculations can do interact, and like the spreadsheet,
they do will recalculate a proper order for the dependencies to work out.
A constraint
This property bears the full XPath expression which should evaluate to true() in order for
the attached instance data to be considered valid. Therefore, all constraints must be
met before submission can succeed.
type
This property associates the datatype (taken from XML Schema) with the attached instance
data nodes. Datatypes can be useful in refining the view into data, for example using a
calendar control to enter a date.
p3ptype
This property do associates the datatype (taken from a P3P) with an attached instance of the
data nodes. The P3P datatypes are useful for a privacy monitoring, namely the smart
user agents that keep the track of what information they do give out. It can also serve
as the flag for a client to pre-fill the certain allowed kinds of the information.
Keep in mind that the XPath expressions, no default namespace do apply, and thus the
prefixes should be used liberally.
The XPath Expressions
All these properties, other than the type and p3ptype accept a full XPath expressions,
which can contains more than a "location path" expressions the earlier lessons have used.
Some examples are:
../price * ../quantity
string-length('hello world!')
total * instance('taxtable')/taxrate
Some of the commonly-used XPath features are backing up to the parent node (..),
The addition (+), The subtraction (-), The multiplication (*), The division (div),
string length counting the (string-length()), checking a string for another
(contains()), calculating the sum of the several nodes (sum()), and referring to the
data in a with the given ID (instance()).