CaesarII Posted July 29, 2012 Share Posted July 29, 2012 Hi I'm attempting to use XSL to caluclate the grand total for two invnoices, whilst the calculation provides a number, on the first invoice's grand total, the number is off by 0.05 and on the second invoice there is "000000000001" after the correct first two decimal places. This is the XSL code I'm using to make the calculation:<td style="text-align:center;"> <strong><xsl:value-of select="sum(//item_price)" /></strong> </td> CaesarII Link to comment Share on other sites More sharing options...
CaesarII Posted July 31, 2012 Author Share Posted July 31, 2012 The following code is a snipit of my xml code in case its useful <invoice> <item_id>11224432</item_id> <name>Toshiba Laptop</name> <photo> <img src="images/Laptop.jpg" /> </photo> <item_price>125.00</item_price> <price>125.00</price> </invoice> Link to comment Share on other sites More sharing options...
CaesarII Posted August 7, 2012 Author Share Posted August 7, 2012 I’ve figured out why the first calculation was wrong, I’d entered the information wrong. However the second calculation, the one with "000000000001" at the end of it, is still incorrect, I’ve also discovered that this calculation goes wrong at between 0.45 & 0.46 (with the total being 74.49000000000001) Link to comment Share on other sites More sharing options...
CaesarII Posted August 13, 2012 Author Share Posted August 13, 2012 i've come up with a soloution, it isen't the most elegent, but it woks. In the XML document i added a secondn item price to the affected calculation which was "-0.000000000001" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now