XPath to compare two distinct attributes of two elements
- by user364902
Suppose I have this XML:
<x>
<e s="1" t="A"/>
<e s="2" t="A"/>
<e s="1" t="B"/>
</x>
Is there any way to write an xpath to find any nodes named "e" which have the same value of @s as another node but a different value of @t for the same node. The first part is easy:
//e[@s = //e/@s]
as is the second part:
//e[@t != //e[@t]]
But I don't see any way to construct an xpath that compares two different attributes for two separate elements "e". Is there a way within the xpath syntax, or is it hopeless?