Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] removing comma from within sum command

From: "Michael Kay" <mike@------------>
To:
Date: 12/1/2004 4:13:00 PM
This is the equivalent of the classic "sum of price
times quantity for all items". Solutions include:

(a) write a recursive named template
(b) (Saxon extension) saxon:sum(//item, saxon:expression("@price * @qty"))
(c) (XSLT 2.0, Saxon 8) sum(for $i in //item return $i/@price * $i/@qty) 
(c2) (next Saxon release) sum(//item/(@price * @qty))
(d) Dimitre's FXSL library (fxsl.sourceforge.net)
(e) create a temporary tree containing the values you want to sum, then use
sum(xx:node-set($temp/values))

In your case, replace "price * quantity" with "translate(., ',', '')".

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

> -----Original Message-----
> From: dmitrik@xxxxxxxxxxxxxx [mailto:dmitrik@xxxxxxxxxxxxxx] 
> Sent: 01 December 2004 15:05
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] removing comma from within sum command
> 
> Is there a way to remove commas from the Charge node in this select?
> placing translate around charge seems to cause an error.: " 
> NodeTest expected here."
> 
> <xsl:value-of select="format-number(sum(Trade/Step
>    
> [concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),su
> bstring(MinFlowDate,4,2))&gt;=
> concat(substring($global,7)+3,substring($global,1,2),substring
> ($global,4,2))]
> 
>    
> [concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),su
> bstring(MinFlowDate,4,2))&lt;
> concat(substring($global,7)+6,substring($global,1,2),substring
> ($global,4,2))]
>    /Charge), '###,###,##0')"/>
> 
> 
> 
> Thanks,
> Dmitri


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent