After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 494891 - Unexpected XSLT element 'param' if inside an xsl:if block
Unexpected XSLT element 'param' if inside an xsl:if block
Status: RESOLVED NOTABUG
Product: libxslt
Classification: Platform
Component: general
1.1.21
Other Linux
: Normal critical
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2007-11-08 08:35 UTC by Ori Hoch
Modified: 2007-11-08 10:00 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ori Hoch 2007-11-08 08:35:16 UTC
This works on version 1.1.17, but on 1.1.21 I get this error. It seems to happen when the xsl:param is inside an xsl:if block.

$ cat test.xml
<?xml version="1.0" encoding="UTF-8"?>
<root></root>

$ cat test.xsl
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:param name="xxx" select="'Hello'"/>
    <xsl:param name="fffvv" select="''"/>
    <xsl:template match="root"><xsl:param name="fffvv"/>
        <xsl:if test="$xxx='Hello'">
            <xsl:param name="fffvv">goodbye</xsl:param>
        </xsl:if>
    </xsl:template>
</xsl:stylesheet>

$ xsltproc test.xsl test.xml
runtime error: file test.xsl line 6 element param
Unexpected XSLT element 'param'.
no result for test.xml
ori@ori-desktop:/media/sda4/ori/eclipse-workspace/uumpaframework/tests/misc$
Comment 1 Ori Hoch 2007-11-08 08:38:01 UTC
Forgot to mention, I also get this error with 1.1.22
Comment 2 Daniel Veillard 2007-11-08 10:00:09 UTC
     http://www.w3.org/TR/xslt#local-variables
---------------------------------------------------------------------
11.5 Variables and Parameters within Templates

As well as being allowed at the top-level, both xsl:variable and xsl:param are also allowed in templates. xsl:variable is allowed anywhere within a template that an instruction is allowed. In this case, the binding is visible for all following siblings and their descendants. Note that the binding is not visible for the xsl:variable element itself. xsl:param is allowed as a child at the beginning of an xsl:template element. In this context, the binding is visible for all following siblings and their descendants. Note that the binding is not visible for the xsl:param element itself.
----------------------------------------------------------------------

  Param is only allowed as child of template or as a top level
declaration. libxslt used to not catch this error, it does now,
you need to fix your stylesheet, this is not a bug in recent version
it was a bug in the old ones and fixed now.

Daniel