GNOME Bugzilla – Bug 494891
Unexpected XSLT element 'param' if inside an xsl:if block
Last modified: 2007-11-08 10:00:09 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$
Forgot to mention, I also get this error with 1.1.22
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