[xslt] scope of global param, version 1.1.15 of libxslt (libxml 2.6.21)
- From: Stephane Mottelet <stephane mottelet utc fr>
- To: The Gnome XSLT library mailing-list <xslt gnome org>
- Subject: [xslt] scope of global param, version 1.1.15 of libxslt (libxml 2.6.21)
- Date: Wed, 07 Sep 2005 18:57:39 +0200
Stephane Mottelet wrote:
Ok I upgraded to 1.1.15, and now I have new xsl bugs. I have
an xsl stylesheet with a global parameter
<xsl:param name="lang"/>
which is fed by a --stringparam lang french in the
xsltproc options
The param is correctly seen there :
<xsl:template match="/">
<xsl:message><xsl:value-of select="$lang"/></xsl:message>
<xsl:apply-templates/>
but not here any more (was ok in 1.1.7) :
<xsl:template match="title[(@lang=$lang) or not(@lang)]">
<comment>
<xsl:value-of select="."/>
</comment>
</xsl:template>
XPath error : Undefined variable
(@lang=$lang) or not(@lang)
^
compilation error: file /home/mottelet/XMLlab//xsl/simulation.xsl line
211 element template
Failed to compile predicate
Did something change in the scope of global parameters ?
S.
Ok, for this scope problem, here is all the files to produce the problem
Stylesheet (simulation.xsl) : -----------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="lang"/>
<xsl:output method="xml" indent="no" encoding="ISO-8859-1"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="simulation">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="title[(@lang=$lang) or not(@lang)]" mode="script">
<comment>
<xsl:value-of select="."/>
</comment>
</xsl:template>
</xsl:stylesheet>
File to process (interp.xml) : ----------------
?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE simulation PUBLIC "-//UTC//DTD XMLlab V1.4//FR"
"http://www.xmllab.org/dtd/1.4/simulation.dtd">
<simulation>
<title lang="french">Points à interpoler</title>
</simulation>
Command line : -----------------------------
> xsltproc --stringparam lang french simulation.xsl interp.xml
XPath error : Undefined variable
(@lang=$lang) or not(@lang)
^
compilation error: file simulation.xsl line 16 element template
Failed to compile predicate
Seems there is really a problem ?
S.
--
e-mail : Stephane Mottelet utc fr
www : http://www.dma.utc.fr/~mottelet
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]