I have this piece of code:

<xsl:value-of select="format-number(/object/data/row/EGL_1244 - /object/data/row/EGL_1886,'0.00')"/>

The idea is it subtracts EGL_1886 from EGL_1244 and displays the result as a number.

However, on occasion each value can have a comma in it. So the value "1,234.56" would make the result show NaN.

How can I rework the code to handle incoming data values that have commas?


Answer was:

<xsl:value-of select="format-number(number(translate(/object/data/row/EGL_1244, ',', '')) - number(translate(/object/data/row/EGL_1886, ',', '')), '0.00')"/>