/ Published in: XSLT
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<xsl:key name="contacts-by-surname" match="contact" use="surname" /> <xsl:template match="records"> <xsl:for-each select="contact[count(. | key('contacts-by-surname', surname)[1]) = 1]"> <xsl:sort select="surname" /> <xsl:value-of select="surname" />,<br /> <xsl:for-each select="key('contacts-by-surname', surname)"> <xsl:sort select="forename" /> </xsl:for-each> </xsl:for-each> </xsl:template>