XML technologies / XSLT / Introduction to XSLT 2.0 / Getting started with XSLT and XPath / Axes and node tests / A node test for selection

(Excerpt from "XSLT 2.0 & XPath 2.0" by Frank Bongers, Chapter 1.)

Writing the node test on the previous page with a function’s parentheses indicates that it essentially describes active filtering

From all nodes on the chosen axis of the location step, the node test selects the subset satisfying the test. These nodes form the result set of that individual step.

In the most straightforward case, the node test consists of the name of the desired nodes. This is possible only for named nodes, such as elements or attributes. The node test is then called a NameTest. For the remaining node kinds there are dedicated tests. Although these look like functions, they are not classified as such: text() selects text nodes, for example, while comment() selects comment nodes. Since these tests concern the node’s kind (kind) they are also called KindTest. There is even a neutral KindTest that matches all nodes, whether named or unnamed: node().

Because each step specifies an axis, a compound path expression could change direction several times. This is rather uncommon, but the involvement of up to three axes is conceivable. After the final step, a result sequence remains: the nodes satisfying the conditions of all steps in their specified order.

   

back to top