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 54951 - XPath node tests handle null namespace wrongly
XPath node tests handle null namespace wrongly
Status: VERIFIED FIXED
Product: libxslt
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2001-05-19 20:04 UTC by stinney
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description stinney 2001-05-19 20:04:36 UTC
The XPath spec (http://www.w3.org/TR/xpath#node-sets) states that a QNAME
with no prefix should not match against the default namespace. But...

<parent xmlns="http://whatever">
  <child/>
</parent>

and

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <xsl:message><xsl:value-of select="count(//child)"/></xsl:message>
</xsl:template>

</xsl:stylesheet>

Produces '1'.  It should produce '0'.

 Steve
Comment 1 Daniel Veillard 2001-05-21 14:13:23 UTC
Okay, I knew about it but never decided to fix it :-)
Patch is actually in xpath.c in libxml

---------------
*** xpath.c	2001/05/21 08:15:31	1.114
--- xpath.c	2001/05/21 13:56:12
*************** xmlXPathNodeCollectAndTest(xmlXPathParse
*** 7348,7355 ****
  		        case XML_ELEMENT_NODE:
  			    if (xmlStrEqual(name, cur->name)) {
  				if (prefix == NULL) {
! 				    if ((cur->ns == NULL) ||
! 					(cur->ns->prefix == NULL)) {
  #ifdef DEBUG_STEP
  					n++;
  #endif
--- 7348,7354 ----
  		        case XML_ELEMENT_NODE:
  			    if (xmlStrEqual(name, cur->name)) {
  				if (prefix == NULL) {
! 				    if (cur->ns == NULL) {
  #ifdef DEBUG_STEP
  					n++;
  #endif
---------------

  thanks for the heads-up !

Daniel
Comment 2 Daniel Veillard 2001-06-06 09:27:17 UTC
This was released in 2.3.10, I assume this is closed.

Daniel