I have the following xml:
<?xml version="1.0" encoding="UTF-8"?>
<SomeName>
<NodeA>
DataA
</NodeA>
<NodeA>
DataB
</NodeA>
<NodeA>
DataA
</NodeA>
<AnotherNode>
DataA
</AnotherNode>
<AnotherNode>
DataC
</AnotherNode>
<AnotherNode>
DataC
</AnotherNode>
<SingleNode>
DataA
</SingleNode>
And I need to parse through the xml removing any nodes that have the same name as well as the same content. The problem is, the duplicates are more or less scattered throughout the document and I don’t have a list of nodenames or specific contents I want to get rid of.
Basically my output should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<SomeName>
<NodeA>
DataA
</NodeA>
<NodeA>
DataB
</NodeA>
<AnotherNode>
DataA
</AnotherNode>
<AnotherNode>
DataC
</AnotherNode>
<SingleNode>
DataA
</SingleNode>
Anyone got some clever XSLT?
Thanks!
With proper input:
This stylesheet:
Result:
With the “Identity Transform”:
Edit: Added an example with “indentity transform” in case more work has to be done.
Note: Muenchian Method of grouping.