May 19, 2003 #1 deepasona Programmer Apr 22, 2003 7 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 May 19, 2003 13 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 May 19, 2003 13 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 Jan 10, 2001 102 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 Sep 1, 2005 7 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,'#.##')"/>