May 19, 2003 #1 deepasona Programmer Joined Apr 22, 2003 Messages 7 Location IN Hi, <xsl:value-of select="sum(PersProd/ProductNode/SectionPart/UsageItem/Amount/TaxAmount/Value)"/>) The output value is 21.599999999999998 How to round it to 2 decimal places
Hi, <xsl:value-of select="sum(PersProd/ProductNode/SectionPart/UsageItem/Amount/TaxAmount/Value)"/>) The output value is 21.599999999999998 How to round it to 2 decimal places
May 19, 2003 #2 kibje Technical User Joined May 19, 2003 Messages 13 Location NL i am no xml genie but i think this might be done with a small trick , eg. like this say var a is the number you now have try floor(a*100)/100 or ceiling(a*100)/100 depending on whether you would rather round up or down. Hope this helps kib.at.kibje.com Upvote 0 Downvote
i am no xml genie but i think this might be done with a small trick , eg. like this say var a is the number you now have try floor(a*100)/100 or ceiling(a*100)/100 depending on whether you would rather round up or down. Hope this helps kib.at.kibje.com
May 22, 2003 #3 kibje Technical User Joined May 19, 2003 Messages 13 Location NL <xsl:value-of select="floor(sum(PersProd/ProductNode/SectionPart/UsageItem/Amount/TaxAmount/Value)*100)/100)" /> that should do it Upvote 0 Downvote
<xsl:value-of select="floor(sum(PersProd/ProductNode/SectionPart/UsageItem/Amount/TaxAmount/Value)*100)/100)" /> that should do it
Feb 25, 2004 #4 Hexonx Programmer Joined Jan 10, 2001 Messages 102 Location US Using XmlSpy 4.4, it didn't like using '/' as the division operator. I had to use 'div' operator instead. Mine looked like this: <xsl:value-of select="floor(sum(PersProd/ProductNode/SectionPart/UsageItem/Amount/TaxAmount/Value)*100) div 100"/> Upvote 0 Downvote
Using XmlSpy 4.4, it didn't like using '/' as the division operator. I had to use 'div' operator instead. Mine looked like this: <xsl:value-of select="floor(sum(PersProd/ProductNode/SectionPart/UsageItem/Amount/TaxAmount/Value)*100) div 100"/>
Sep 2, 2005 1 #5 jd323 Technical User Joined Sep 1, 2005 Messages 7 Location GB or you can use the function Code: <xsl:variable name="number" select="sum(PersProd/ProductNode/SectionPart/UsageItem/Amount/TaxAmount/Value)" /> <xsl:value-of select="format-number($number,'#.##')"/> Upvote 0 Downvote
or you can use the function Code: <xsl:variable name="number" select="sum(PersProd/ProductNode/SectionPart/UsageItem/Amount/TaxAmount/Value)" /> <xsl:value-of select="format-number($number,'#.##')"/>