After developing a transform with XML Spy
and using the internal XSLT
engine, I was surprised when Xalan gave a different result. It seems that
when a number includes scientific notation, any math with that number
returns a NAN. For example, with this XML file
<sets>
<tol>100</tol>
<val>1000</val>
<val>1.0E5</val>
</sets>
And this XSL file
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="text"/>
<xsl:variable name="Tol"
select="number(sets/tol)"/>
<!-- Process the root element -->
<xsl:template match="/">
<xsl:apply-templates
select="sets/val"/>
</xsl:template>
<xsl:template match="val">
<xsl:variable
name="low" select=". - $Tol"/>
<xsl:value-of
select="$low"/>
<xsl:text>,</xsl:text>
<xsl:variable
name="high" select=". + $Tol"/>
<xsl:value-of
select="$high"/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
xalan nantest.xml nantest.xsl
The first <val> will yield an output of: 900,1100
The second <val> will yield an output of: NaN,NaN
The XMLSpy engine correctly gives: 99900,100100
I am using Xalan version 1.8.0. Xerces
version 2.5.0.
Any work around?
Ken.
+--------------------------------------+
Kenneth L. Holladay, PE
Southwest Research Institute
6220 Culebra Road, San Antonio, TX 78238
email: [EMAIL PROTECTED]
Voice: (210)522-3627; Fax: (210)522-2709
+--------------------------------------+