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 310692 - xmlIsID fails to recognize namespaced ID attributes
xmlIsID fails to recognize namespaced ID attributes
Status: VERIFIED FIXED
Product: libxml2
Classification: Platform
Component: general
2.6.16
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-07-18 01:56 UTC by Derek Poon
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix for xmlIsID() (2.07 KB, patch)
2005-07-18 02:00 UTC, Derek Poon
none Details | Review

Description Derek Poon 2005-07-18 01:56:42 UTC
Version details: Bug still exists in 2.6.20

libxml2 doesn't properly handle attributes as being of type ID if the attribute
has a namespace.  In other words,
    <!ATTLIST some-element myns:id ID #IMPLIED>
does not cause any indexing to occur.  The bug is in the xmlIsID() function in
valid.c, which discards the namespace prefix before checking whether the
attribute is of type ID.

Simple test case:

doc.xml:
<?xml version="1.0"?>
<!DOCTYPE my-root [
    <!ATTLIST my-root myns:id ID #IMPLIED>
]>
<my-root xmlns:myns="uri" myns:id="indexme" some-attr="findme"/>

transform.xsl:
<?xml version="1.0"?>
<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">
    <template match="/">
        <value-of select="id('indexme')/@some-attr"/>
    </template>
</stylesheet>

Running
  xsltproc transform.xsl doc.xml
should print "findme", but it outputs an empty result.
Comment 1 Derek Poon 2005-07-18 02:00:48 UTC
Created attachment 49338 [details] [review]
Fix for xmlIsID()

Consider the full attribute name (with namespace prefix) when determining
whether an attribute is of type ID.
Comment 2 Daniel Veillard 2005-08-12 10:19:50 UTC
Nice one !
Patch applied and commited, I also added the test to libxslt regression
suite ,

  thanks a lot !

Daniel
Comment 3 Daniel Veillard 2005-09-05 08:59:17 UTC
This should be closed by release of libxml2-2.6.21,

  thanks,

Daniel