I have the following XML structure:
<node name="A">
<node name="B">
<node name="C"/>
<node name="D"/>
<node name="E"/>
</node>
<node name="D"/>
<node name="E"/>
</node>
I need to get all the leaf nodes. I use //node[not(node)] to get those. Now I need to remove duplicates by leaving elements that are deeper in hierarchy. How do I do that?
This transformation:
when applied on the provided XML document:
produces the wanted, correct result:
II. XSLT 2.0 Solution:
when this transformation is applied on the same XML document (above), the same correct results are produced: