In XPath 1.0, how can I select all descendant nodes C of current (context) node A, that are not contained in an intervening node of type B?
For example, find all <a> links contained in the current element, that are not inside a <p>. But if the current element is itself inside a <p>, that's irrelevant.
<p> <—— this is irrelevant, because it's outside the current element
...
<div> <—— current element (context node)
...
<a></a> <—— the xpath should select this node
...
<p>
...
<a></a> <—— but not this, because it's inside a p, which is inside context
...
<p>
...
</div>
...
</p>
The ... in the example could be several depths of intervening nodes.
I'm writing XSLT 1.0, so the additional functions generate-id(), current(), and such are available.
/p/div/a? And this is duplicate of stackoverflow.com/questions/15818191/…div(current context node) and I need to select allathat are not inside ap, possibly with several middle nodes in between, for example several levels ofdivin between.