Skip to content

Instantly share code, notes, and snippets.

@apbarrero
Created October 6, 2011 21:23
Show Gist options
  • Select an option

  • Save apbarrero/1268720 to your computer and use it in GitHub Desktop.

Select an option

Save apbarrero/1268720 to your computer and use it in GitHub Desktop.
Second XSLT using the Muenchian method (II)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="utf-8" method="xml" indent="yes" />
<xsl:key use="text()" name="path-key"
match="path" />
<xsl:template match="log">
<xsl:copy>
<xsl:apply-templates select="logentry" />
</xsl:copy>
</xsl:template>
<xsl:template match="logentry">
<xsl:apply-templates select="paths/path" />
</xsl:template>
<xsl:template match="path">
<xsl:if
test="generate-id() = generate-id(key('path-key', text())[1])">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment