xsl-list
[Top] [All Lists]

Re: removing comma from within sum command

2004-12-01 09:17:37
That depends on the processor. Which one are you using?

Jay Bryant
Bryant Communication Services




dmitrik(_at_)mindspring(_dot_)com 
12/01/2004 10:09 AM
Please respond to
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com


To
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
cc

Subject
Re: [xsl] removing comma from within sum command






"if your processor has a node-set extension" 

how can this be added?

Thanks,
Dmitri

-----Original Message-----
From: David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk>
Sent: Dec 1, 2004 10:14 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] removing comma from within sum command

I
s there a way to remove commas from the Charge node in this select?

Not in pure XSLT 1, no.

in XSLT 1 sum() can only be applied to text that directly occurs in the
source, if you need to do any transformation before summing you have to
go back to your original plan of using a recursive template.

Or simpler (but probably a bit less efficient) if your processor has a
node-set extension first transform the source into a variable removing
commas but not doing a sum, then sum this new node set.

<xsl:variable name="x">
<xsl:for-each select="Trade/Step
 
[concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),substring(MinFlowDate,4,2))>=
concat(substring($global,7)+3,substring($global,1,2),substring($global,4,2))]

 
[concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),substring(MinFlowDate,4,2))<
concat(substring($global,7)+6,substring($global,1,2),substring($global,4,2))]
   /Charge">
<charge><xsl:value-of select="translate(.,',','.')"/></charge>
</xsl:for-each>
</xsl:variable>

</xsl:variable>

<xsl:value-of select="format-number(sum(xx:node-set($x/charge),
'###,###,##0')"/>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--