http://onionworks.net/2004/renderengine/utility

distinct (items : nodeset) : nodeset

This method compares the contents of the nodes of the transferred nodesets and only returns duplicates once.

Note!
This only works if the transferred nodes contain text!

<xsl:variable name="nodes" c.as="Node">
<item>Test</item>
<item>Test2</item>
<item>Test3</item>
<item>Test4</item>
<item>Test2</item>
<item>Test3</item>
<item>Test4</item>
</xsl:variable>
<xsl:for-each select="util:distinct($nodes/item)">
<xsl:value-of select="." />
<br />
</xsl:for-each>
Remove duplicate nodes

 

The above example therefore now produces the following result:

Test
Test2
Test3
Test4

Although the nodes "Test2", "Test3" und "Test4" appear twice in each nodeset, they are only returned once. In this way duplicate nodes can be removed very simply.