This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

How to group a list twice


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]