Jump to content

Calculation


CaesarII

Recommended Posts

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...