RE: [xsl] format-number

Subject: RE: [xsl] format-number
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 3 Sep 2002 18:28:44 +0100
> 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@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread