Re: [xsl] want to display sum of every two records

Subject: Re: [xsl] want to display sum of every two records
From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx>
Date: Wed, 24 Feb 2010 20:48:20 +0530
On Tue, Feb 23, 2010 at 6:28 PM, anil kumar <anar.leti@xxxxxxxxx> wrote:
> expected o/p
> ==============
> <mezo eazon="AA">200</mezo>
> <mezo eazon="AA">150</mezo>
> .
> .
> <mezo eazon="BB">10,000</mezo> -- total of 24 AA records.
> <mezo eazon="AA">300</mezo>
> <mezo eazon="AA">50</mezo>

Are you working in XSLT 1.0 or 2.0 environment? Here's a 2.0 way of
solving this (this is untested):

<xsl:if test="(count(preceding-sibling::mezo) + 1) mod 24 eq 0">
  <mezo eazon="BB">
     <xsl:value-of select=". + sum(for $x in (1 to 23) return
preceding-sibling::mezo[$x])" />
  </mezo>
</xsl:if>

If it's a 1.0 environment, we have to think of some other way of solving it.


-- 
Regards,
Mukul Gandhi

Current Thread