Evaluation of Location Paths
Location paths are split into a sequence of n individual node tests (ElementTest, AttributeTest). Each node test has a set of input nodes and a set of output nodes. The output nodes of node test n become the input nodes of node test n+1. The input set of the first node tests consists of the <application> element selected by the application key. The output set of the last node test represents the result of the location path’s evaluation.
The output set of an element test consists of the immediate child nodes of all nodes from the input set for which the following conditions are true:
-
The node is an element node.
-
The tag name of the element is equal to the name specified by the node test.
-
If the element test contains a predicate, the predicate expression is true.
Predicate expressions are used to test attributes of the (element) node for their value. They contain one or more equality expressions separated by the token and. An equality expression may have one of three forms:
@<NCName>=<Number>
This expression is true if and only if the currently tested node has an attribute named <NCName> whose value can be converted into a number, and the resulting number has the same value as <Number>. The conversion of the attribute value to a number accepts at least the same character sequences as the rule for Number in the grammar above.
@<NCName>=<Literal>
This expression is true if and only if the currently tested node has an attribute named <NCName> whose value contains the same sequence of Unicode code points as <Literal>.
not(@<NCName>)
This expression is true if and only if the currently tested node does not have an attribute named <NCName>.
The output set of an attribute tests consists of the immediate child nodes of all nodes from the input set for which the following conditions are true:
-
The node is an attribute node.
-
The name of the attribute is equal to the name specified by the node test.
If the operation sets application data, and the output set of a node test is empty, the node test creates a new node that matches the node test and appends it to the input set’s first node (in document order). The output set then contains the newly created node.