<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>30375</bug_id>
          
          <creation_ts>2018-12-14 23:00:06 +0000</creation_ts>
          <short_desc>[XSLT30] Default priority for match=&quot;Q{xyz}*</short_desc>
          <delta_ts>2019-02-20 00:36:14 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XSLT 3.0</component>
          <version>Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Kay">mike</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          <cc>abel.online</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>129446</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2018-12-14 23:00:06 +0000</bug_when>
    <thetext>The syntax for patterns allows a NameTest, and one permitted form of a NameTest is &quot;BracedURILiteral *&quot;, for example match=&quot;Q{http://www.w3.org/x}*&quot;.

The construct is particularly useful because it allows match=&quot;Q{}*&quot;, which matches elements in no namespace; there is no other convenient way of expressing this test.

The rules for default priority of patterns in section §6.5 do not handle this case explicitly. A literal reading of the rules means that it takes the &quot;all other cases&quot; rule 11, with a priority of +0.5. However, a much more reasonable interpretation would be that Q{uri}* is equivalent to p:*, which comes under rule 9, and gives a default priority of -0.25.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129447</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2018-12-14 23:24:09 +0000</bug_when>
    <thetext>I am committing test case match-261, with an expected result that assumes a default priority of -0.25 for this case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129449</commentid>
    <comment_count>2</comment_count>
    <who name="Abel Braaksma">abel.online</who>
    <bug_when>2018-12-17 04:28:52 +0000</bug_when>
    <thetext>(In reply to Michael Kay from comment #0)
&gt; A literal reading of the rules means that it takes the &quot;all other cases&quot; 
&gt; rule 11, with a priority of +0.5
Actually, I don&apos;t think so. I think it matches Rule 10, &quot;any other NodeTest&quot;, for which the production rules include the &quot;BracedURILiteral *&quot;. This would yield a default priority of -0.5.

&gt; However, a much more reasonable interpretation would be that Q{uri}* is 
&gt; equivalent to p:*, which comes under rule 9, and gives a default priority of 
&gt; -0.25.
I agree, and I think we should treat this as a clarification of the text, if possible, since anything else than -0.25 as explained in point 7 (which I read as the &apos;half wildcard&apos; rule) seems odd.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129483</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2019-01-17 10:44:08 +0000</bug_when>
    <thetext>There is a further complication here.

Consider the case match=&quot;element(*:local)&quot;

Rule 7 says it applies &quot;If the pattern is a PathExprP taking the form of an ElementTestXP30 or AttributeTestXP30, optionally preceded by a ForwardAxisP&quot;, but it does not cover this case. The entry for element(E) does not apply, because E &quot;represents an arbitrary element name&quot;, and not a wildcard.

It seems intuitive that this should come under rule 9, and get a priority of -0.25.

But then what about element(*:local, xs:integer)? This doesn&apos;t seem to be covered at all.

Note that this problem applies equally to XSLT 2.0.

Recommendation: if W is a wildcard then:

(1) element(X) and attribute(X) are always treated the same as X and @X, so if X is a &quot;partial wildcard&quot; (A:* or *:A) then it has priority -0.25

(2) if X is a partial wildcard then element(X, T) and attribute(X, T) are treated the same as element(*, T) and attribute(*, T), getting a priority of 0. (In principle, element(X, T) is more specific than element(*, T) and less specific than element(E, T), but we really don&apos;t want to introduce another priority level between 0 and 0.25).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129484</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2019-01-17 10:53:07 +0000</bug_when>
    <thetext>Forget comment (3). Partial wildcards are not allowed in an ElementTest or AttributeTest; the syntax element(*:X) or element(X:*) is not allowed.

Silly me for expecting orthogonality.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129539</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2019-02-20 00:36:14 +0000</bug_when>
    <thetext>Covered by draft erratum E37, see https://htmlpreview.github.io/?https://github.com/w3c/qtspecs/blob/master/errata/xslt-30/html/xslt-30-errata.html#E37</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>