xsl-list
[Top] [All Lists]

RE: [xsl] how to keep big integer format?

2006-10-20 08:18:17
I knew there was something strange about the original output as I'd
never seen a result like that in XSLT 1.0.  I guess I should have asked
her which version she was using. . . .

live and learn,
b.

-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com]
Sent: Thursday, October 19, 2006 5:19 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] how to keep big integer format?




I am using xslt to transform xml to xml and want to update
object_id value by adding 1. But the result returns
4.967039E6 instead of 4967039.
How can I get what I want?


XSLT 1.0 never uses exponential notation on output; XSLT 2.0 uses it
by
default for floating point numbers outside the range 1e-6 to 1e+6. The
simplest way to avoid exponential notation is to use integer
arithmetic
rather than floating point arithmetic. You're probably using floating
point
because that's the default for untyped data when you don't have a
schema.
You can convert to an integer instead by using, for example
xs:integer(object_id)+1. - or, of course, by doing schema-aware
processing
with a schema that describes the type of object_id as xs:integer.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--