Skip to Content
0
Former Member
Jun 28, 2011 at 02:51 PM

XSL addition returns incorrect answer

28 Views

Hi,

I have a piece of XSL code to do some mapping in PI 7.1 which works correctly in XML Spy, but when imported into PI gives an incorrect result.

The source XML contains

	<HEADER>
		<BALANCE>333.33</BALANCE>
	</HEADER>
	<DATA>
		<DEBIT>15.42</DEBIT>
		<CREDIT>0.00</CREDIT>
	</DATA>
	<DATA>
		<DEBIT>0.00</DEBIT>
		<CREDIT>14.00</CREDIT>
	</DATA>

The code is

<xsl:value-of select="//HEADER/BALANCE + //DATA[2]/CREDIT - //DATA[1]/DEBIT"/>

Pretty basic stuff. However PI is returning a value of 331.90999999999997 instead of 331.91

Yes, it's close, but this is addition. It should be exact.

Any ideas?

John