С лучшим дизайном, эта таблица стилей:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="kTripByContent" match="trip"
use="concat(got_car,'+',from,'+',to,'+',when_iso)"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="trip[generate-id() !=
generate-id(key('kTripByContent',
concat(got_car,'+',
from,'+',
to,'+',
when_iso))[1])]"/>
</xsl:stylesheet>
Выход:
<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>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>