GNOME Bugzilla – Bug 131705
wrong pattern priority for //tag expression
Last modified: 2009-08-15 18:40:50 UTC
Consider the following stylesheet <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="chapter/para"> </xsl:template> <xsl:template match="//para"> </xsl:template> </xsl:stylesheet> The xslt processor computes the priority of each template like this xsltCompilePattern : parsed chapter/para, default priority 0.500000 added pattern : 'chapter/para' priority 0.500000 xsltCompilePattern : parsing '//para' xsltCompilePattern : parsed //para, default priority 0.000000 added pattern : '//para' priority 0.000000 But the priority of the //para is wrong. It should be 0.5 instead of 0.0 Fred
You may be correct in your assertion, but it is not obvious to me. I assume you are stating your interpretation of Paragraph 5.5 of the XSLT recommendation. I think we can agree that the 0.5 priority assigned to <xsl:template match="chapter/para"/> is correct. I hope we can also agree that <xsl:template match="para"/> would have a priority of 0.0? If so, why do you believe that <xsl:template match="//para"/> should have a higher priority? Bill
I note that para 5.5 requires that, in order for the priority to be 0.0, it may only be preceded by a ChildOrAttributeAxisSpecifier. Apparently '//' does not meet that requirement, so by default it should be set to 0.5 as you suggested. I have modified the applicable code (libxslt/pattern.c); the modified code is in CVS. Thanks for your report.
This should be closed by release of libxslt-1.1.5, thanks, Daniel