XML technologies / XPath / XPath 2.0: language reference / Path expressions: axes / Ancestor-or-self 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-or-self

Abbreviated syntax: none

The ancestor-or-self axis

Figure: the ancestor-or-self axis.

The ancestor-or-self axis contains the context node and all its ancestors, including the document node. Apart from the context node, which may be a text, attribute or other node, it contains only element nodes.

Example:

   

back to top