XML technologies / XPath / XPath 2.0: language reference / Path expressions: axes / Child axis

(Excerpt from "XSLT 2.0 & XPath 2.0" by Frank Bongers, chapter 4.)

Defined for: XPath 1.0 and 2.0, XQuery 1.0

Direction: forward

Axis identifier: child

Abbreviated syntax: omitting the axis identifier

The child axis

Figure: the child axis.

The child axis contains all children of the current node: directly descended element, text, comment and processing-instruction nodes.

Attribute and namespace nodes are not children of the element to which they belong and cannot be reached through the child axis. Conversely, that element is the parent of the attribute or namespace node.

If the context node is not an element, the axis is always empty; only elements or the document node can have children.

The child axis is the default axis for a step in a path expression. Its abbreviated syntax therefore simply omits the axis identifier: child::node() and node() are equivalent spellings of the same expression.

Example:

   

back to top