XML technologies / XPath / XPath 2.0: language reference / Path expressions: axes / Parent 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: reverse

Axis identifier: parent

Abbreviated syntax: ..

The parent axis

Figure: the parent axis.

The parent axis contains the context node’s parent node (parent), if one exists, which is the case for every node except the document node. Because the document tree is a directed graph, exactly one parent exists, always an element node.

An element’s parent is the element or document node from which it directly descends; an attribute or namespace node’s parent is the element node to which it belongs.

The parent axis is empty for the document node.

Note: the parent axis can also be used in XQuery
The parent axis is the only reverse axis also defined in XQuery 1.0.

Example:

   

back to top