[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] format % issue
Subject: RE: [xsl] format % issue From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Thu, 27 Mar 2008 09:06:07 -0000 |
> What is the workaround to just print the % number ? > > Fatal Error! Required item type of first argument of > format-number() is numeric; supplied value has item type xs:string The message looks pretty clear to me: $value is a string, when it should be a number. So convert it to a number, using the number() function. Better still, declare the parameter as <xsl:param name="value" as="xs:double"/> and make sure that $successPercent is computed as a number, not as a string. Michael Kay http://www.saxonica.com/ > > > <xsl:template name="display-percent"> > <xsl:param name="value" /> > < xsl:value-of select="format-number($value,'0.00%')" /> > </xsl:template> > > > <xsl:if test="$testcase=1"> > <xsl:call-template name="display-percent"> > <xsl:with-param name="value" select="$successPercent" /> > </xsl:call-template> > </xsl:if> > <xsl:if test="$testcase=3"> > <xsl:call-template name="display-percent"> > <xsl:with-param name="value" select="$successPercent" /> > </xsl:call-template> > </xsl:if >
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] format % issue, Z W | Thread | [xsl] How to store value in a varia, Z W |
RE: [xsl] How to store value in a v, Michael Kay | Date | Re: [xsl] for-each issue, Z W |
Month |