on 12-12-2005 10:44 PM
Hi Guru(s):
I have an XSLT mapping within an File to BPM scenario. The Flat file has an amount field of 13 characters, and reads a value like 16.10, followed by trialing whitespace to fill out the 13 positions.
I am able to read this file properly with a file adapter (have content conversion), which I am mapping to a BPM input.
I have an XSLT mapping that trasnfrms the file output to the BPM input. After the transformation, sometimes, the <SignedAmount> attribute has a non-conforming output, something like: 1610.0000000000002
Is this a bug in XSLT. How can this be resolved.
BTW: I am using XI3.0 SP14.
XSLT Code snippet:
<SignedAmount>
<xsl:choose>
<xsl:when test="DebitCreditIndicator[1]='D'">
<xsl:value-of select="number(ChargeAmount[1] * '100')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="number(ChargeAmount[1] * '-1' * '100')"/>
</xsl:otherwise>
</xsl:choose>
</SignedAmount>
However, I get to see different behaviors for different nodes on the output.
In particular, note the second ISEG node:
- <ISEG>
<SignedAmount>79</SignedAmount>
</ISEG>
- <ISEG>
<SignedAmount>1610.0000000000002</SignedAmount>
</ISEG>
The Actual Output of the file adapter looks fine as below:
<Detail>
<ChargeAmount>0.79</ChargeAmount>
</Detail>
<Detail>
<ChargeAmount>16.10</ChargeAmount>
</Detail>
Thanks
Feroz
Hi:
Thanks very much for responding. However, here are the concerns:
1. I plan to use the sum function to validate that the Amount Totals. I am running into a situation 4494.55 comparing to 4494.55000000000002
2. On my xslt, I do not understand why the for-each loop generates different outputs for amount fields.
Thanks
Feroz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Why don't you try formating the number with XSL?
<xsl:template match="/">
<html>
<body>
<xsl:value-of select='format-number(500100, "#.00")' />
<br />
<xsl:value-of select='format-number(500100, "#.0")' />
<br />
<xsl:value-of select='format-number(500100, "###,###.00")' />
<br />
<xsl:value-of select='format-number(0.23456, "##%")' />
<br />
<xsl:value-of select='format-number(500100, "#######")' />
</body>
</html>
</xsl:template>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.