This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
How to group a list twice
- To: <XSL-List at lists dot mulberrytech dot com>
- Subject: [xsl] How to group a list twice
- From: "Michael Bauerfeld" <michael at socialchange dot net dot au>
- Date: Mon, 28 May 2001 18:29:32 +1000
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi,
I'm facing a problem with a probably very simple solution, but I can't get
it working the way I would like to.
The main idea is to group the following xml according to <firstLevel> and
inside of this group according to <secondLevel>.
---<snip>--
<response>
<record>
<firstLevel>firstname1</firstLevel>
<secondLevel>secondname1</secondLevel>
<thirdLevel>thirdname1</thirdLevel>
</record>
</response>
---<snip>--
I've managed the 1st grouping using the Muenchian Method
<xsl:key name="class" match="record" use="firstLevel"/>
<xsl:template match="response">
<xsl:apply-templates select="record[generate-id(.) =
generate-id(key('first', firstLevel)[1])]" mode="classList"/>
</xsl:template>
<xsl:template match="response" mode="classList">
<xsl:value-of select="firstLevel" />
<xsl:for-each select="key('class', firstLevel)">
<xsl:value-of select="secondLevel" />
<xsl:value-of select="thirdLevel" />
</xsl:for-each>
but I don't know how to get the 2nd grouping working. Creating a key element
for <secondLevel> and calling the template inside of the first template
seems not to work.
Any ideas??
Cheers,
-Michael
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list