XML technologies / XPath / XPath 2.0: language reference / Path expressions: axes / Preceding-sibling 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: preceding-sibling::

Abbreviated syntax: none

The preceding-sibling axis

Figure: the preceding-sibling axis.

The preceding-sibling axis contains all siblings of the current node that precede it in document order: nodes sharing its parent. The result may contain element, text, comment and processing-instruction nodes.

If the current node is a namespace or attribute node, the axis is empty. Although an element may have multiple attributes or namespace nodes, these are not its children and have no fixed order, so they cannot be siblings of each other.

Example:

   

back to top