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 557684 - libxslt fails when using "*" for namespace in XPath expression - whereas Saxon handles it correctly
libxslt fails when using "*" for namespace in XPath expression - whereas Saxo...
Status: RESOLVED NOTABUG
Product: libxslt
Classification: Platform
Component: general
1.1.22
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2008-10-24 00:44 UTC by François Granade
Modified: 2008-11-03 00:32 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description François Granade 2008-10-24 00:44:51 UTC
Please describe the problem:
libxml2/libxsl doesn't seem to accept a star "*" for a namespace in an XPath expression.

Saxon ( http://saxon.sourceforge.net/ ) handles it correctly.

Knowing that Saxon claims to be an "complete and conformant implementation of the XPath 2.0 recommendation", I would suppose that it's a bug in libxslt.

(to be honest, I haven't tried with the latest Saxon however; the one I'm using is 8.51).



Steps to reproduce:
Running the XPath expression '/*:root/text()' causes an error when ran with 
'<root xmlns="http://my.domain.org/mynamespace">ok</root>'
and with
'<root>ok</root>'
I'm running from Python and I get:

Traceback (most recent call last):
  • File "<stdin>", line 1 in ?
  • File "/usr/lib/python2.4/site-packages/libxml2.py", line 436 in xpathEval
    res = ctxt.xpathEval(expr)
  • File "/usr/lib/python2.4/site-packages/libxml2.py", line 6915 in xpathEval
    if ret is None:raise xpathError('xmlXPathEval() failed')
libxml2.xpathError: xmlXPathEval() failed


Saxon returns 'ok' for both expression.

Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Daniel Veillard 2008-10-24 09:53:58 UTC
http://www.w3.org/TR/xpath#NT-NameTest

[37]   	NameTest	   ::=   	'*'	
			| NCName ':' '*'	
			| QName

can you show me how you can generate *:root from that production ?
XPath1 definitely doesn't allows this, maybe XPath2 does, but libxml2
does not implement XPath2
And clearly the intents of the XPath authors was to allow wildards on
namespaces, so if this has been added in XPath2 that's a violation of 
the original authors of XPaths, and if it was not added in XPath2 that's
a Saxon bug.
In any case it's clearly forbidden in XPath 1.0 so it's not a bug from
a libxml2/libxslt perspective.

Daniel
Comment 2 François Granade 2008-11-03 00:32:45 UTC
Yes, my mistake, this is XPath 2.0 only, see http://www.w3.org/TR/xpath20/#doc-xpath-Wildcard

It was so obvious to me that XPath 2.0 was supported, that I didn't check.

Coming from the Java world it was kind of expected.