I have XML like
<root>
<a>One</a>
<a>Two</a>
<b>Three</b>
<c>Four</c>
<a>Five</a>
<b>
<a>Six</a>
</b>
</root>
and need to select the last occurrence of any child node name in root. In this case, the desired resulting list would be:
<c>Four</c>
<a>Five</a>
<b>
<a>Six</a>
</b>
Any help is appreciated!
XSLT based solution:
Produced output:
Second solution (you can use it as single XPath expression):