Reputation: 3334
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:
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?
Upvotes: 2
Views: 2380
Reputation: 3334
I solved my problem with the following xpath:
//e[b='A' and @a=following-sibling::e[b='A']/@a]
Upvotes: 4