<?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>30033</bug_id>
          
          <creation_ts>2016-12-15 12:58:46 +0000</creation_ts>
          <short_desc>[xslt30] Streamability rules for fn:current() lack an &quot;otherwise&quot; clause</short_desc>
          <delta_ts>2017-01-05 22:10:48 +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>Candidate 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>
          
          
          <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>128323</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-12-15 12:58:46 +0000</bug_when>
    <thetext>In section 19.8.9.3, Streamability of the current() function, there&apos;s no statement as to what the outcome is if none of the conditions in rules 1, 2, or 3 apply.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128324</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-12-15 14:43:06 +0000</bug_when>
    <thetext>Note also that rule (1) talks of the outermost containing XPath expression, which doesn&apos;t really allow for use of current() within a pattern.

Test case stream-200 (in test set source-document) uses the following within a streamable accumulator:

match=&quot;part-name/text()[$selected-parts = current()]&quot;

To establish that this is streamable, we need to establish that the static type of current() is a text node. There is nothing in the static typing rules to achieve this. We can make it guaranteed-streamable by writing it as

match=&quot;part-name/text()[$selected-parts = current() treat as text()]&quot;

but this seems a little unfortunate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128326</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-12-16 10:44:17 +0000</bug_when>
    <thetext>Proposed resolution:

Explanations in &quot;[]&quot;, which may become notes in the spec if appropriate.

(1) Add special rules for the static type of a call to current():

(a) if the call is within an XPath expression, the *context item type* that applies to the outermost containing XPath expression, determined by the rules in 19.2.

(b) if the call is within a pattern, the *match type* of the pattern, as defined in 19.2. [Note: a call to current() in a pattern will always be within a predicate, which means that the match type of the pattern will never depend on the static type of the call to current(), so there is no circularity in this definition].

In 19.8.9.3, Streamability of fn:current(), change the rules to (§§ marks changes):

The sweep and posture of a call to the current function are determined as follows:

§§1. If the call appears within a pattern [Note: it will always be within a predicate of the pattern], then climbing and motionless.

2. Otherwise, let E be the outermost containing XPath expression of the call to the current function.

2(a) If the context posture of E is grounded, then motionless and grounded.

2(b) If the path in the expression tree that connects the call on current to E (excluding E itself) contains an expression that is a higher-order operand of its parent expression, then climbing and motionless.

§§2(c) Otherwise, the posture is the context posture, and the sweep is motionless.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128348</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2017-01-05 22:10:48 +0000</bug_when>
    <thetext>The changes were agreed and have been applied.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>