Subject: [xsl] Grouping a List into A Grid Structure From: Jeff Sese <jeferson.sese@xxxxxxxxxxxx> Date: Mon, 23 Jun 2008 11:20:31 +0800 |
<root> <list> <item type="a">list 1 item 1</item> <item type="b">list 1 item 2</item> </list> <list> <item type="a">list 2 item 1</item> <item type="b">list 2 item 2</item> <item type="b">list 2 item 3</item> <item type="b">list 2 item 4</item> </list> <list> <item type="a">list 3 item 1</item> <item type="b">list 3 item 2</item> <item type="b">list 3 item 3</item> </list> </root>
<root> <list> <item type="a">list 1 item 1</item> <item type="a">list 2 item 1</item> <item type="a">list 3 item 1</item> <item type="b">list 1 item 2</item> <item/> <item/> <item/> <item type="b">list 2 item 2</item> <item type="b">list 3 item 2</item> <item/> <item type="b">list 2 item 3</item> <item type="b">list 3 item 3</item> <item/> <item type="b">list 2 item 4</item> <item/> </list> </root>
<xsl:template match="root"> <xsl:for-each-group select="list/item" group-by="@type"> <xsl:choose> <xsl:when test="current-grouping-key()='a'"> <xsl:copy-of select="current-group()"/> </xsl:when> <xsl:otherwise> <!-- grouping logic here --> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </xsl:template>
Thanks in advance, -- Jeff
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] the future of xslt, bryan rasmussen | Thread | Re: [xsl] Grouping a List into A Gr, Florent Georges |
RE: [xsl] the future of xslt, Michael Kay | Date | [no subject], Unknown |
Month |