XML technologies / XSLT / Introduction to XSLT 2.0 / Getting started with XSLT and XPath / Axes and node tests / A short tour of the axes

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

A document tree offers many possible directions, some frequently used and others rarely. The most important for us is the Child axis, describing the step from the context node to its children. The reverse direction is the Parent axis, whereas the Self axis means remaining on the context node.

A greater forward reach is provided by the Descendant axis and the Descendant-Or-Self axis, potentially covering every node in branches starting at the context node and, in the second case, the context node itself.

Less frequently used directions also have their own axes: looking backward, the analogous axes are the Ancestor axis and the Ancestor-Or-Self axis.

Four further axes look sideways; they need not be discussed here: Preceding-Sibling axis and Following-Sibling axis as well as Preceding axis and Follo­wing axis. Since the axes listed so far mainly find elements, they are collectively called element axes. Together they cover the document tree.

Two more axes are absent from the tree diagram: the attribute axis is nevertheless important, whereas the namespace axis exists mainly as a formality in XPath 2.0.

   

back to top