Add non-streaming versions of some tests for verification of results
authorMichael Kay <mike@saxonica.com>
Wed, 27 Jun 2018 13:13:55 +0100
changeset 1865 4b18c485f28b
parent 1864 674a838e058d
child 1866 314fbd0f5415
Add non-streaming versions of some tests for verification of results
tests/strm/si-for-each-group/_si-for-each-group-test-set.xml
tests/strm/si-for-each-group/si-group-051.xsl
tests/strm/si-for-each-group/si-group-052.xsl
tests/strm/si-for-each-group/si-group-062.xsl
--- a/tests/strm/si-for-each-group/_si-for-each-group-test-set.xml	Wed Jun 27 13:13:20 2018 +0100
+++ b/tests/strm/si-for-each-group/_si-for-each-group-test-set.xml	Wed Jun 27 13:13:55 2018 +0100
@@ -1070,6 +1070,26 @@
       </environment>
       <test>
          <stylesheet file="si-group-051.xsl"/>
+         <param name="STREAMABLE" static="yes" select="true()"/>
+      </test>
+      <result>
+         <all-of>
+            <assert>/Orders/group[@number="100"]/value="-15.00"</assert>
+            <assert>/Orders/group[@number="101"]/value="6.00"</assert>
+            <assert>/Orders/group[@number="102"]/value="-5.00"</assert>
+         </all-of>
+      </result>
+   </test-case>
+   
+   <test-case name="si-group-051-ns">
+      <description>As -051 with streaming disabled.</description>
+      <created by="Michael Kay" on="2018-06-26"/>
+      <environment>
+         <source file="si-group-051.xml" role="." streaming="false"/>
+      </environment>
+      <test>
+         <stylesheet file="si-group-051.xsl"/>
+         <param name="STREAMABLE" static="yes" select="false()"/>
       </test>
       <result>
          <all-of>
@@ -1088,6 +1108,7 @@
       </environment>
       <test>
          <stylesheet file="si-group-052.xsl"/>
+         <param name="STREAMABLE" static="yes" select="true()"/>
       </test>
       <result>
          <error code="XTSE3430"/>
@@ -1102,6 +1123,28 @@
       </environment>
       <test>
          <stylesheet file="si-group-053.xsl"/>
