GNOME Bugzilla – Bug 60143
Templates with pattern "/*" should not match non-document elements
Last modified: 2009-08-15 18:40:50 UTC
Test case: doc.xml --- cut --- <a> a text <b> b text </b> </a> --- cut --- rootstar-bug.xsl --- cut --- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/*"> <xsl:value-of select="." /> </xsl:template> <xsl:template match="/"> <root> <xsl:apply-templates select="a/b" /> </root> </xsl:template> <xsl:template match="*"> </xsl:template> </xsl:stylesheet> --- cut --- Result: $ xsltproc rootstar-bug.xsl doc.xml <?xml version="1.0"?> <root> b text ^^^ a/b is not root element, must not match /* but *, therefore no text node output </root> This bug seems to have appeared after 1.0.0 (this is version 1.0.3), or I would have noticed it. I'm looking at the source[*] of the problem right now, but I figured if you hear about it you will beat me to it :) [*] In libxslt/pattern.c, line 384, should that not be: (node->type == XML_DOCB_DOCUMENT_NODE) ? Also I notice in some other places in the file there is no equivalent check for the XML_DOCB_DOCUMENT_NODE (e.g. line 758). Are these bugs?
Yup, good catch ! That bug annoyed me for some time but I didn't took the time to debug it yet. Thanks a lot ! Concerning the other missing XML_DOCB_DOCUMENT_NODE, yes they are very likely to be bugs, I would appreciate a list if you have time to chase them down :-) thanks again, Daniel
Okay, this should be closed in release 1.0.4, thanks, Daniel