<?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>30242</bug_id>
          
          <creation_ts>2018-04-02 00:13:18 +0000</creation_ts>
          <short_desc>[XSLT30] (probably editorial, or nothing) xsl:apply-templates section, error XTTE0510 and other type errors</short_desc>
          <delta_ts>2018-04-02 10:18:26 +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>Windows NT</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>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Abel Braaksma">abel.online</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>129130</commentid>
    <comment_count>0</comment_count>
    <who name="Abel Braaksma">abel.online</who>
    <bug_when>2018-04-02 00:13:18 +0000</bug_when>
    <thetext>I noticed a few things while going over section 6.3 on Applying Template Rules, which discusses xsl:apply-templates.

Most of this text is word-for-word equal to the XSLT 2.0 version. Except that we removed the requirement that the select-expression must select nodes.

This is correct, of course, but then we define one error condition:

&quot;[ERR XTTE0510] It is a type error if an xsl:apply-templates instruction with no select attribute is evaluated when the context item is not a node. &quot;

Which left me wondering: what happens if you do select=&quot;foo/bar&quot; but the input sequence is not a node? My guess is that it should raise XPTY0020. Should we mention that? it is a bit strange that an *implicit* child::node() expression raises an entirely different error than an explicit child::node() expression.

This is primarily because by mentioning only that one error suggests to me that that&apos;s the only case where something can go wrong when the context item is not a node.

Furthermore, we aren&apos;t very explicit about what the focus is of the select-expression. We talk elsewhere about focus-setting containers, but that is not linked to this section. I know how it is supposed to work, but couldn&apos;t verify it. 

I&apos;m not necessarily saying we miss something here, but the text left me wondering nevertheless.

I think I expected something like &quot;The select expression of xsl:apply-templates is evaluated with the same focus as its containing construct.&quot;. And/or: &quot;If the context item is not of the required type for the select expression a static or dynamic type error will be raised: XPTY0020&quot;. 

But maybe this is too obvious?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129131</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2018-04-02 09:41:49 +0000</bug_when>
    <thetext>All of this is covered by existing rules.

&gt;if you do select=&quot;foo/bar&quot; but the input sequence is not a node?

The XPath rules will give you a type error evaluating the path expression.(XPath §3.3.2: &quot;If the context item is a node, an axis step returns a sequence of zero or more nodes; otherwise, a type error is raised [err:XPTY0020].&quot;

&gt;It is a bit strange that an *implicit* child::node() expression raises an entirely different error than an explicit child::node() expression.

Fixing things in XSLT 2.0 just because they are &quot;strange&quot; is not really on our agenda.

&gt;Furthermore, we aren&apos;t very explicit about what the focus is of the select-expression.

§5.3.3.1 is explicit: &quot;Where the containing element of an XPath expression is an instruction or a literal result element, the initial context item, context position, and context size for the XPath expression are the same as the context item, context position, and context size for the evaluation of the containing instruction or literal result element.&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129132</commentid>
    <comment_count>2</comment_count>
    <who name="Abel Braaksma">abel.online</who>
    <bug_when>2018-04-02 10:18:26 +0000</bug_when>
    <thetext>&gt; 5.3.3.1 Maintaining Position: the Focus
I knew I read that before, yes indeed, that section contains exactly what I meant.

&gt; Fixing things in XSLT 2.0 just because they are &quot;strange&quot; is not really on 
&gt; our agenda.
Did you mean, things of XSLT 2.0 that are also in XSLT 3.0? I didn&apos;t mean to fix the 2.0 edition ;). 

I meant that having XTTE0510 where XDTY0020 would seem the more proper error seems a bit odd. But it is not a bug per se, nothing&apos;s broken, just odd ;).

Either way, I got lost while finding what I needed and it is all there. I&apos;ll close this as INVALID.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>