Skip to content

Instantly share code, notes, and snippets.

@robsilva
Created November 30, 2016 18:29
Show Gist options
  • Save robsilva/0ef32e7d18803548677ed18da1b63e54 to your computer and use it in GitHub Desktop.
Save robsilva/0ef32e7d18803548677ed18da1b63e54 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