Connecting Tech Pros Worldwide Forums | Help | Site Map

format-number function & .NET

Jim Craig
Guest
 
Posts: n/a
#1: Nov 11 '05
When I do a transform with a stylesheet containing the function
format-number($varname,'#,##0.00') from XSLerator (which uses MSXML) I
get the result I expect, a decimal number rounded to 2 places.

When I load the stylesheet & do the transform from my VB.NET or C#
code however
(i.e. using system.xml etc) I always get NaN returned.

I don't know why, it took me ages to work it out but the fix is to
cast the first parameter in the function to number, i.e.
format-number(number($varname),'#,##0.00'), then I get what I expect.
Anyone know why I am getting this behaviour?

The first version also always used to work from my code before I
migrated to .NET.

TIA

Jim Craig.

Oleg Tkachenko
Guest
 
Posts: n/a
#2: Nov 11 '05

re: format-number function & .NET


Jim Craig wrote:[color=blue]
> When I do a transform with a stylesheet containing the function
> format-number($varname,'#,##0.00') from XSLerator (which uses MSXML) I
> get the result I expect, a decimal number rounded to 2 places.
>
> When I load the stylesheet & do the transform from my VB.NET or C#
> code however
> (i.e. using system.xml etc) I always get NaN returned.
>
> I don't know why, it took me ages to work it out but the fix is to
> cast the first parameter in the function to number, i.e.
> format-number(number($varname),'#,##0.00'), then I get what I expect.
> Anyone know why I am getting this behaviour?[/color]

That may be realted to this bug:
http://groups.google.com/groups?hl=e...ffdd45f&rnum=3

--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Eugene
Guest
 
Posts: n/a
#3: Jul 27 '06

re: format-number function & .NET


Quote:
When I do a transform with a stylesheet containing the function
format-number($varname,"#,##0.00") from XSLerator (which uses MSXML) I
get the result I expect, a decimal number rounded to 2 places.
>
When I load the stylesheet & do the transform from my VB.NET or C#
code however
(i.e. using system.xml etc) I always get NaN returned.
>
I don't know why, it took me ages to work it out but the fix is to
cast the first parameter in the function to number, i.e.
format-number(number($varname),"#,##0.00"), then I get what I expect.
Anyone know why I am getting this behaviour?
>
The first version also always used to work from my code before I
migrated to .NET.
>
TIA
>
Jim Craig.
I agree

That may be realted to this bug:
http://groups.google.com/groups?hl=e...ffdd45f&rnum=3


Posted from http://www.topxml.com/renntp using reNNTP: the website based NNTP reader.
Closed Thread