After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 131705 - wrong pattern priority for //tag expression
wrong pattern priority for //tag expression
Status: VERIFIED FIXED
Product: libxslt
Classification: Platform
Component: general
1.0.33
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2004-01-16 16:32 UTC by Frederic Laurent
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: 2.3/2.4



Description Frederic Laurent 2004-01-16 16:32:41 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
Comment 1 William M. Brack 2004-01-21 08:54:57 UTC
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
Comment 2 William M. Brack 2004-01-23 10:56:56 UTC
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.
Comment 3 Daniel Veillard 2004-03-25 11:39:05 UTC
This should be closed by release of libxslt-1.1.5,
                                                                                
  thanks,
                                                                                
Daniel