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 308441 - namespaced parameters become unregistered
namespaced parameters become unregistered
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: kbuchcik
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-06-20 21:05 UTC by Oleg Paraschenko
Modified: 2006-07-14 16:25 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Oleg Paraschenko 2005-06-20 21:05:58 UTC
Consider XSLT code with the namespaced parameter "p:param":

[code]
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:p="p:p:p">
	
<xsl:template match="/">
  <x>
    <xsl:apply-templates select="*">
      <xsl:with-param name="p:param" select="'value'"/>
    </xsl:apply-templates>
  </x>
</xsl:template>

<xsl:template match="*">
  <xsl:param name="p:param"/>
  <z p="{$p:param}"/>
</xsl:template>

</xsl:stylesheet>
[/code]

I use xsltproc built from CVS, 20 June:

[screen]
$ ~/p/libxml/bin/xsltproc -V
Using libxml 20619-CVS2464, libxslt 10114-CVS1014 and libexslt 812-CVS1014
xsltproc was compiled against libxml 20619, libxslt 10114 and libexslt 812
libxslt 10114 was compiled against libxml 20619
libexslt 812 was compiled against libxml 20619
[/screen]

It incorrectly issues a warning and generates the following:

[screen]
$ ~/p/libxml/bin/xsltproc test.xsl test.xsl 
runtime error: file test.xsl line 13 element z
unregistered variable param
xmlXPathCompiledEval: evaluation failed
<?xml version="1.0"?>
<x xmlns:p="p:p:p"><z p="runtime error"/></x>
[/screen]

xsltproc 1.0.32 and Saxon produce the correct result:

[screen]
$ xsltproc test.xsl test.xsl 
<?xml version="1.0"?>
<x xmlns:p="p:p:p"><z p="value"/></x>
[/screen]
Comment 1 kbuchcik 2006-04-11 15:39:00 UTC
This is a bug. @name of xsl:param is a QName. In "2.4 Qualified Names" it reads:
"a variable or a parameter (see [11 Variables and Parameters]) is specified as a QName. If it has a prefix, then the prefix is expanded into a URI reference using the namespace declarations in effect on the attribute in which the name occurs."

Does someone know if Libxslt does not support resolution to qualified names (prefixed)? Or is this an edge-case phenomenon? Is this related to the Libxml2/XPath side or Libxslt?
Comment 2 kbuchcik 2006-07-13 11:55:45 UTC
The the namespace name string is missed to be dicted in
the following functions:

xsltWithParamComp() - xsl:with-param
xsltCallTemplateComp() - xsl:call-template
xsltParamComp() - xsl:param

Thus the pointer comparison of namespaces names in
xsltStackLookup() (variables.c) fails to recognize the
parameter.

Since the namespace name coming from the XPath variable
lookup will never be from a dict (it's the ns->href of a
namespace declaration), there will always be some speed
penalty for namespaced vars/params, since this namespace name
is dicted at lookup time.
Comment 3 kbuchcik 2006-07-14 16:25:03 UTC
Fixed in CVS HEAD.

Thanks for the report!