XPath to find an element with a similar sibling
Posted
by user364902
on Stack Overflow
See other posts from Stack Overflow
or by user364902
Published on 2010-06-16T08:24:44Z
Indexed on
2010/06/16
10:32 UTC
Read the original article
Hit count: 161
xpath
|duplicates
Suppose I have this XML:
<x>
<e a='1' b='A'/>
<e a='1' b='B'/>
<e a='1' b='A'/>
</x>
I'd like to write an xpath to find any elements e which:
- Have attribute @b = 'A'
- Have the same value for attribute @a
The xpath can't reference the literal value of attribute @a, however. It can reference the literal value of attribute @b.
Or more generally, I want to find if there are any instances where there are two or more elements e[@b=A'] with the same value for attribute @a.
Is this possible?
© Stack Overflow or respective owner