xsl-list
[Top] [All Lists]

RE: XSLT 2.0 Decimal number silliness

2004-03-26 01:55:39
Hi,


<xsl:template match="/">~
<xsl:value-of select="2.0 div 3.0" />~
<xsl:value-of select="0.444 div 0.666" />~
</xsl:template>

</xsl:stylesheet>

Using Saxon 7.x, this results in:

<?xml version="1.0" encoding="UTF-8"?>~
0.666666666666666667~
0.666666666666666666666667~

Both lines of output should be equal. There's got to be something better. At least allow specification of number of fraction digits.

--jeff

I am curious how the output would compare if you made a test like:

<xsl:choose>
<xsl:when test="(2.0 div 3.0)=(0.444 div 0.666)">
 They are equal
</xsl:when>
<xsl:otherwise>
 They are not equal
</xsl:otherwise>
</xsl:choose>

Does the number of decimals here affect the outcome?

Regards,
Ragulf Pickaxe :)

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail