You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Vadim Gritsenko <va...@verizon.net> on 2002/07/13 17:28:04 UTC
Found bug in XSLTC
Hi all,
Found a bug in XSLTC, version from
http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-cocoon2/lib/core/xsltc.
jar?rev=HEAD&content-type=text/plain.
Here is XSLT reproducing the bug:
----------8<----------
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="var">
<xsl:if test="1 = 1">2</xsl:if>
</xsl:param>
<xsl:param name="var2" select="string($var)"/>
<xsl:template match="/">
Value of var: <xsl:value-of select="$var"/>
var is greater then 3: <xsl:value-of select="$var > 3"/>
var is less then 3: <xsl:value-of select="$var < 3"/>
Value of var2: <xsl:value-of select="$var2"/>
var2 is greater then 3: <xsl:value-of select="$var2 > 3"/>
var2 is less then 3: <xsl:value-of select="$var2 < 3"/>
</xsl:template>
</xsl:stylesheet>
----------8<----------
Output:
----------8<----------
Value of var: 2
var is greater then 3: false
var is less then 3: false
Value of var2: 2
var2 is greater then 3: false
var2 is less then 3: true
----------8<----------
All other XSLT processors (Xalan, SAXON) produce output:
----------8<----------
Value of var: 2
var is greater then 3: false
var is less then 3: true
Value of var2: 2
var2 is greater then 3: false
var2 is less then 3: true
----------8<----------
Regards,
Vadim
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
RE: Found bug in XSLTC
Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Koen Pellegrims [mailto:koen.pellegrims@pandora.be]
>
> I think this bug might be due to lazy type converions in XSLTC.
> Have you tried passing the numbers into the numbers()-function
> before the comparison, i.e.: <xsl:value-of select="number($var)
> < number(3)"/> ?
I know work-around, see:
> > <xsl:param name="var2" select="string($var)"/>
I report this so XSLTC team can improve compiler.
Vadim
> The assignment through the if-construct makes $var into a result-set;
I'm
> not sure if XSLTC handles the type-conversions very well...
>
> K.
>
> > -----Oorspronkelijk bericht-----
> > Van: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
> > Verzonden: zaterdag 13 juli 2002 17:28
> > Aan: xalan-dev@xml.apache.org; Tom.Amiro@Sun.COM;
Glenn.Miller@Sun.COM
> > CC: morten@xml.apache.org; jacek_ambroziak@yahoo.com;
> > cocoon-dev@xml.apache.org; 'Ivelin Ivanov'
> > Onderwerp: Found bug in XSLTC
> >
> >
> > Hi all,
> >
> > Found a bug in XSLTC, version from
> >
http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-cocoon2/lib/core/xsltc.
> > jar?rev=HEAD&content-type=text/plain.
> >
> > Here is XSLT reproducing the bug:
> > ----------8<----------
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> > <xsl:param name="var">
> > <xsl:if test="1 = 1">2</xsl:if>
> > </xsl:param>
> >
> > <xsl:param name="var2" select="string($var)"/>
> >
> > <xsl:template match="/">
> > Value of var: <xsl:value-of select="$var"/>
> > var is greater then 3: <xsl:value-of select="$var > 3"/>
> > var is less then 3: <xsl:value-of select="$var < 3"/>
> >
> > Value of var2: <xsl:value-of select="$var2"/>
> > var2 is greater then 3: <xsl:value-of select="$var2 > 3"/>
> > var2 is less then 3: <xsl:value-of select="$var2 < 3"/>
> > </xsl:template>
> > </xsl:stylesheet>
> > ----------8<----------
> >
> >
> > Output:
> > ----------8<----------
> > Value of var: 2
> > var is greater then 3: false
> > var is less then 3: false
> >
> > Value of var2: 2
> > var2 is greater then 3: false
> > var2 is less then 3: true
> > ----------8<----------
> >
> > All other XSLT processors (Xalan, SAXON) produce output:
> > ----------8<----------
> > Value of var: 2
> > var is greater then 3: false
> > var is less then 3: true
> >
> > Value of var2: 2
> > var2 is greater then 3: false
> > var2 is less then 3: true
> > ----------8<----------
> >
> >
> > Regards,
> > Vadim
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
RE: Found bug in XSLTC
Posted by Koen Pellegrims <ko...@pandora.be>.
I think this bug might be due to lazy type converions in XSLTC. Have you
tried passing the numbers into the numbers()-function before the comparison,
i.e.: <xsl:value-of select="number($var) < number(3)"/> ?
The assignment through the if-construct makes $var into a result-set; I'm
not sure if XSLTC handles the type-conversions very well...
K.
> -----Oorspronkelijk bericht-----
> Van: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
> Verzonden: zaterdag 13 juli 2002 17:28
> Aan: xalan-dev@xml.apache.org; Tom.Amiro@Sun.COM; Glenn.Miller@Sun.COM
> CC: morten@xml.apache.org; jacek_ambroziak@yahoo.com;
> cocoon-dev@xml.apache.org; 'Ivelin Ivanov'
> Onderwerp: Found bug in XSLTC
>
>
> Hi all,
>
> Found a bug in XSLTC, version from
> http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-cocoon2/lib/core/xsltc.
> jar?rev=HEAD&content-type=text/plain.
>
> Here is XSLT reproducing the bug:
> ----------8<----------
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:param name="var">
> <xsl:if test="1 = 1">2</xsl:if>
> </xsl:param>
>
> <xsl:param name="var2" select="string($var)"/>
>
> <xsl:template match="/">
> Value of var: <xsl:value-of select="$var"/>
> var is greater then 3: <xsl:value-of select="$var > 3"/>
> var is less then 3: <xsl:value-of select="$var < 3"/>
>
> Value of var2: <xsl:value-of select="$var2"/>
> var2 is greater then 3: <xsl:value-of select="$var2 > 3"/>
> var2 is less then 3: <xsl:value-of select="$var2 < 3"/>
> </xsl:template>
> </xsl:stylesheet>
> ----------8<----------
>
>
> Output:
> ----------8<----------
> Value of var: 2
> var is greater then 3: false
> var is less then 3: false
>
> Value of var2: 2
> var2 is greater then 3: false
> var2 is less then 3: true
> ----------8<----------
>
> All other XSLT processors (Xalan, SAXON) produce output:
> ----------8<----------
> Value of var: 2
> var is greater then 3: false
> var is less then 3: true
>
> Value of var2: 2
> var2 is greater then 3: false
> var2 is less then 3: true
> ----------8<----------
>
>
> Regards,
> Vadim
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org