[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: format-number abd numerical truncation

Subject: RE: format-number abd numerical truncation
From: "Nunnington, John" <johnn@xxxxxxxxx>
Date: Fri, 29 Aug 2003 09:40:10 +0100
xslt truncation
We're using Xalan. This is all part of a billing solution so much of this is
largely transparent to me. Although we have an apparent option to select
Saxon or XT, neither of these appear to work with the installation we have
or part of the XSLT we're trying to do.

-----Original Message-----
From: Michael Kay [mailto:mhk@xxxxxxxxx] 
Sent: 28 August 2003 23:45
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  format-number abd numerical truncation

Really, when you get results that are as obviously broken as this, you
should tell us which XSLT processor you are using.

(But before you do that it's always worth checking to see that another
processor gives the answer you expected. However sure you are that your
own code is correct, you can be wrong.)

Incidentally, XSLT 1.0 isnt' very specific about exactly how rounding
should be done in format-number(). It refers to the JDK 1.1 spec, which
doesn't say. Later versions of the JDK are much more specific, however.
Later versions of the spec also document some bugs which XSLT
implementations may or may not reproduce, for example the fact that most
of the negative sub-picture gets ignored.

Michael Kay

> 
> We've encountered a problem with format-number where-by the 
> value part actually changes according to the precision.
> 
>  
> 
> XML:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <AR_ITEMS elem="4">
>    <EVENTS elem="1">
>       <TOTAL elem="826">
>          <AMOUNT>0.00000073173</AMOUNT>
>       </TOTAL>
>    </EVENTS>
>    <EVENTS elem="2">
>       <TOTAL elem="826">
>          <AMOUNT>0.0000073173</AMOUNT>
>       </TOTAL>
>    </EVENTS>
>    <EVENTS elem="3">
>       <TOTAL elem="826">
>          <AMOUNT>0.000073173</AMOUNT>
>       </TOTAL>
>    </EVENTS>
>    <EVENTS elem="4">
>       <TOTAL elem="826">
>          <AMOUNT>0.73173</AMOUNT>
>       </TOTAL>
>    </EVENTS>
>    <EVENTS elem="5">
>       <TOTAL elem="826">
>          <AMOUNT>0.073173</AMOUNT>
>       </TOTAL>
>    </EVENTS>
>    <EVENTS elem="6">
>       <TOTAL elem="826">
>          <AMOUNT>0.00073173</AMOUNT>
>       </TOTAL>
>    </EVENTS>
> </AR_ITEMS>
> 
> 
> 0.0000
> 0.0000
> 0.1000
> 0.7317
> 0.7320
> 0.7000
>  
> 
>  
> 
> ....we never fixed this so we though that we'd correct the 
> rounding in the source program. This worked OK, as long as we 
> had a full complement of digits after the decimal point. When 
> we have a number with less, say 0.7320, it is being displayed at 0.732
> 
>  
> 
> Anybody ever comes across either of these problems and 
> resolved them or found them to be persistent bugs?
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.