Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSLT error with number and format-number functions

Reply
Thread Tools

XSLT error with number and format-number functions

 
 
silellak@gmail.com
Guest
Posts: n/a
 
      09-18-2006
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!

 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      09-18-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OT: Number Nine, Number Nine, Number Nine FrisbeeŽ MCSE 37 09-26-2005 04:06 PM
ANN: New low-cost XML Editor, XSLT Editor, XSLT Debugger, DTD/Schema Editor Stylus Studio Java 0 08-03-2004 03:53 PM
please help me in distinguish redefining functions, overloading functions and overriding functions. Xiangliang Meng C++ 1 06-21-2004 03:11 AM
xslt alone or xslt/java for static site? ted XML 1 01-26-2004 10:41 AM
[XSLT]Passing values from Javascript to a XSLT variable Benjamin Hillsley XML 3 09-25-2003 04:50 AM



Advertisments