Jump to content
CaesarII

Calculation

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

Share this post


Link to post
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>

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

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"

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...