Reputation: 2019
What's the difference between preceding::
and ancestor::
in XPath 2.0?
Upvotes: 5
Views: 7740
Reputation: 7396
The preceding::
axis contains all the nodes in the document that come before this node, excluding this node's ancestors, which are in the ancestor::
axis. For example, in this document:
<a>
<b>
<c/>
</b>
<d>
<e/>
</d>
</a>
The "preceding" nodes of e
would be b
and c
, but not a
and d
as they are e
's ancestors. Make sense?
(source)
Upvotes: 10