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

Loosing Precision after Transformation

  • To: xml-dev@l...
  • Subject: Loosing Precision after Transformation
  • From: "Garvin Franco" <garvin_franco@h...>
  • Date: Thu, 18 Apr 2002 00:57:20 -0400
  • Bcc:

transformation before after

Has anyone had problems loosing precision after transforming a message using
Xalan??

Problem:
I have content stored in an element as follows
<aNumber>12345.12345</aNumber>

I format the content in this element for output as follows ( note: length 10
with 0 padding )

<xsl:value-of select="format-number(number*100000,'0000000000')"/>

On the ouput I get 1234512344, which is off by .00001. I need the exact
value on the source document.  I tried a substring-before and
substring-after the the decimal separator '.', then concatenated the total
and fractional parts, then formatted as I have shown above, and I got the
same thing. I know its loosing precision when the string is changed to a
number, but the funny thing is, if a string less than the full length ( 10
in this case ) of the field is passed, all is well.
Example
<number>1234.12345</number> ----> 01234.12345 ( which makes me happy )

Does anyone know what approach I can use here to solve this problem?

Thanking you in advance
Garvin


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.