Subject: Re: [xsl] two-level grouping From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Thu, 06 Mar 2008 16:21:21 +0100 |
I am stuck on a two-level grouping problem. This one is slightly different from the last one. I believe it involves nested grouping sequences, but I have been wrong on numerous occasions before.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template>
<xsl:template match="bodymatter"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:for-each-group select="*" group-starting-with="chapter"> <level1> <xsl:for-each-group select="current-group()" group-starting-with="a-head"> <xsl:choose> <xsl:when test="current-group()[1][self::a-head]"> <level2> <xsl:apply-templates select="current-group()"/> </level2> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="current-group()"/> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </level1> </xsl:for-each-group> </xsl:copy> </xsl:template>
Martin Honnen http://JavaScript.FAQTs.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] two-level grouping, Terry Ofner | Thread | [xsl] [XSLT] Put element in new-lin, igutierrez027 |
Re: [xsl] Why Are My Tunnel Paramet, Eliot Kimber | Date | Re: [xsl] Why Are My Tunnel Paramet, Vyacheslav Sedov |
Month |