473,785 Members | 2,768 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

format-number format string incompatability

I am using format-number(-1234.56,'#,##0. 00;(#,##0.00)') in a stylesheet
that works in every xsl processor (including MSXML2) except for the one in
..NET 1.1. I am expecting to see (1,234.56) as the result of this function,
but am getting an ArgumentExcepti on : NumberGroupSize s error with the
message "Parameter name: Every element in the value array should be between
one and nine, except for the last, which can be zero"

If I use just '(#,##0.00)' as the format, it gives me the expected result
(for both positive and negatives numbers) so it seems to be the second part
of the format after the ';'

Can anyone shed any light on this or suggest a viable workaround.

Thanks for the time
Nov 12 '05 #1
2 5547
"Richard Haber" <ri***********@ hotmail.com> wrote in message news:OQ******** ******@TK2MSFTN GP12.phx.gbl...
I am using format-number(-1234.56,'#,##0. 00;(#,##0.00)') in a stylesheet
that works in every xsl processor (including MSXML2) except for the one in
.NET 1.1. I am expecting to see (1,234.56) as the result of this function,
but am getting an ArgumentExcepti on : NumberGroupSize s error with the
message "Parameter name: Every element in the value array should be between
one and nine, except for the last, which can be zero" : : Can anyone shed any light on this or suggest a viable workaround.


- - - workaround.xsl (excerpt)
<!-- . . . -->
<xsl:template name="formatNum ber">
<xsl:param name="num" />
<xsl:choose>
<xsl:when test="number($n um) &lt; 0">
<xsl:value-of select="format-number( number($num), '(#,##0.00)')" />
</xsl:when>
<xsl:when test="number($n um) &gt;= 0">
<xsl:value-of select="format-number( number($num), '#,##0.00')" />
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- . . . -->
<xsl:call-template name="formatNum ber">
<xsl:with-param name="num" select="-1234.56" />
</xsl:call-template>
<!-- . . . -->
- - -
Derek Harmon
Nov 12 '05 #2
Thanks for the quick response. This is a viable workaround.

Still left wondering why the .NET XSL classes seem to have been 'dumbed
down' from the rest of the XSLT Processors. Other Microsoft products have
extensive support for number formatting, e.g., Excel, so this can't be
unknown territory for them

"Derek Harmon" <lo*******@msn. com> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
"Richard Haber" <ri***********@ hotmail.com> wrote in message news:OQ******** ******@TK2MSFTN GP12.phx.gbl...
I am using format-number(-1234.56,'#,##0. 00;(#,##0.00)') in a stylesheet
that works in every xsl processor (including MSXML2) except for the one in .NET 1.1. I am expecting to see (1,234.56) as the result of this function, but am getting an ArgumentExcepti on : NumberGroupSize s error with the
message "Parameter name: Every element in the value array should be between one and nine, except for the last, which can be zero"

: :
Can anyone shed any light on this or suggest a viable workaround.


- - - workaround.xsl (excerpt)
<!-- . . . -->
<xsl:template name="formatNum ber">
<xsl:param name="num" />
<xsl:choose>
<xsl:when test="number($n um) &lt; 0">
<xsl:value-of select="format-number( number($num),

'(#,##0.00)')" /> </xsl:when>
<xsl:when test="number($n um) &gt;= 0">
<xsl:value-of select="format-number( number($num), '#,##0.00')" /> </xsl:when>
</xsl:choose>
</xsl:template>
<!-- . . . -->
<xsl:call-template name="formatNum ber">
<xsl:with-param name="num" select="-1234.56" />
</xsl:call-template>
<!-- . . . -->
- - -
Derek Harmon

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1510
by: kevininstructor | last post by:
The following was copied from a web site for learning formatting. Dim myInt As Integer = 100 Dim FormatPrice As String = String.Format("Price = |{0,10:c }|", myInt) Console.WriteLine(FormatPrice) The result shown is no number but the character c as in the format string. Is the format not valid in this context? Thanks for your assistance, Kevin
6
3405
by: Servé Lau | last post by:
suppose I want to use sscanf get the functionname from a function prototype. Is the following format string correct then? char funcname; char *p = "func(void)"; sscanf(p, "%s", funcname); // "%s"
6
2613
by: Donal McWeeney | last post by:
Hi, Is there a way to specify on the predefined format strings like P and N that you want displayed all the decimals in the number... for example 3 will display 3 2.1 will display 2.1 3.21 will display 3.21
2
1582
by: MM | last post by:
Hi, I have a param class containg these vars:- string key; // eg: "WN" object value; // eg: 1.2 string format; // eg "F2" and I output these to a StreamWriter using nc_file.Write("{0}{1:" + param.format + "}", param.key, param.value);
7
7667
by: Eddy Soeparmin | last post by:
Hi, I need to display a DateTime field in 'mm/dd/yyyy' in a DataGrid.. On myGrid1 - Properties - Columns - myColumn1 - Text format string: I tried to put 'mm/dd/yyyy' in there and it displays 'mm/dd/yyyy' in stead of '04/10/2001'. I know I didn't do it right. Please let me know what's the correct way to display a 'mm/dd/yyyy' format for a DateTime coulmn. Thanks.
4
6995
by: James | last post by:
vb.net 2003 i used console.writeline to output to screen. eg console.writeline ("test1 : " & vbtab & v_test1) console.writeline ("test2 : " & vbtab & v_test2) etc etc result becomes
3
12801
by: stathisgotsis | last post by:
Hello everyone, Trusting K&R2 i thought until recently that spaces are ignored in scanf's format string. Reading arguments to the contrary confused me a little. So i now ask: Is scanf("%d%d",...) different from scanf("%d %d",...) in the Standard's point of view? Thank you.
7
9950
by: moondaddy | last post by:
I need to format a string to it always has 2 digits in it. I'm getting the month like this: DateTime.Now.Month.ToString() Right now since it's August, this returns a string of "8", however, I need to return a string of "08". Is there a format method what will automatically pad this for me? Thanks.
7
13685
by: Andrus | last post by:
How to create format string for decimal data type which shows blank for zero and default format otherwize ? I tried format string "f;f;#" but this shows f for nonzero numbers. Andrus. using System.Windows.Forms;
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10148
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3646
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.