GNOME Bugzilla – Bug 310692
xmlIsID fails to recognize namespaced ID attributes
Last modified: 2009-08-15 18:40:50 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.
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.
Nice one ! Patch applied and commited, I also added the test to libxslt regression suite , thanks a lot ! Daniel
This should be closed by release of libxml2-2.6.21, thanks, Daniel