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?

Thanks.

Answer was:

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.