XSLT error with number and format-number functions

Discussion in 'XML' started by silellak@gmail.com, Sep 18, 2006.

  1. Guest

    I have found an odd error when using an XSL stylesheet transform. We
    have a Notes/Domino application with the following line of code in one
    of the stylesheets:

    <xsl:value-of
    select="format-number(number(ActEmpMoneyValue),'###,###0.00')" />

    After transforming an XML document object with this stylesheet, the
    value in the XML node ActEmpMoneyValue is not calculated, but a flat
    value such as "19.31". After being processed as above on our local
    system/codebase, it becomes "19.31", as expected. However, the exact
    same code on certain customer systems takes "19.31" and turns it into

    "19.3000000000000000009"

    As far as I can tell, the only reasonable explanation for this issue is
    that the functions are returning an incorrect value. When I changed it
    to just use the "number" function, I got the same result - same with
    just the "format-number" function. When I used neither, the result was
    correct.

    Has anyone seen similar behavior? If so, how did they get around it?

    Thanks!
    , Sep 18, 2006
    #1
    1. Advertising

  2. wrote:
    > However, the exact
    > same code on certain customer systems


    .... which are obviously running a different release of something.
    (Notes? Java? The XSLT engine, whichever it is? Other?) If you've got
    outdated code the first thing to try is upgrading; it may be a
    legitimate bug that's already been fixed.

    This smells like either a floating-point-math roundoff problem, or a
    flat-out bug in the XSLT implementation's math/rendering routines.


    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, Sep 19, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Xiangliang Meng
    Replies:
    1
    Views:
    1,577
    Victor Bazarov
    Jun 21, 2004
  2. RolfK
    Replies:
    1
    Views:
    1,035
    Pavel Lepin
    Jan 8, 2008
  3. Ken Starks
    Replies:
    4
    Views:
    333
    Ken Starks
    Jun 23, 2008
  4. Chris Rebert
    Replies:
    1
    Views:
    375
    Grant Edwards
    Nov 5, 2010
  5. Fei Liu
    Replies:
    21
    Views:
    2,311
    John Bokma
    Dec 16, 2006
Loading...

Share This Page