W3C

XForms 1.1

3.3.4 The bind Element

Element bind selects a node-set from the instance data with a model binding expression in the nodeset attribute. Other attributes on element bind encode model item properties to be applied to each node in the node-set. When bind has an attribute of type xsd:ID, the bind then associates that identifier with the selected node-set.

Common Attributes: Common, Model Item Properties (Optional)

Special Attributes:

nodeset

An optional attribute containing a model binding expression that selects the set of nodes on which this bind operates.

context

Optional attribute containing an XPath expression evaluated using the in-scope evaluation context. The result of the XPath expression is used to override the in-scope evaluation context. By adjusting the in-scope evaluation context, this attribute affects the evaluation of subsequent attributes that may appear on bind, including nodeset and Model Item Properties.

Editorial note: NickVdB2008-02-01
If the context attribute is used on insert and delete, only the first node of the nodeset returned by the XPath expression is used as the new in-scope evaluation context. But I think we don't want to limit the new in-scope evaluation context by specifying context on a bind to be limited to the first node.

See 6 Model Item Properties for details on model item properties.

See 7.2 Evaluation Context for details on how the evaluation context is determined for each attribute of the bind element.

Simplifying XPath expression by using context

Without using context

<bind nodeset="c" caclulate="../a + ../b" />

Using context

<bind nodeset="c">
    <bind context=".." caclulate="a + b" />
</bind>
=--=_mixed 001C3B43852573E3_Content-Type: application/octet-stream; name="bind.xml" Content-Disposition: attachment; filename="bind.xml" Content-Transfer-Encoding: base64 PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxkaXYzIGlkPSJzdHJ1Y3R1 cmUtYmluZC1lbGVtZW50Ij4NCiAgICAgIDxoZWFkPlRoZSBiaW5kIEVsZW1lbnQ8L2hlYWQ+DQog ICAgICA8cD5FbGVtZW50IDxlbD5iaW5kPC9lbD4gc2VsZWN0cyBhIG5vZGUtc2V0IGZyb20gdGhl IDx0ZXJtcmVmIGRlZj0iZGVmLWluc3RhbmNlLWRhdGEiPmluc3RhbmNlIGRhdGE8L3Rlcm1yZWY+ IHdpdGggYSANCiAgICAgIDx0ZXJtcmVmIGRlZj0iZGVmLW1vZGVsLWJpbmRpbmctZXhwcmVzc2lv biI+bW9kZWwgYmluZGluZyBleHBy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