[xslt] xsl:with-param and xsl:variable
- From: "Richard Jinks" <cyberthymia yahoo co uk>
- To: <xslt gnome org>
- Subject: [xslt] xsl:with-param and xsl:variable
- Date: Wed, 12 Jun 2002 12:15:30 +0100
Hi
This question might be better suited to xsl-list than here, but I'll try
this list first as xsltproc behaves differently to other XSLT processors.
One of the test cases I'm using is stylesheet 2 on
http://www.zvon.org/xxl/XSLTutorial/Output/example35_ch9.html
This example calls a template which contains a variable with the same name
as a parameter passed in with xsl:with-param, i.e.
<xsl:template match="/">
...
<xsl:apply-templates select=".">
<xsl:with-param name="type">odd</xsl:with-param>
</xsl:apply-templates>
...
</xsl:template>
<xsl:template match="number">
<xsl:variable name="type">even</xsl:variable>
...
</xsl:template>
When running the example on the web page through Saxon and MSXSL4, you get
the expected results, i.e.
<?xml version="1.0" encoding="utf-8"?><TABLE><TR><TH>1
(even)</TH></TR><TR><TH>3 (even)</TH></TR><TR><TH>4
(even)</TH></TR><TR><TH>17 (even)</TH></TR><TR><TH>8
(even)</TH></TR></TABLE>
With xsltproc though (libxslt-1.0.18), you get
C:\libxml\libxslt-1.0.18.win32\util>xsltproc 153.xsl 153.xml
xsltproc 153.xsl 153.xml
<?xml version="1.0"?>
<TABLE><TR><TH>1 (odd)</TH></TR><TR><TH>3 (odd)</TH></TR><TR><TH>4
(even)</TH></TR><TR><TH>17 (odd)</TH></TR><TR><TH>8 (even)</TH></TR></TABLE>
runtime error: file 153.xsl line 23 element variable
xsl:variable : redefining type
runtime error: file 153.xsl line 23 element variable
xsl:variable : redefining type
runtime error: file 153.xsl line 23 element variable
xsl:variable : redefining type
Here, apart from the runtime errors, the results show (odd) against some of
the values instead of (even).
Now, I've tried to make sense of the XSLT spec, but I can't find anything to
suggest that using xsl:with-param with xsl:variable in this way is right or
wrong. The only arguments I have that this might be a bug is that the zvon
example doesn't say that it is illegal (and even shows the results from the
stylesheet), and that xsltproc comes back with the wrong results before
generating runtime errors.
I've had a look at the libxslt code, and I haven't been able to work out how
xsl:with-param works in a sufficient manner to identify any problems or to
propose a fix.
Is there a bug here, or is this one of the grey areas in the XSLT spec?
Is it worth me putting a copy of this problem into Bugzilla?
Thanks,
Richard
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]