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
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:
preceding-sibling::*
selects all element nodes, regardless of name, sharing the current node’s parent and preceding it in document order.
preceding-sibling::node()
selects all nodes, regardless of kind, sharing the current node’s parent and preceding it in document order. Besides elements, the result therefore includes text or comment nodes. The sequence is in reverse document order.
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