Created
March 21, 2012 15:15
-
-
Save andrewminton/2148260 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<data> | |
<the-pip> | |
<entry> | |
<published-by id="0001"> | |
<item>Smith</item> | |
</published-by> | |
</entry> | |
<entry> | |
<published-by id="0002"> | |
<item>Jones</item> | |
</published-by> | |
</entry> | |
<entry> | |
<published-by id="0003"> | |
<item>Jones</item> | |
</published-by> | |
</entry> | |
</the-pip> | |
</data> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
<xsl:output method="xml" indent="yes" /> | |
<xsl:key name="contacts-by-surname" match="published-by" use="item" /> | |
<xsl:template match="/"> | |
<ul> | |
<xsl:apply-templates select="data/the-pip/entry"/> | |
</ul> | |
</xsl:template> | |
<xsl:template match="data/the-pip/entry"> | |
<xsl:for-each select="published-by[count(. | key('contacts-by-surname', item)[1]) = 1]"> | |
<xsl:sort select="item" /> | |
<li><xsl:value-of select="item" /></li> | |
</xsl:for-each> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment