<?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>29655</bug_id>
          
          <creation_ts>2016-05-20 20:55:33 +0000</creation_ts>
          <short_desc>[XP31] Ambiguous parse for /[x]</short_desc>
          <delta_ts>2016-05-23 11:59:28 +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>XPath 3.1</component>
          <version>Candidate Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</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="Jonathan Robie">jonathan.robie</assigned_to>
          <cc>jmdyck</cc>
    
    <cc>josh.spiegel</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>126471</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-05-20 20:55:33 +0000</bug_when>
    <thetext>In XPath 3.0, the expression /[x] parsed unambiguously, and selected the root node provided it had a child element named x.

In XPath 3.1, the expression becomes ambiguous, and the leading-lone-slash rule says it should be parsed as a path expression in which the rhs is an array constructor. This is both incompatible with the XPath 3.0 interpretation, and comparatively useless.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126472</commentid>
    <comment_count>1</comment_count>
    <who name="Josh Spiegel">josh.spiegel</who>
    <bug_when>2016-05-20 22:37:30 +0000</bug_when>
    <thetext>I don&apos;t see how /[x] is valid in 3.0

PathExpr
=&gt;
&quot;/&quot; RelativePathExpr
=&gt;
&quot;/&quot; StepExpr
=&gt;
&quot;/&quot; PostFixExpr
=&gt;
&quot;/&quot; PrimaryExpr Predicate

It seems like [x] would need to be a PrimaryExpr but I don&apos;t think it is.

The 3.0 w3c applets don&apos;t parse this and neither does my parser.  If I am missing something, could you show me the parse tree for this expression in 3.0?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126473</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2016-05-21 13:48:06 +0000</bug_when>
    <thetext>(In reply to Michael Kay from comment #0)
&gt; In XPath 3.0, the expression /[x] parsed unambiguously, and selected the
&gt; root node provided it had a child element named x.

I agree with Josh, I don&apos;t think that&apos;s ever been the case. In order to parse [x] as a Predicate, it would have to be preceded by a ReverseStep, a ForwardStep, or a PrimaryExpr, but none of those derive /, a PathExpr.

To get the semantics you describe, you&apos;d have to write (/)[x].</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126481</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-05-23 11:59:28 +0000</bug_when>
    <thetext>Closed as invalid. I was misdiagnosing the root cause of a problem reported by a user.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>