You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Andrew Fielden <af...@tibco.com> on 2005/10/26 12:43:40 UTC

Arithmetic expression involving double yields 'NaN'

If I apply the following transformation -

<xsl:param name="Output_Data"/>
    <xsl:template match="/">
        <SW_FIELDS>
            <user_fields>
                <OUT1>
                    <xsl:value-of select="$Output_Data/ns:Data + 1.0"/>
                </OUT1>
            </user_fields>
        </SW_FIELDS>
    </xsl:template>
</xsl:stylesheet>

To the following XML -

<ns0:Output_Data
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns0="http://xmlns.example.com/unique/default/namespace/11220292468
46">
<ns0:Data>1.2E1</ns0:Data>
</ns0:Output_Data>

The result is -

<SW_FIELDS>
<user_fields>
<OUT1>NaN</OUT1>
</user_fields>
</SW_FIELDS>


It appears that a double value containing an exponent is not processed
correctly.
Is there any workaround for this problem?

Thanks.
Andrew Fielden.


Re: Arithmetic expression involving double yields 'NaN'

Posted by Joseph Kesselman <ke...@us.ibm.com>.
The XPath data model doesn't accept scientific notation for numbers, so a
value with E in it is Not A Number. Sorry, but that's what the spec gives
us.

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk