xpath - All elements with a following sibling equal to it -
my xml structure:
<root> <!-- first --> <a> <b>123</b> <c>456</c> </a> <!-- second --> <a> <b>999</b> <c>456</c> </a> <!-- third --> <a> <b>123</b> <c>456</c> </a> <!-- fourth--> <a> <b>123</b> <c>999</c> </a> <!-- fifth --> <a> <x>123</x> <y>456</y> </a> </root>
i want find elements have following siblings equal it.
the desired result first element, because equal third element.
i've tried this:
//a[.= following-sibling::a]
but result first , third element. guess third element matches fifth element, because = operator compares string values, right? can me?
can compute position of matched element in xpath or have search in xsl loop?
i think looking function deep-equal
, see http://www.w3.org/tr/xpath-functions-30/#func-deep-equal, can use in //a[some $sibling in following-sibling::a satisfies deep-equal(. ,$sibling)]
.
Comments
Post a Comment