<!-- SlowerGrouping.xsl: The slow way to group repeating info by scanning --> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output indent="yes"/> <xsl:template match="/"> <BugsByDeveloper> <!-- | Select all unique developer names by selecting the | unique "open-bugs/bug/dev" elements. A unique "dev" is one | having no preceding dev element with the same value as it has. +--> <xsl:for-each select="/open-bugs/bug/dev[not(preceding::dev=.)]"> <!-- Sort by the value of dev, the current node "." --> <xsl:sort select="."/> <BugList for="{.}"> <!-- Select and copy all bugs for the current developer --> <xsl:for-each select="/open-bugs/bug[dev = current()]"> <!-- Copy the current <bug> node --> <xsl:copy> <!-- Including children <id>,<abstract>,<priority> --> <xsl:copy-of select="id|abstract|priority"/> </xsl:copy> </xsl:for-each> </BugList> </xsl:for-each> </BugsByDeveloper> </xsl:template> </xsl:stylesheet> |