This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: format-number
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Tue, 3 Sep 2002 18:28:44 +0100
- Subject: RE: [xsl] format-number
- Reply-to: xsl-list at lists dot mulberrytech dot com
> Hello Friends,
> I need to format a number with a dynamic format (is it
> possible first of all
> ?) .
> I'm doing the following
> <xsl:value-of select="format-number( sum(.), '{$fmt}' )" />
> and I get {$fmt}as output.
> I need to get the real sum formatted according to the variable $fmt .
>
> Does anyone knows what am I doing wrong .
>
Just write:
<xsl:value-of select="format-number( sum(.), $fmt )" />
Attribute value templates are used to insert an XPath expression into an
attribute value. They aren't used to insert an XPath expression into a
string literal within another XPath expression.
sum(.) is a bit odd: sum() gives a total over a node-set, and "." is a
node-set containing exactly one node.
Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list