Antwort: Re: [xslt] format-number() and NaN
- From: "Stephan Otte" <Stephan Otte pcc de>
- To: xslt gnome org
- Subject: Antwort: Re: [xslt] format-number() and NaN
- Date: Wed, 18 Jul 2001 17:54:45 +0200
>On Wed, Jul 18, 2001 at 04:56:16PM +0200, Stephan Otte wrote:
>> As Michael Kay's XSLT Programmer's Reference says,
>> the conversion rules for the value argument of format-number() from string to
>> number
>> are the same as for the number() function.
>> format-number("", "###.###") or format-number("xyz", "###.###") should
>> therefore give NaN as result,
>> which could be redirected with <xsl:decimal-format NaN="not available">.
>> But libxslt gives something like 000000.000000 (many, many zeroes)!
>> What' wrong?
>> The number() function works correctly in these cases.
> Please provide a complete but minimal test case, Bjorn may find the
> time to look at it, otherwise I will try to find out what's happening,
>
> thanks,
>
> Daniel
Here is are the test cases:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
Case 1:
<xsl:value-of select="format-number('', '###.###')"/>
<!-- outputs NOT "NaN" as expected -->
Case 2:
<xsl:value-of select="number('')"/>
<!-- outputs NaN, ok -->
Case 3:
<xsl:value-of select="format-number(non/existing/path, '###.###')"/>
<!-- outputs NOT "NaN" as expected -->
Case 4:
<xsl:value-of select="number(non/existing/path)"/>
<!-- outputs NaN, ok -->
</xsl:template>
</xsl:stylesheet>
thanks,
Stephan
======================
stephan.otte@pcc.de
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]