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

Re: Problem using Math functions

Subject: Re: Problem using Math functions
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 24 Jan 2006 14:45:49 GMT
xsl math
> Is there any transformer property that i can set at the
> run time for setting the precision bounds?

No, XSLT1 mandates IEEE double.

Of course you can do the addition by hand, something like this (which
assumes the strings have the same length, you'd need to be a bit more
careful otherwise)

add.xml

     <employee>
          <Arg1>1000020000300004000950000</Arg1>
          <Arg2>0000000000000001000060000</Arg2>
     </employee>


add.xsl
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.0">

<xsl:template match="employee">
 <xsl:param name="a" select="Arg1"/>
 <xsl:param name="b" select="Arg2"/>
 <xsl:param name="c" select="0"/>
 <xsl:param name="t" select="''"/>
<xsl:choose>
  <xsl:when test="string($a)">
  <xsl:variable name="x" select="substring($a,string-length($a))+substring($b,string-length($b))+$c"/>
  <xsl:apply-templates select=".">
    <xsl:with-param name="a" select="substring($a,1,string-length($a)-1)"/>
    <xsl:with-param name="b" select="substring($b,1,string-length($b)-1)"/>
    <xsl:with-param name="c" select="floor($x div 10)"/>
    <xsl:with-param name="t" select="concat($x mod 10,$t)"/>
  </xsl:apply-templates>
  </xsl:when>
  <xsl:otherwise>
    <xsl:value-of select="$t"/>
  </xsl:otherwise>
 </xsl:choose>
</xsl:template>

 
</xsl:stylesheet>


 saxon add.xml add.xsl
<?xml version="1.0" encoding="utf-8"?>1000020000300005001010000

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.