This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Formatting of numbers, dynamically
- From: "David B. Bitton" <david at codenoevil dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Mon, 11 Mar 2002 16:34:27 -0500
- Subject: [xsl] Formatting of numbers, dynamically
- Organization: Code No Evil
- References: <3C8D16A7.2FAF7678@isogen.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
I am current using format-number($node, '#,##0.00') for formatting currency.
We are now implementing foreign currencies into our application. For every
transaction, I have an element, CurrencyCode, which contains the ISO
currencyCode and an attribute @minor_unit which tells me how many digits
follow the decimal seperator. My question is how I can dynamically build
the formatting string.
I was reading this morning in the March 2002 issue of MSDN magazine about
how XSLT is a "Functional programming language", and therefore xsl:variable
entities are "not really variables, rather runtime-assigned constants"
because once they are assigned, the values cannot be changed. So, this lead
me to start thinking about how I could wrap an xsl:for-each with the
xsl:variable element to produce my output. What I don't know if how to
obtain functionality like:
for(i=0;i<=@minor_unit;i++){ ... };
I do not want to use an enbedded JScript solution because I want the XSL to
be portable (namely between MSXML and Xalan). So, how would I construct the
@select attribute in the xsl:for-each to just loop a predetermined number of
times?
--
David B. Bitton
david@codenoevil.com
www.codenoevil.com
Diversa ab illis virtute valemus.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list