GNOME Bugzilla – Bug 53304
Problem selecting attributes with a namespace
Last modified: 2009-08-15 18:40:50 UTC
I'm having a problem when selecting an attribute using LibXSLT 0.7.0. I have included an XML file, XSL file, and the output: test.xml: <?xml version="1.0"?> <aaa bbb:ddd="ccc" eee="fff"/> ==================================================== test.xsl <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="aaa"> <xsl:value-of select="@bbb:ddd"/> <xsl:value-of select="@eee"/> </xsl:template> </xsl:stylesheet> ==================================================== output: <?xml version="1.0"?> fff
The test case provided is wrong. The namespace prefix bbb is not defined in both the stylesheet and the document. Contrary to common belief, namespace matching is not done with the prefixes but with the URI references associated to them. The CVS version fixes the namespaces problems, on the given input it produces the following result: orchis:~/XSLT/tests/general -> xsltproc bug-7-.xsl ../docs/bug-7-.xml Error xpath.c:6567: Undefined namespace prefix xmlXPathEval: evaluation failed xsltDefaultProcessOneNode: text copy failed <?xml version="1.0"?> fff orchis:~/XSLT/tests/general -> when both the document and the stylesheet were fixed by adding xmlns:bbb="test:7" to their root nodes, the CVs version generates the expected output orchis:~/XSLT/tests/general -> xsltproc bug-7-.xsl ../docs/bug-7-.xml <?xml version="1.0"?> cccfff orchis:~/XSLT/tests/general -> So I consider this fixed, it will be in the next release, Daniel