Reputation: 131
XML in short:
...
<team>
<capitan>Zdeno Chara</capitan>
<alernativeCapitan>
<player>Zdeno Chara</player> <!-- NO Chara, he's the capitan obviously -->
<player>Someone Else</player>
<player>Someone Other</player>
</alernativeCapitan>
</team>
<team>
<capitan>Abc Edf</capitan>
<alernativeCapitan>
<player>Abc Xyz</player>
<player>Bac Edf</player>
<player>Abc 123</player>
</alernativeCapitan>
</team>
...
Q: How to compare one string (capitan) with sequence (alternativeCapitan) in XPath?
I wold like to know if capitain is also written like a alternative capitan / player. Comparasion only in one team. (If so, its wrong. Thats all, doesnt matter if the result will be boolean or number.)
Thanks.
Upvotes: 0
Views: 1441
Reputation: 89285
The question is not 100% clear for me, maybe you want something like this :
//team[capitan=alernativeCapitan/player]
The above XPath will return all team
where the capitan
is also listed in the alternativeCapitan
element. Or if you want the opposite, that is return all team
where the capitan
is not in the alternativeCapitan
:
//team[not(capitan=alernativeCapitan/player)]
Upvotes: 2