<?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>30032</bug_id>
          
          <creation_ts>2016-12-11 23:11:09 +0000</creation_ts>
          <short_desc>[xslt30] Static type of AXIS::node()</short_desc>
          <delta_ts>2017-01-05 22:10:23 +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>128309</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-12-11 23:11:09 +0000</bug_when>
    <thetext>According to our current rules (§19.1) the static type of the expressions attribute::node() and namespace::node() is U{node()} rather than U{attribute()} or U{namespace-node()}, while the static type of child::node() is U{node()} rather than U{element(), text(), comment(), processing-instruction()}. In addition, typing of an expression such as self::node fails to take the context item type into account.

This can be fixed by changing the rule

If the NodeTest is a KindTest K, then U{K} (for example, U{element()} or U{comment()}). Otherwise (the NodeTest is a NameTest), the U-type corresponding to the principal node kind of the axis, for example U{element()} or U{attribute()}.

to:

The intersection of the UType corresponding to the node kinds that can be reached via the specified axis, and the UType corresponding to the node kinds that can be selected using the specified node test.

The node kinds reachable via a specified axis are as follows, where CIT is the intersection of the context item type with U{N}:

  attribute - if CIT includes U{element()} then U{attribute()} else U{}
  namespace - if CIT includes U{element()} then U{namespace-node()} else U{}
  self - CIT
  child, descendant - if CIT includes U{element()} or U{document-node()} then U{element(), text(), comment(), processing-instruction()} else U{}
  following-sibling,  preceding-sibling, following, or preceding - if CIT is U{document-node()} then U{} else U{element(), text(), comment(), processing-instruction()}
  parent, ancestor - if (CIT is U{document-node()} then U{} else U{element(), document-node()}
  ancestor-or-self - the union of the node kinds reachable using the ancestor axis and those reachable using the self axis
  decendant-or-self - the union of the node kinds reachable using the descendant axis and those reachable using the self axis
   
The node kinds that can be selected using a given node test are:

* If the node-test is node(), then U{N}
* If the node-test is a specific node kind K, then the UType corresponding to K.
* If the NodeTest is a NameTest, then the principal node kind of the specified axis.

====

Examples of where this makes a difference:

* &lt;xsl:value-of select=&quot;self::node()&quot;/&gt; becomes motionless rather than consuming if the context item type is text().

*</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128347</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2017-01-05 22:10:23 +0000</bug_when>
    <thetext>The changes were agreed and have been applied.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>