I am trying to create an xpath for the below scenario, could you please help ?
How can i find out the value of C whose @parent is /A/B/@id, that is PQR, C may not be the immediate next node . I want to evaluate result=/A/B/@id and then give the result as input to /A/C[@parent="result"]..is it possible?
<A>
<B id="1">W</B>
<C parent="1">PQR</C>
<C parent="2">ABC</C>
</A>
Yes, it's possible.
With a predicate filter expression, you can test whether the
@parentvalue of/A/Cis equal to the@idvalue of the/A/Belement and it will return theCelement that satisfies that criteria.