Combining the use of preceding and following sibling in the same xpath query

Viewed 14063

I have a quite simple problem but i can't seem to resolve it. Let's say i have the following code:

<a>
    <b property="p1">zyx</b>
    <b>wvu</b>
    <b>tsr</b>
    <b property="p2">qpo</b>
    <b>qcs</b>
</a>

I want to select the nodes between the b node who has a property="p1" and the b node who has property="p2". I can do either of those with the preceding-sibling and the following-sibling axis but I can't seem to find how to combine both.

3 Answers
Related