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

Re: how to keep big integer format?

Subject: Re: how to keep big integer format?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 20 Oct 2006 00:15:55 +0100
Re:  how to keep big integer format?
formatting the number may get you a bit further, but eventually you'll
get to a range where adding 1 doesn't change the value (as a double)
try 

      <object_id>1111111111111111111</object_id>

for example.

If you are using xslt you can use the xs:integer type for integers.

<xsl:template match="blueprint">
: <xsl:value-of select="1+marker_object/object_id"/>
: <xsl:value-of select="format-number(1+marker_object/object_id,'#0')"/>
: <xsl:value-of select="1+xs:integer(marker_object/object_id)"/>
</xsl:template>

makes
$ saxon8 int.xml int.xsl
<?xml version="1.0" encoding="UTF-8"?>
: 1.1111111111111112E18
: 1111111111111111168
: 1111111111111111112

for example. 

In XSLT1 you'd have to work a bit harder, implementing decimal encoded
addition using string handling.

David

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.