RE: [xsl] get the sum of a sequence of numbers

Subject: RE: [xsl] get the sum of a sequence of numbers
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 25 Apr 2006 23:17:28 +0100
Try:

sum(for $n in $mb return number($n))

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Karen McAdams [mailto:kemcadams@xxxxxxxxx] 
> Sent: 25 April 2006 23:09
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] get the sum of a sequence of numbers
> 
> I think this should be easy to do but techniques I am using 
> arent working.
> 
> I have template that returns the word count of topics that 
> contain language attributes and assigns it to a sequence. T
> 
> Problem is that when I want total the numbers stored in the 
> sequence using <xsl:variable name="mbt" 
> select="sum(number($mb))"/> what I get are the numbers 
> concatenated together when what I want is the total sum of 
> the values of numbers of which the list consists.  
> Suggestions on the correct way to do this in XSL2.0? thanks.
>  
> --------------------Karen McAdams 

Current Thread