[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Problem using Math functions


Subject: RE: [xsl] Problem using Math functions
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 24 Jan 2006 14:18:47 -0000

XSLT 1.0 offers only double-precision floating point. That doesn't carry
enough digits of precision for this problem.

XSLT 2.0 offers decimal and integer arithmetic. The limits on precision
(above 18 digits) are implementation defined, but Saxon offers unlimited
precision. So it should get this one right, provided that you are careful to
ensure the value is treated as an integer rather than a double.

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

> -----Original Message-----
> From: Pankaj Bishnoi [mailto:pankaj.bishnoi@xxxxxxxxxxx] 
> Sent: 24 January 2006 13:55
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Problem using Math functions
> 
> Hi
>     I am facing problem in math function '+'.  My Source XML is :::
> 
> <employees>
>     <employee>
>          <Arg1>1000020000300004000050000</Arg1>
>          <Arg2>0000000000000001000010000</Arg2>
>     </employee>
> </employees>
> 
> and  XSL is ::::
> 
>      <xsl:template match="/">
>       <employees>
>         <employee>
>           <Output>
>           <xsl:value-of select="/employees/employee/Arg1+
> /employees/employee/Arg2"/>
>           </Output>
>          </employee>
>           </employees>
>      </xsl:template>
> 
> Now the Output generated is ::::
> 
> 
> <employees>
> <employee>
>  <Output>1000020000300005000000000</Output>
> </employee>
> </employees>
> 
> 
> 
> Now here the output generated is 1000020000300005000000000 it 
> should have
> been 1000020000300005000060000.   I am using Xalan transformer for my
> transformations. Here the transformer is appending five 0's 
> in the last 5
> positions. whenever the ouput exceeds 20 characters then it 
> inserts 0's.
> 
> Anybody having any idea on this problem??
> 
> Please advise. Thanks in advance.
> 
> Thanks
> Pankaj


Current Thread
Keywords