C
CAFxX
Hi everybody, I have a problem with a xpath query.
Suppose you have something like this:
<a>
<b>X</b>
<a>
<c>
<b>Y</b>
</c>
</a>
</a>
Right now to obtain a list of <a> containg a certain token I do:
//a[ contains( descendant-or-self::*, 'token' ) ]
the problem is that, in the case above, searching for the token Y would
give both <a>s, whereas I need only the innermost one (i.e. the nearest
<a> ancestor of the fragment containing the searched token). How can I
translate this in xpath?
Thank you and best regards,
CAFxX
Suppose you have something like this:
<a>
<b>X</b>
<a>
<c>
<b>Y</b>
</c>
</a>
</a>
Right now to obtain a list of <a> containg a certain token I do:
//a[ contains( descendant-or-self::*, 'token' ) ]
the problem is that, in the case above, searching for the token Y would
give both <a>s, whereas I need only the innermost one (i.e. the nearest
<a> ancestor of the fragment containing the searched token). How can I
translate this in xpath?
Thank you and best regards,
CAFxX