Posted By

golonikum on 07/08/10


Tagged


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

deanburge
amix
Tyster


Grouping Using the Muenchian Method


 / Published in: XSLT
 

  1. <xsl:key name="contacts-by-surname" match="contact" use="surname" />
  2. <xsl:template match="records">
  3. <xsl:for-each select="contact[count(. | key('contacts-by-surname', surname)[1]) = 1]">
  4. <xsl:sort select="surname" />
  5. <xsl:value-of select="surname" />,<br />
  6. <xsl:for-each select="key('contacts-by-surname', surname)">
  7. <xsl:sort select="forename" />
  8. <xsl:value-of select="forename" /> (<xsl:value-of select="title" />)<br />
  9. </xsl:for-each>
  10. </xsl:for-each>
  11. </xsl:template>

Report this snippet  

You need to login to post a comment.