+         <param name="STREAMABLE" static="yes" select="true()"/>
+      </test>
+      <result>
+         <all-of>
+            <assert>count(/chapter/pageset[1]/page) = 2</assert>
+            <assert>count(/chapter/pageset[2]/page) = 1</assert>
+            <assert>count(/chapter/pageset[3]/page) = 2</assert>
+            <assert>count(/chapter/pageset) = 3</assert>
+            <assert>empty(//pb)</assert>
+         </all-of>
+      </result>
+   </test-case>
+   
+   <test-case name="si-group-053-ns">
+      <description>As -053 with streaming disabled</description>
+      <created by="Michael Kay after Martin Honnen" on="2018-06-26"/>
+      <environment>
+         <source file="si-group-053.xml" role="." streaming="false"/>
+      </environment>
+      <test>
+         <stylesheet file="si-group-053.xsl"/>
+         <param name="STREAMABLE" static="yes" select="false()"/>
       </test>
       <result>
          <all-of>
@@ -1122,6 +1165,28 @@
       </environment>
       <test>
          <stylesheet file="si-group-054.xsl"/>
+         <param name="STREAMABLE" static="yes" select="true()"/>
+      </test>
+      <result>
+         <all-of>
+            <assert-xml><![CDATA[<contents><unnumbered type="PT"><title>Title one</title></unnumbered
+               ><unnumbered type="PT"><title>Title Two</title></unnumbered
+               ><unnumbered type="PT"><title>Title Three</title></unnumbered
+               ><unnumbered type="PT"><title>Title Four</title></unnumbered
+               ></contents>]]></assert-xml>
+         </all-of>
+      </result>
+   </test-case>
+   
+   <test-case name="si-group-054-ns">
+      <description>As -054 with streaming disabled</description>
+      <created by="Michael Kay after Martin Honnen" on="2018-06-26"/>
+      <environment>
+         <source file="si-group-054.xml" role="." streaming="false"/>
+      </environment>
+      <test>
+         <stylesheet file="si-group-054.xsl"/>
+         <param name="STREAMABLE" static="yes" select="false()"/>
       </test>
       <result>
          <all-of>
@@ -1142,6 +1207,28 @@
       </environment> 
       <test>
          <stylesheet file="si-group-055.xsl"/>
+         <param name="STREAMABLE" static="yes" select="true()"/>
+      </test>
+      <result>
+         <all-of>
+            <assert-xml><![CDATA[<contents><unnumbered type="PT"><title>Title one</title><unnumbered type="chapter" manid="01"
+               /><unnumbered type="chapter" manid="02"/><unnumbered type="chapter" manid="03"/></unnumbered><unnumbered type="PT"
+               ><title>Title Two</title><unnumbered type="chapter" manid="04"/><unnumbered type="chapter" manid="05"/><unnumbered type="chapter" manid="06"/></unnumbered><unnumbered type="PT"
+               ><title>Title Three</title><unnumbered type="chapter" manid="07"/><unnumbered type="chapter" manid="08"/><unnumbered type="chapter" manid="09"/><unnumbered type="chapter" manid="10"/></unnumbered><unnumbered type="PT"
+               ><title>Title Four</title><unnumbered type="chapter" manid="11"/><unnumbered type="chapter" manid="12"/><unnumbered type="chapter" manid="13"/><unnumbered type="chapter" manid="14"/><unnumbered type="chapter" manid="15"/></unnumbered></contents>]]></assert-xml>
+         </all-of>
+      </result>
+   </test-case>
+   
+   <test-case name="si-group-055-ns">
+      <description>As -055 with streaming disabled</description>
+      <created by="Michael Kay after Martin Honnen" on="2017-06-20"/>
+      <environment>
+         <source file="si-group-054.xml" role="." streaming="false"/> <!-- sic -->
+      </environment> 
+      <test>
+         <stylesheet file="si-group-055.xsl"/>
+         <param name="STREAMABLE" static="yes" select="false()"/>
       </test>
       <result>
          <all-of>
@@ -1162,6 +1249,27 @@
       </environment>
       <test>
          <stylesheet file="si-group-056.xsl"/>
+         <param name="STREAMABLE" static="yes" select="true()"/>
+      </test>
+      <result>
+         <all-of>
+            <assert-xml><![CDATA[<contents><unnumbered type="PT"><title>Title one</title><subtitle>Chapter Two</subtitle></unnumbered
+               ><unnumbered type="PT"><title>Title Two</title></unnumbered
+               ><unnumbered type="PT"><title>Title Three</title><subtitle>Chapter Eight</subtitle></unnumbered
+               ><unnumbered type="PT"><title>Title Four</title></unnumbered></contents>]]></assert-xml>
+         </all-of>
+      </result>
+   </test-case>
+   
+   <test-case name="si-group-056-ns">
+      <description>As -056 with streaming disabled</description>
+      <created by="Michael Kay" on="2018-06-28"/>
+      <environment>
+         <source file="si-group-054.xml" role="." streaming="false"/> <!-- sic -->
+      </environment>
+      <test>
+         <stylesheet file="si-group-056.xsl"/>
+         <param name="STREAMABLE" static="yes" select="false()"/>
       </test>
       <result>
          <all-of>
@@ -1181,6 +1289,27 @@
       </environment>
       <test>
          <stylesheet file="si-group-057.xsl"/>
+         <param name="STREAMABLE" static="yes" select="true()"/>
+      </test>
+      <result>
+         <all-of>
+            <assert-xml><![CDATA[<Element><group><h1><title>Name1</title></h1
+               ><para/></group><group><h1><title>Name2</title></h1
+               ><para>Test1</para><para>Test2</para></group><group><h1><title>Name3</title></h1
+               ><para>Test3</para><para>Test4</para></group></Element>]]></assert-xml>
+         </all-of>
+      </result>
+   </test-case>
+   
+   <test-case name="si-group-057-ns">
+      <description>As -057 with streaming disabled</description>
+      <created by="Michael Kay after Martin Honnen" on="2017-06-26"/>
+      <environment>
+         <source file="si-group-057.xml" role="." streaming="true"/>
+      </environment>
+      <test>
+         <stylesheet file="si-group-057.xsl"/>
+         <param name="STREAMABLE" static="yes" select="false()"/>
       </test>
       <result>
          <all-of>
@@ -1200,6 +1329,27 @@
       </environment>
       <test>
          <stylesheet file="si-group-058.xsl"/>
+         <param name="STREAMABLE" static="yes" select="true()"/>
+      </test>
+      <result>
+         <all-of>
+            <assert-xml><![CDATA[<Element><group><h1><title>Name1</title></h1
+               ><para/></group><group><h1><title>Name2</title></h1
+               ><para>Test1</para><para>Test2</para></group><group><h1><title>Name3</title></h1
+               ><para>Test3</para><para>Test4</para></group></Element>]]></assert-xml>
+         </all-of>
+      </result>
+   </test-case>
+   
+   <test-case name="si-group-058-ns">
+      <description>As -058 with streaming disabled.</description>
+      <created by="Michael Kay after Martin Honnen" on="2018-06-28"/>
+      <environment>
+         <source file="si-group-057.xml" role="." streaming="false"/>
+      </environment>
+      <test>
+         <stylesheet file="si-group-058.xsl"/>
+         <param name="STREAMABLE" static="yes" select="false()"/>
       </test>
       <result>
          <all-of>
@@ -1219,6 +1369,7 @@
       </environment>
       <test>
          <stylesheet file="si-group-059.xsl"/>
+         <param name="STREAMABLE" static="yes" select="true()"/>
       </test>
       <result>
          <all-of>
@@ -1230,6 +1381,66 @@
       </result>
    </test-case>
    
+   <test-case name="si-group-059-ns">
+      <description>As -059 with streaming disabled</description>
+      <created by="Michael Kay after Martin Honnen" on="2018-06-28"/>
+      <environment>
+         <source file="si-group-057.xml" role="." streaming="false"/>
+      </environment>
+      <test>
+         <stylesheet file="si-group-059.xsl"/>
+         <param name="STREAMABLE" static="yes" select="false()"/>
+      </test>
+      <result>
+         <all-of>
+            <assert-xml><![CDATA[<Element><group><h1><title>Name1</title></h1
+               ><para/></group><group><h1><title>Name2</title></h1
+               ><para>Test1</para><para>Test2</para></group><group><h1><title>Name3</title></h1
+               ><para>Test3</para><para>Test4</para></group></Element>]]></assert-xml>
+         </all-of>
+      </result>
+   </test-case>
+   
+   <test-case name="si-group-059a">
+      <description>Streamed grouping - conditional within xsl:for-each-group (variant of -059 with different source document).</description>
+      <created by="Michael Kay" on="2017-07-06"/>
+      <environment>
+         <source file="si-group-059.xml" role="." streaming="true"/>
+      </environment>
+      <test>
+         <stylesheet file="si-group-059.xsl"/>
+         <param name="STREAMABLE" static="yes" select="true()"/>
+      </test>
+      <result>
+         <all-of>
+            <assert-xml><![CDATA[<Element><para>Test0</para><group><h1><title>Name1</title></h1
+               ><para/></group><group><h1><title>Name2</title></h1
+               ><para>Test1</para><para>Test2</para></group><group><h1><title>Name3</title></h1
+               ><para>Test3</para><para>Test4</para></group></Element>]]></assert-xml>
+         </all-of>
+      </result>
+   </test-case>
+   
+   <test-case name="si-group-059a-ns">
+      <description>As -059a with streaming disabled.</description>
+      <created by="Michael Kay" on="2018-06-28"/>
+      <environment>
+         <source file="si-group-059.xml" role="." streaming="false"/>
+      </environment>
+      <test>
+         <stylesheet file="si-group-059.xsl"/>
+         <param name="STREAMABLE" static="yes" select="false()"/>
+      </test>
+      <result>
+         <all-of>
+            <assert-xml><![CDATA[<Element><para>Test0</para><group><h1><title>Name1</title></h1
+               ><para/></group><group><h1><title>Name2</title></h1
+               ><para>Test1</para><para>Test2</para></group><group><h1><title>Name3</title></h1
+               ><para>Test3</para><para>Test4</para></group></Element>]]></assert-xml>
+         </all-of>
+      </result>
+   </test-case>
+   
    <test-case name="si-group-060">
       <description>Streamed grouping - average of attribute values in group.</description>
       <created by="Michael Kay after Martin Honnen" on="2017-07-13"/>
@@ -1267,25 +1478,23 @@
       </result>
    </test-case>
    
-   <test-case name="si-group-059a">
-      <description>Streamed grouping - conditional within xsl:for-each-group (variant of -059 with different source document).</description>
-      <created by="Michael Kay" on="2017-07-06"/>
+   <test-case name="si-group-062">
+      <description>Non-streamable xsl:source-document instruction within a streamable template</description>
+      <created by="Michael Kay" on="2018-06-28"/>
       <environment>
-         <source file="si-group-059.xml" role="." streaming="true"/>
+         <source file="si-group-051.xml" role="." streaming="true"/>
       </environment>
       <test>
-         <stylesheet file="si-group-059.xsl"/>
+         <stylesheet file="si-group-062.xsl"/>
       </test>
       <result>
          <all-of>
-            <assert-xml><![CDATA[<Element><para>Test0</para><group><h1><title>Name1</title></h1
-               ><para/></group><group><h1><title>Name2</title></h1
-               ><para>Test1</para><para>Test2</para></group><group><h1><title>Name3</title></h1
-               ><para>Test3</para><para>Test4</para></group></Element>]]></assert-xml>
+            <assert>/Orders/group[@number="100"]/value="-15.00"</assert>
+            <assert>/Orders/group[@number="101"]/value="6.00"</assert>
+            <assert>/Orders/group[@number="102"]/value="-5.00"</assert>
          </all-of>
       </result>
    </test-case>
-   
 
    <test-case name="si-group-101">
       <description>Streamed grouping - group-starting-with </description>
--- a/tests/strm/si-for-each-group/si-group-051.xsl	Wed Jun 27 13:13:20 2018 +0100
+++ b/tests/strm/si-for-each-group/si-group-051.xsl	Wed Jun 27 13:13:55 2018 +0100
@@ -15,7 +15,7 @@
     <xsl:copy>
       <xsl:for-each-group select="Order/copy-of()" group-adjacent="@number">
         <group number="{current-grouping-key()}">
-          <xsl:source-document href="../docs/transactions.xml">
+          <xsl:source-document href="../docs/transactions.xml" _streamable="{$STREAMABLE}">
             <xsl:for-each select="//transaction[@date = current-group()[1]/Date]">
               <value>
                 <xsl:value-of select="@value"/>
--- a/tests/strm/si-for-each-group/si-group-052.xsl	Wed Jun 27 13:13:20 2018 +0100
+++ b/tests/strm/si-for-each-group/si-group-052.xsl	Wed Jun 27 13:13:55 2018 +0100
@@ -15,7 +15,7 @@
     <xsl:copy>
       <xsl:for-each-group select="Order" group-adjacent="@number">
         <group number="{current-grouping-key()}">
-          <xsl:source-document href="../docs/transactions.xml">
+          <xsl:source-document href="../docs/transactions.xml" _streamable="{$STREAMABLE}">
             <xsl:for-each select="//transaction[@date = current-group()[1]/Date]">
               <value>
                 <xsl:value-of select="@value"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/strm/si-for-each-group/si-group-062.xsl	Wed Jun 27 13:13:55 2018 +0100
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:math="http://www.w3.org/2005/xpath-functions/math" exclude-result-prefixes="xs math"
+  version="3.0">
+
+  <!-- Non-streamable xsl:source-document instruction in a streamable template -->
+  
+  <xsl:mode streamable="yes"/>
+
+  <xsl:output indent="no"/>
+  <xsl:strip-space elements="*"/>
+
+  <xsl:template match="Orders">
+    <xsl:copy>
+      <xsl:for-each-group select="Order/copy-of()" group-adjacent="@number">
+        <group number="{current-grouping-key()}">
+          <xsl:source-document href="../docs/transactions.xml" streamable="no">
+            <xsl:for-each select="//transaction[@date = current-group()[1]/Date]">
+              <value account="{../account-number}">
+                <xsl:value-of select="@value"/>
+              </value>
+            </xsl:for-each>
+          </xsl:source-document>
+        </group>
+      </xsl:for-each-group>
+    </xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet>