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 59946 - Namespace empty string broken in XSLT
Namespace empty string broken in XSLT
Status: VERIFIED FIXED
Product: libxslt
Classification: Platform
Component: general
unspecified
Other Windows
: Normal normal
: ---
Assigned To: Daniel Veillard
Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2001-09-03 14:00 UTC by msergeant
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description msergeant 2001-09-03 14:00:22 UTC
If in my XML I set the current namespace to the empty string:

<foo xmlns="http://frob.com/">
  <bar xmlns=""/>
</foo>

Such that bar is "not considered to be in any namespace", then I cannot
match that with XPath in my XSLT. i.e.:

<xsl:template match="bar">
Bar!
</xsl:template>

Will never succeed. The only way I can match that element is with
*[local-name() = 'bar'].
Comment 1 Daniel Veillard 2001-09-10 18:26:19 UTC
  Hi Matt,

(BTW your matt@sergeant.org email was bouncing and
I had to suspend sending mail from the xml and xslt@gnome.org
list, just reactivate them)

Okay, found, the problem is actaully in libxml/SAX.c

http://cvs.gnome.org/bonsai/cvsquery.cgi?module=gnome-xml&branch=HEAD&branchtype=match&dir=gnome-xml&file=&filetype=match&who=veillard&whotype=match&sortby=Date&hours=&date=explicit&mindate=09%2F10%2F01+14%3A13&maxdate=09%2F10%2F01+14%3A15&cvsroot=%2Fcvs%2Fgnome

------------------------------
diff -c -r1.75 SAX.c
*** SAX.c       2001/09/10 14:40:42     1.75
--- SAX.c       2001/09/10 18:02:57
***************
*** 1134,1140 ****
            ctxt->sax->warning(ctxt->userData,
                 "Namespace prefix %s is not defined\n", prefix);
      }
!     xmlSetNs(ret, ns);

      /*
       * process all the other attributes
--- 1134,1146 ----
            ctxt->sax->warning(ctxt->userData,
                 "Namespace prefix %s is not defined\n", prefix);
      }
! 
!     /*
!      * set the namespace node, making sure that if the default namspace
!      * is unbound on a parent we simply kee it NULL
!      */
!     if ((ns != NULL) && (ns->href[0] != 0))
!       xmlSetNs(ret, ns);

      /*
       * process all the other attributes
------------------------------

  this seems to cure it:

orchis:~/XSLT/tests/tmp -> cat foo.xml 
<foo xmlns="http://frob.com/">
   <bar xmlns=""/>
</foo>
orchis:~/XSLT/tests/tmp -> cat bar.xsl 
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="bar">
Bar!
</xsl:template>

</xsl:stylesheet>

orchis:~/XSLT/tests/tmp -> xsltproc bar.xsl foo.xml 
<?xml version="1.0"?>

   
Bar!


orchis:~/XSLT/tests/tmp -> 

  thanks for the report !

Daniel
Comment 2 Daniel Veillard 2001-09-15 17:42:57 UTC
This should be closed by release 1.0.4,

 thanks,

Daniel