xsl-list
[Top] [All Lists]

RE: format-number

2002-09-03 10:28:44
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(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 


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



<Prev in Thread] Current Thread [Next in Thread>