This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Loosing Precision after Transformation
- From: "Garvin Franco" <garvin_franco at hotmail dot com>
- To: XSL-List at lists dot mulberrytech dot com
- Date: Thu, 18 Apr 2002 00:44:50 -0400
- Subject: [xsl] Loosing Precision after Transformation
- Reply-to: xsl-list at lists dot mulberrytech dot com
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
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list