Поделиться через


Predicates (Windows Embedded CE 6.0)

1/6/2010

A predicate filters a node-set with respect to an axis to produce a new node-set. For each node in the node-set to be filtered, the expression is evaluated with that node as the context node, with the number of nodes in the node-set as the context size, and with the "proximity position" of the node in the node-set with respect to the axis as the context position; if the expression evaluates to True for that node, the node is included in the new node-set; otherwise it is not included.

An axis is either a forward axis or a reverse axis. An axis that only ever contains the context node or nodes that are after the context node in document order is a forward axis. An axis that only ever contains the context node or nodes that are before the context node in document order is a reverse axis. Thus ancestor and ancestor-or-self are reverse axes; all other axes are forward axes. Because the self axis always contains at most one node, it makes no difference whether it is a forward or reverse axis. The proximity position of a member of a node-set with respect to an axis is defined as the position of the node in the node-set ordered in document order if the axis is a forward axis and ordered in reverse document order if the axis is a reverse axis. The first position is 1.

A predicate expression is evaluated by evaluating the expression and converting the result to a Boolean. If the result is a number, it will be converted to True if the number is equal to the context position or converted to False otherwise; if the result is not a number, it will be converted to a Boolean. Thus a location path para[3] is equivalent to para[position()=3].

See Also

Concepts

Location Paths