xsl-list
[Top] [All Lists]

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

2006-10-19 16:16:29

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


--~------------------------------------------------------------------
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>
--~--