Reputation: 1104
In XPath, how to select the id
of all <a>
nodes that contain x=10
and y=100
in their children (which are at different levels)?
<root>
<a id="1">
<c>
<x>10</x>
<y>100</y>
</c>
</a>
<a id="4">
<c>
<c>
<x>10</x>
<y>100</y>
</c>
</c>
</a>
<a id="6">
<x>20</x>
<y>200</y>
</a>
<a id="7">
<x>10</x>
<y>300</y>
</a>
</root>
Upvotes: 3
Views: 2973
Reputation: 324630
Something like this, I would imagine:
//a[.//x=10][.//y=100]/@id
Upvotes: 9