I have a program that receives a nodeset from a function in exslt. It contains duplicate nodes (Tom Waits appears twice) :
<xsl:template name="giveMeHeroes">
<person>
<lastName>Waits</lastName>
<firstName>Tom</firstName>
</person>
<person>
<lastName>Everett</lastName>
<firstName>Mark</firstName>
</person>
<person>
<lastName>Hickey</lastName>
<firstName>Rich</firstName>
</person>
<person>
<lastName>Waits</lastName>
<firstName>Tom</firstName>
</person>
</xsl:template>
<xsl:template match="/">
<xsl:variable name="someHeroes">
<xsl:call-template name="giveMeHeroes"></xsl:call-template>
</xsl:variable>
<xsl:apply-templates select="ext:node-set($someHeroes)/person"/>
</xsl:template>
<xsl:template match="person">
<xsl:value-of select="concat('Long live',firstName,' ',lastName,'!!!')"/>
<br/>
</xsl:template>
This example yields (parsed in a browser ) :
Long live Tom Waits!!!
Long live Mark Everett!!!
Long live Rich Hickey!!!
Long live Tom Waits!!!
I know I should be able to filter the results with set:distinct(nodeset) , something in the lines of <xsl:apply-templates select="set:distinct(ext:node-set($someHeroes)/person)"/>
maybe, but somehow I cannot find the way to do that. Any help would be appreciated.
Your code should do and works for me with Saxon 6.5.5 in http://xsltransform.net/gWmuiJX, it does
and outputs
Long liveTom Waits!!!<br>Long liveMark Everett!!!<br>Long liveRich Hickey!!!<br>
.