Monday, October 24, 2011

format-number with 0 in xslt using dot net

I was using the following code in my xslt to format number and then used to apply this xslt on xml in dot net.
<xsl:value-of select="format-number(number,'#.#####')" />
And it was showing result as required but when number value become 0 , it returns the empty as I tried to hard code number value with 0.
<xsl:value-of select="format-number(0,'#.#####')" />
and it was giving outuput 0 but  when I used the same code in simple xslt and simple xml (and linked xslt with xml file in note pad ) and runs this in browser , It gave me the correct result in form of 0.
I was surprised why this is not working in dot net code and working in browser with simple xslt file and xml file without using dot net code.

Then I found a solution regarding dot net as
<xsl:value-of select="format-number(0,'#0.#####')" />
But still I am not be able to understand why this is working in simple browser and not working in dot net code?

No comments:

Post a Comment