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
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:
child::node()
selects all element, text, comment and processing-instruction nodes that are children of the current node.
child::mein_element
selects all element nodes namedmein_elementthat are children of the current node. If none exists, the result sequence is empty.
mein_element
The child axis identifier can be omitted. The preceding abbreviated expression therefore corresponds exactly tochild::mein_elementand produces the same result sequence.
Copyright © Galileo Press, Bonn 2008
You may print the online version for private use.
Otherwise, this chapter from "XSLT 2.0 & XPath 2.0 ― Das umfassende Handbuch" is subject to the same terms as the bound edition: the work and all its parts are protected by copyright. All rights reserved, including reproduction, translation, microfilming, storage and processing in electronic systems.
Galileo Press, Rheinwerkallee 4, 53227 Bonn