Subject: Re: [xsl] grouping and counting of elements From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx> Date: Sun, 22 Apr 2007 16:12:52 +0530 |
The OP wrote, "Each <Result> has the same list of sub-elements, some might not have a text value". Which means, I am perhaps right in not thinking of this improvement.
Heres another way which doesn't rely on all elements being present in the first <Result>:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <Totals> <xsl:for-each-group select="/All_Results/Result/*[normalize-space()]" group-by="name()"> <xsl:element name="{current-grouping-key()}"> <xsl:for-each-group select="current-group()" group-by="."> <Tag value="{current-grouping-key()}" count="{count(current-group())}"/> </xsl:for-each-group> </xsl:element> </xsl:for-each-group> </Totals> </xsl:template> </xsl:stylesheet>
-- Regards, Mukul Gandhi
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] grouping and counting of , Andrew Welch | Thread | [xsl] An invalid character was foun, Steve |
Re: [xsl] Regular Expressions in XP, Rashmi Rubdi | Date | Re: [xsl] using xsl:message with UT, Manfred Staudinger |
Month |