GNOME Bugzilla – Bug 55722
match priority(?) bug with namespaced attribute wildcard
Last modified: 2009-08-15 18:40:50 UTC
This xsl stylesheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:b="http://b"> <xsl:template match="@b:*"/> <xsl:template match="*"> <xsl:copy> <xsl:apply-templates select="*|@*"/> </xsl:copy> </xsl:template> <xsl:template match="@*"> <xsl:copy/> </xsl:template> </xsl:stylesheet> should strip the attribute b:c out of the following input: <a b:c="d" xmlns:b="http://b"/> But instead it produces: badnsattr$ xsltproc -V test.xsl test.xml Using libxml 20310 and libxslt 1100 <?xml version="1.0"?> <a xmlns:b="http://b" b:c="d"/> Saxon produces: <?xml version="1.0" encoding="utf-8"?> <a xmlns:b="http://b"/> Steve
*** Bug 55724 has been marked as a duplicate of this bug. ***
Okay, I think I fixed it. The template parsing code was wrong and the computation of the priorities were too. This is fixed in CVS: gnome:~/XSLT/tests/general -> xsltproc bug-32-.xsl ../docs/bug-32-.xml <?xml version="1.0"?> <a xmlns:b="http://b"/> gnome:~/XSLT/tests/general -> The namespace attribute shoud probably not be generated in this case, but I don't think it's a serious problem. Daniel
If it's any consolation, Saxon also generates the namespace; I think it's difficult for the processor to know what NSs will be used without recursing down the tree, which is an unnecessary waste of time (I guess you could do some clever reference-counting thing, but...). The work-around is to use <xsl:element name="{name}">, which is the route that led me to noticing that bug. Steve
The fix should be included in 0.12.0, I hope this is closed too, Daniel