xsl-list
[Top] [All Lists]

RE: [xsl] format % issue

2008-03-27 02:06:54
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 >

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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