<?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>30415</bug_id>
          
          <creation_ts>2019-03-11 10:56:06 +0000</creation_ts>
          <short_desc>[XSLT30] minor corrections to an example</short_desc>
          <delta_ts>2019-03-12 05:38:12 +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>NEW</bug_status>
          <resolution></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="Mukul Gandhi">gandhi.mukul</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          <cc>abel.online</cc>
    
    <cc>gandhi.mukul</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>129630</commentid>
    <comment_count>0</comment_count>
    <who name="Mukul Gandhi">gandhi.mukul</who>
    <bug_when>2019-03-11 10:56:06 +0000</bug_when>
    <thetext>In the XSLT 3.0 spec, in the section &quot;18.1 The xsl:source-document Instruction&quot;, following example is provided,

&lt;xsl:source-document streamable=&quot;yes&quot; href=&quot;book.xml&quot;&gt;
  &lt;xsl:for-each select=&quot;book&quot;&gt;             
    &lt;xsl:for-each select=&quot;chapter&quot;&gt;
      &lt;xsl:result-document href=&quot;chapter{position()}.xml&quot;&gt;
        &lt;xsl:copy-of select=&quot;.&quot;/&gt;
      &lt;/xsl:result-document&gt;
    &lt;/xsl:for-each&gt;
  &lt;/xsl:for-each&gt;  
&lt;/xsl:source-document&gt;

It seems, this example could be better written as follows,

&lt;xsl:source-document streamable=&quot;yes&quot; href=&quot;book.xml&quot;&gt;        
  &lt;xsl:for-each select=&quot;book/chapter&quot;&gt;
    &lt;xsl:result-document href=&quot;chapter{position()}.xml&quot;&gt;
      &lt;xsl:copy-of select=&quot;.&quot;/&gt;
    &lt;/xsl:result-document&gt;
  &lt;/xsl:for-each&gt;
&lt;/xsl:source-document&gt;

(i.e with one for loop instead of two. The example talks about *one* book)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129631</commentid>
    <comment_count>1</comment_count>
    <who name="Mukul Gandhi">gandhi.mukul</who>
    <bug_when>2019-03-11 11:00:06 +0000</bug_when>
    <thetext>I also meant, that this suggestion is also a possible errata to spec.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129632</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2019-03-11 11:30:13 +0000</bug_when>
    <thetext>I agree, the example code could be simplified (though it is not actually incorrect). I guess there&apos;s probably some history as to why it was written this way (perhaps some restriction on use of the position() function when streaming) but I don&apos;t intend to research it.

(Actually, I sadly don&apos;t have the ability to research it. The WG kept all its discussions on a member-only list, and since my invited expert status has lapsed, I no longer have access to the archives.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129633</commentid>
    <comment_count>3</comment_count>
    <who name="Abel Braaksma">abel.online</who>
    <bug_when>2019-03-12 01:24:07 +0000</bug_when>
    <thetext>Out of curiosity, I briefly checked how this example looked historically, and it turns out that you have to go all the way back to the public draft of 2010 (!) to find that we originally used this:

&lt;xsl:stream href=&quot;book.xml&quot;&gt;
  &lt;xsl:for-each select=&quot;book/chapter&quot;&gt;
    &lt;xsl:result-document href=&quot;chapter{position()}.xml&quot;&gt;
      &lt;xsl:copy-of select=&quot;.&quot;/&gt;
    &lt;/xsl:result-document&gt;
  &lt;/xsl:for-each&gt;
&lt;/xsl:stream&gt;


After that (Draft of 2012), it was changed into:

&lt;xsl:stream href=&quot;book.xml&quot;&gt;
  &lt;xsl:for-each select=&quot;book&quot;&gt;             
    &lt;xsl:for-each select=&quot;chapter&quot;&gt;
      &lt;xsl:result-document href=&quot;chapter{position()}.xml&quot;&gt;
        &lt;xsl:copy-of select=&quot;.&quot;/&gt;
      &lt;/xsl:result-document&gt;
    &lt;/xsl:for-each&gt;
  &lt;/xsl:for-each&gt;  
&lt;/xsl:stream&gt;


But since we didn&apos;t have revision markings on these early drafts, there&apos;s no way of saying why we split the xsl:for-each. It could have had something to do with the concept of &quot;incrementally consuming&quot; expressions, which was a thing in the draft of 2012, but was later dropped as a concept. However, even with the rules of the time, both examples above would validate as streamable.

From previous minutes and mail discussions I couldn&apos;t find anything meaningful (I have a local backup of some of the communication that is now inaccessible online, but not all).

I agree that we could editorially improve this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129634</commentid>
    <comment_count>4</comment_count>
    <who name="Mukul Gandhi">gandhi.mukul</who>
    <bug_when>2019-03-12 05:38:12 +0000</bug_when>
    <thetext>Related to this bug report, following is another point that may be editorially corrected. In the section, &quot;18.1.2 Examples of xsl:source-document&quot; there&apos;s an example mentioned as follows,

Example: Using xsl:source-document with xsl:apply-templates

The use of on-no-match=&quot;deep-copy&quot; in the xsl:mode declaration means that the built-in template rule copies nodes unchanged, except where overridden by a user-defined template rule.

And the XSLT transform below above text mentions,

&lt;xsl:transform version=&quot;3.0&quot; 
               xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;

    &lt;xsl:mode name=&quot;delete-ednotes&quot; streamable=&quot;yes&quot; on-no-match=&quot;shallow-copy&quot;/&gt;
    .......

i.e the XSLT transform above mentions,
on-no-match=&quot;shallow-copy&quot;

Whereas, paragraph above mentions on-no-match=&quot;deep-copy&quot;.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>