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

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

Defined for: XPath 1.0 and 2.0 (not in XQuery 1.0)

Direction: reverse

Axis identifier: ancestor

Abbreviated syntax: none

The ancestor axis

Figure: the ancestor axis.

The ancestor axis contains all direct and indirect ancestors of the context node, from its parent up to and including the document node. Apart from the document node, it contains only elements: a node must have children to belong to this axis.

Example:

   

back to top