RE: [xsl] XPath number with 20 digits gives you a head ache

Subject: RE: [xsl] XPath number with 20 digits gives you a head ache
From: "Jarno Elovirta" <jarno@xxxxxxxxxxxxxx>
Date: Fri, 26 Jan 2001 13:20:50 +0200
> >   <xsl:value-of select="number(string('92125374252539897737'))" />
> >
[snip]
> > since most processors return
> >
> >   92125374252539900000
[snip]
>
> I hesitate to assert that the above is actually correct, but if you're
> getting it from several processors then the chances are that it is.

Results from XSLT processors I have on my machine:

  Output                XSLT Processor
  ======================================
  92125374252539904000  SAXON 6.1
                        Xalan-C 1.0
                        UXT 1.03.00
                        XT
  92125374252539900000  Xalan-J 2.0.D07
                        Xalan-J 1.2.2
                        MSXML 3.0
  9.21253742525399E19   Oracle V2 (beta)
  2147483647            iXSLT 2.0c

Interesting. Which, if any, is actually right?

> Incidentally calling the string() function on a string literal
> seems rather
> superfluous!

Just a desperate attempt to write a readable question :) BTW, would SAXON
optimize e.g.

  <xsl:value-of select="number(string('42'))" />

to

  <xsl:value-of select="42" />

during stylesheet preparation? And even though no one would ever write
something like

  <xsl:if test="foo[boolean(contains(., 'get something better to read')) =
boolean(number(string(substring('24',1))))]">

would it be optimized somehow before executing the stylesheet to

  <xsl:if test="foo[contains(., 'get something better to read')]">

or something in those lines? Just curious ;)

Jarno


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread