The calculate Property

Release 2.0 - ...

Supplies an expression used to calculate a string value for the associated instance data node.

Computed Expression Yes
Legal Values Any XPath expression.
Default Value none
Inheritance Rules does not inherit.

An XForms Model may include model items whose string values are computed from other values. For example, the sum over line items for quantity times unit price, or the amount of tax to be paid on an order.

The formula for such a computed value can be expressed with a calculate property, whose XPath expression is evaluated, converted to a string with the XPath string() function, and stored as the value content of the calculated data node.

Example

XML CopyCode image Copy Code
<xforms:bind nodeset="/order/item/discount" calculate="/order/item/amount * 0.5" relevant="/order/item/amount &gt; 1000"/>

Specification

Link to the XForms specification: the calculate Property.