XPath to compare two distinct attributes of two elements
Posted
by user364902
on Stack Overflow
See other posts from Stack Overflow
or by user364902
Published on 2010-06-16T10:28:12Z
Indexed on
2010/06/16
10:33 UTC
Read the original article
Hit count: 193
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?
© Stack Overflow or respective owner