I want to remove duplicates when all variables are exact matches using xslt.
In this xml node 3 should be removed because it is a perfect copy of node 1.
<root>
<trips>
<trip>
<got_car>0</got_car>
<from>Stockholm, Sweden</from>
<to>Gothenburg, Sweden</to>
<when_iso>2010-12-06 00:00</when_iso>
</trip>
<trip>
<got_car>0</got_car>
<from>Stockholm, Sweden</from>
<to>New york, USA</to>
<when_iso>2010-12-06 00:00</when_iso>
</trip>
<trip>
<got_car>0</got_car>
<from>Stockholm, Sweden</from>
<to>Gothenburg, Sweden</to>
<when_iso>2010-12-06 00:00</when_iso>
</trip>
<trip>
<got_car>1</got_car>
<from>Test, Duncan, NM 85534, USA</from>
<to>Test, Duncan, NM 85534, USA</to>
<when_iso>2010-12-06 00:00</when_iso>
</trip>
<trips>
<root>
This code:
Will do the trick.
It utilizes the fact that generate-id() applied to a key will take the id of the first node, that matches a given criteria. And in our case criteria is concatenated value of each trip child element.