Subject: Re: [xsl] questions on "number('+5')" From: Michael Kay <mike@xxxxxxxxxxxx> Date: Mon, 30 Aug 2010 18:43:35 +0100 |
So "number('+5')" should result in NaN.
Here is the result of "number('+5')" for different XSLT processors: Chrome NaN DataPower NaN Firefox NaN IE NaN Opera 5 Safari NaN saxon 5 xalan 5 xsltproc NaN
They are non-compliant with XSLT 1.0, yes.
Two questions: 1) Is it true that XSLT processors returning 5 are non-compliant?
2) Is the following a good workaround?It depends a bit on the syntax you want to accept and the error checking you want to perform. For many purposes, number(translate($str, '+','')) would work adequately.
<xsl:variable name="str" select="'+5'"/> <xsl:value-of select="number(substring($str,1+starts-with($node,'+')))"/>
Michael Kay Saxonica
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] questions on "number('+5', Hermann Stamm-Wilbra | Thread | Re: [xsl] questions on "number('+5', Hermann Stamm-Wilbra |
[xsl] Error XSLT 1.0 (xsltproc), pankaj . c | Date | Re: [xsl] questions on "number('+5', Hermann Stamm-Wilbra |
Month |