|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: format decimal numbers issue
> <xsl:variable name="tput"> > <xsl:call-template name="display-dec-sec"> > <xsl:with-param name="value" select="$count > div $timeSpan * 1000" /> > </xsl:call-template> > </xsl:variable> So you call display-dec-sec supplying a number, and you get back a string representation such as "5.894 s" > > <td> > <xsl:call-template name="display-dec-sec"> > <xsl:with-param name="value" select="$tput" /> > </xsl:call-template> > </td> Now you're calling display-dec-sec again, only this time you don't supply a number, you supply a string like "5.894 s". > > <xsl:template name="display-dec-sec"> > <xsl:param name="value" /> > <xsl:value-of > select="format-number($value,'#,.000 s')" /> > </xsl:template> > > [xslt] C:\detail.xsl:153: Fatal Error! Cannot convert string "5.894 s" > to a double format-number will try to convert the supplied value to a number before formatting it. But it can't convert "5.894 s" to a number because it is already formatted. Note: the " s" in the picture is in fact legal. I'm less sure about the adjacent "," and ".". It's definitely NOT allowed in XSLT 2.0: "A sub-picture must not contain a grouping-separator-sign adjacent to a decimal-separator-sign.". In 1.0, it's defined by reference to the JDK 1.1 specification, and there's no copy of that available online any more. Michael Kay http://www.saxonica.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








