CaesarII Posted July 29, 2012 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
CaesarII Posted July 31, 2012 Author 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>
CaesarII Posted August 7, 2012 Author 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)
CaesarII Posted August 13, 2012 Author 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"
Recommended Posts
Archived
This topic is now archived and is closed to further replies.