Skip to content

Instantly share code, notes, and snippets.

@DiogoDoreto
Created July 3, 2013 17:13
Show Gist options
  • Save DiogoDoreto/5920630 to your computer and use it in GitHub Desktop.
Save DiogoDoreto/5920630 to your computer and use it in GitHub Desktop.
Distinct values in XSLT 1.0
<xsl:key name="product" match="/items/item/products/product/text()" use="." />
<xsl:template match="/">
<xsl:for-each select="/items/item/products/product/text()[generate-id()
= generate-id(key('product',.)[1])]">
<li>
<xsl:value-of select="."/>
</li>
</xsl:for-each>
</xsl:template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment