Thanks for the help Michael. I have found the solution the correct xsl is::
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.1" xmlns:java="http://xml.apache.org/xslt/java"
xmlns:str="http://exslt.org/strings"
xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
xmlns:xalan="http://xml.apache.org/xalan"
extension-element-prefixes="redirect">
<xsl:output method="xml" version="1.0" encoding="ISO-8859-1"
indent="yes"/>
<xsl:template match="/">
<Root>
<xsl:apply-templates
select="/Root/CLIENT_HEADER_RECORD_TYPE-HT"
mode="_Root_Record_order1"></xsl:apply-templates>
</Root>
</xsl:template>
<xsl:template match="/Root/CLIENT_HEADER_RECORD_TYPE-HT"
mode="_Root_Record_order1">
<Record>
<xsl:variable name="varClientNumber" select="CLIENT_NUMBER"/>
<xsl:variable name="varCTDCSibling" select="count(following::
CLAIM_SETUP_CHANGE_RECORD_TYPE-CT[CLAIM_SETUP_CHANGE_RECORD_TYPE =
'CT' and DATA_TYPE = 'DC' and
CLIENT_NUMBER=$varClientNumber])"/>
<xsl:variable name="varETDCSibling"
select="following::EXPERIENCE_SETUP_CHANGE_RECORD_TYPE-ET[DATA_TYPE =
'DC' and CLIENT_NUMBER=$varClientNumber]/EXPER_AMT_BY_RESERVE1"/>
<xsl:variable name="xml-subset">
<xsl:for-each select="$varETDCSibling">
<a>
<xsl:value-of select="number(translate(. ,'+',''))"/>
</a>
</xsl:for-each>
</xsl:variable>
<ErrorMessage><xsl:value-of
select="sum(xalan:nodeset($xml-subset)//a)"/></ErrorMessage>
<CTDC>
<xsl:value-of select="$varCTDCSibling"/>
</CTDC>
</Record>
</xsl:template>
</xsl:stylesheet>
----- Original Message -----
From: "Michael Kay" <mike(_at_)saxonica(_dot_)com>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Monday, June 26, 2006 10:03 PM
Subject: RE: [xsl] Fw: problem with sum() function
Hi All
I am using sum() function with nodelist. Now my
problem is that
when a source elemnt contains leading + sign then sum
returns NAN. Is
there
a way to remove this + sign and then calculate the sum.
Google for "XSLT 1.0 sum of computed value".
XSLT 2.0 allows the leading plus sign; and if it didn't, you could do it
with
sum(for $x in $nodeset return number(translate($x, '+', ''))
Michael Kay
http://www.saxonica.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>
--~--