I want to adress the nodes inbetween two elements; the second one is identified by an @xml:id, the first one referring to the second one via this id. More often than not, other sibling elements (that are irrelevant to this issue / should be processed as usual) are between the two elements in question.
<root>
... text i'm not interested in ...
<A ref="#id_1"/> interesting <C>text</C> no 1 <B xml:id="id_1"/>
... text i'm not interested in ...
<A ref="#id_2"/> interesting text no 2 <B xml:id="id_2"/>
... text i'm not interested in ...
</root>
What I'm looking for is an xPath command that selects for every element "A" with the attribute "ref" the nodes following this element up to the specific element "B" with the id provided in a's "ref".
So in the example given above, for the first "A", it should select
"interesting <C>text</C> no 1"
and for the second "A"
"interesting text no 2"
(and so on; the number of "A"- and "B"-elements is pretty high).
So far, my rough guess is that fn intersection could be part of the solution. (I'm using xPath 2.0.)