LRE streaming tests, reflect on-empty spec change
authorMichael Kay <mike@saxonica.com>
Fri, 10 Jul 2015 11:38:29 +0100
changeset 1019 b6d0aaa561e0
parent 1018 9319bed7bead
child 1020 35d51e999707
LRE streaming tests, reflect on-empty spec change
tests/strm/si-LRE/si-lre-A.xsl
tests/strm/si-LRE/si-lre-B.xsl
tests/strm/si-LRE/si-lre-C.xsl
--- a/tests/strm/si-LRE/si-lre-A.xsl	Fri Jul 10 10:08:59 2015 +0100
+++ b/tests/strm/si-LRE/si-lre-A.xsl	Fri Jul 10 11:38:29 2015 +0100
@@ -1,38 +1,40 @@
-<xsl:transform version="3.0" 
-    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    xmlns:map="http://www.w3.org/2005/xpath-functions/map"
-    xmlns:xs="http://www.w3.org/2001/XMLSchema"
-    exclude-result-prefixes="map xs">
-    
-    <xsl:variable name="RUN" select="true()" static="yes"/>
-    <xsl:strip-space elements="*"/>
-   
+<xsl:transform version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:map="http://www.w3.org/2005/xpath-functions/map" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  exclude-result-prefixes="map xs">
+
+  <xsl:variable name="RUN" select="true()" static="yes"/>
+  <xsl:strip-space elements="*"/>
+
   <!-- within xsl:stream, use LRE: atomic values, consuming -->
-  
+
   <xsl:template name="cy-001" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/transactions.xml">
         <xsl:for-each select="account/transaction[@value &lt; 0]/@value">
-          <value><xsl:sequence select="data(.)"/></value>
+          <value>
+            <xsl:sequence select="data(.)"/>
+          </value>
         </xsl:for-each>
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: atomic values, consuming and non-consuming -->
-  
+
   <xsl:template name="cy-002" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/transactions.xml">
         <xsl:for-each select="data(account/transaction[@value &lt; 0]/@value), 101, 102">
-          <e><xsl:value-of select="."/></e>
-        </xsl:for-each> 
+          <e>
+            <xsl:value-of select="."/>
+          </e>
+        </xsl:for-each>
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: climbing posture -->
-  
+
   <xsl:template name="cy-003" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/transactions.xml">
@@ -43,13 +45,13 @@
             </transaction>
           </xsl:for-each>
         </xsl:variable>
-        <xsl:copy-of select="data($atts)"/>  
+        <xsl:copy-of select="data($atts)"/>
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: climbing posture -->
-  
+
   <xsl:template name="cy-004" use-when="$RUN">
     <xsl:variable name="extra" as="element()*">
       <PRICE value="101"/>
@@ -61,16 +63,16 @@
           <xsl:for-each select="account/transaction[@value &lt; 0]/@value, $extra/@value">
             <transaction>
               <xsl:value-of select="."/>
-            </transaction>             
+            </transaction>
           </xsl:for-each>
         </xsl:variable>
-        <xsl:copy-of select="data($atts)"/> 
+        <xsl:copy-of select="data($atts)"/>
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: striding posture, element nodes -->
-  
+
   <xsl:template name="cy-005" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/books.xml">
@@ -82,9 +84,9 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: striding posture, text nodes -->
-  
+
   <xsl:template name="cy-006" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/books.xml">
@@ -96,9 +98,9 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: striding posture, text nodes mixed with atomic values -->
-  
+
   <xsl:template name="cy-007" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/books.xml">
@@ -110,9 +112,9 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: striding posture, element nodes mixed with grounded elements -->
-  
+
   <xsl:template name="cy-008" use-when="$RUN">
     <xsl:variable name="extra" as="element()*">
       <PRICE>100.00</PRICE>
@@ -128,23 +130,23 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: descendant text nodes -->
-  
+
   <xsl:template name="cy-009" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/books.xml">
         <xsl:for-each select="outermost(//PRICE)">
           <PRICE>
-          	<xsl:sequence select="text()"/>
+            <xsl:sequence select="text()"/>
           </PRICE>
         </xsl:for-each>
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: descendant text nodes mixed with atomic values -->
-  
+
   <xsl:template name="cy-010" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/books.xml">
@@ -156,9 +158,9 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: whole document unchanged -->
-  
+
   <xsl:template name="cy-011" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/books.xml">
@@ -170,11 +172,11 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
-  
-  
+
+
+
   <!-- within xsl:stream, use LRE: validation="strip" (non-schema-aware) -->
-  
+
   <xsl:template name="cy-022" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/citygml.xml">
@@ -186,9 +188,9 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: validation="preserve" (non-schema-aware) -->
-  
+
   <xsl:template name="cy-023" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/citygml.xml">
@@ -200,9 +202,9 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: validation="lax" (non-schema-aware) -->
-  
+
   <xsl:template name="cy-024" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/citygml.xml">
@@ -214,9 +216,9 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: copy-namespaces="yes", argument grounded and consuming -->
-  
+
   <xsl:template name="cy-025" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/citygml.xml">
@@ -228,9 +230,9 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: copy-namespaces="no", argument grounded and consuming -->
-  
+
   <xsl:template name="cy-026" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/citygml.xml">
@@ -242,149 +244,204 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
-  
+
+
   <!-- xsl:element referring to a streamable attribute set -->
-  
+
   <xsl:attribute-set name="as-1" streamable="yes">
     <xsl:attribute name="x" select="1"/>
     <xsl:attribute name="y" select="2"/>
-  </xsl:attribute-set> 
-  
+  </xsl:attribute-set>
+
   <xsl:template name="cy-029" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/citygml.xml">
         <xsl:for-each select="*">
           <dddd xsl:use-attribute-sets="as-1">
-        	<xsl:sequence select="*" />
+            <xsl:sequence select="*"/>
           </dddd>
-        </xsl:for-each>  
-      </xsl:stream>
-    </out>
-  </xsl:template>   
-  
-  <!-- within xsl:stream, use LRE/on-empty: empty sequence selected -->
-  
-  <xsl:template name="cy-040" use-when="$RUN">
-    <out>
-      <xsl:variable name="a" as="element()"><a/></xsl:variable>
-      <xsl:stream href="../docs/citygml.xml">
-        <a xsl:on-empty="$a">
-          <xsl:sequence select="/*[@dummy='not-there']" />
-        </a>
-      </xsl:stream>
-    </out>
-  </xsl:template>
-  
-  <!-- within xsl:stream, use LRE/on-empty: empty element constructed -->
-  
-  <xsl:template name="cy-041" use-when="$RUN">
-    <out>
-      <xsl:variable name="a" as="element()"><a/></xsl:variable>
-      <xsl:stream href="../docs/citygml.xml">
-        <a xsl:on-empty="$a">
-          <xsl:if test="current-date() lt xs:date('1900-01-01')"><b/></xsl:if>
-        </a>
-      </xsl:stream>
-    </out>
-  </xsl:template>
-  
-  <!-- within xsl:stream, use LRE/on-empty: empty document node constructed -->
-  
-  <xsl:template name="cy-042" use-when="$RUN">
-    <out>
-      <xsl:variable name="a" as="element()"><a/></xsl:variable>
-      <xsl:stream href="../docs/citygml.xml">
-        <a xsl:on-empty="$a">
-          <xsl:if test="current-date() lt xs:date('1900-01-01')"><b/></xsl:if>
-        </a>
-      </xsl:stream>
-    </out>
-  </xsl:template>
-  
-  <!-- within xsl:stream, use LRE/on-empty: empty document node constructed -->
-  
-  <xsl:template name="cy-043" use-when="$RUN">
-    <out>
-      <xsl:variable name="a" as="element()"><a/></xsl:variable>
-      <xsl:stream href="../docs/citygml.xml">
-        <a xsl:on-empty="$a">
-          <xsl:if test="current-date() lt xs:date('1900-01-01')"><b/></xsl:if>
-        </a>
+        </xsl:for-each>
       </xsl:stream>
     </out>
   </xsl:template>
-  
-  <!-- within xsl:stream, use LRE/on-empty: empty comment node constructed -->
-  
-  <xsl:template name="cy-044" use-when="$RUN">
+
+  <!-- within xsl:stream, use LRE/on-empty: empty sequence selected -->
+
+  <xsl:template name="cy-040" use-when="$RUN">
     <out>
-      <xsl:variable name="a" as="element()"><a/></xsl:variable>
-      <xsl:stream href="../docs/special.xml">
-        <a xsl:on-empty="$a">
-          <xsl:if test="current-date() lt xs:date('1900-01-01')"><xsl:sequence select="special/comment()[2]"/></xsl:if>
-        </a>
-      </xsl:stream>
-    </out>
-  </xsl:template>
-  
-  <!-- within xsl:stream, use LRE/on-empty: empty PI node constructed -->
-  
-  <xsl:template name="cy-045" use-when="$RUN">
-    <out>
-      <xsl:variable name="a" as="element()"><a/></xsl:variable>
-      <xsl:stream href="../docs/special.xml">
-        <a xsl:on-empty="$a">
-          <xsl:if test="current-date() lt xs:date('1900-01-01')"><xsl:sequence select="special/processing-instruction()[2]"/></xsl:if>
-        </a>
+      <xsl:variable name="a" as="element()">
+        <a/>
+      </xsl:variable>
+      <xsl:stream href="../docs/citygml.xml">
+        <xsl:conditional-content>
+          <a>
+            <xsl:sequence select="/*[@dummy='not-there']"/>
+          </a>
+        </xsl:conditional-content>
+        <xsl:on-empty select="$a"/>
       </xsl:stream>
     </out>
   </xsl:template>
-  
-  <!-- within xsl:stream, use LRE/on-empty: empty element node constructed -->
-  
-  <xsl:template name="cy-046" use-when="$RUN">
+
+  <!-- within xsl:stream, use LRE/on-empty: empty element constructed -->
+
+  <xsl:template name="cy-041" use-when="$RUN">
     <out>
-      <xsl:variable name="a" as="element()"><a/></xsl:variable>
-      <xsl:stream href="../docs/special.xml">
-        <xsl:for-each select="special">
-           <special xsl:on-empty="$a">
-        	  <xsl:sequence select="f/@b" />
-           </special>
-        </xsl:for-each>   
+      <xsl:variable name="a" as="element()">
+        <a/>
+      </xsl:variable>
+      <xsl:stream href="../docs/citygml.xml">
+        <xsl:conditional-content>
+          <a>
+            <xsl:if test="current-date() lt xs:date('1900-01-01')">
+              <b/>
+            </xsl:if>
+          </a>
+        </xsl:conditional-content>
+        <xsl:on-empty select="$a"/>
       </xsl:stream>
     </out>
   </xsl:template>
-  
-  <!-- within xsl:stream, use LRE/on-empty: empty element constructed -->
-  
-  <xsl:template name="cy-047" use-when="$RUN">
+
+  <!-- within xsl:stream, use LRE/on-empty: empty document node constructed -->
+
+  <xsl:template name="cy-042" use-when="$RUN">
     <out>
-      <xsl:variable name="a" as="element()"><a/></xsl:variable>
+      <xsl:variable name="a" as="element()">
+        <a/>
+      </xsl:variable>
       <xsl:stream href="../docs/citygml.xml">
-        <xsl:for-each select="*">
-          <dddd xsl:on-empty="$a">
-            <xsl:copy-of select="a/b/c/d/e/f/g"/>
-          </dddd>
-        </xsl:for-each>  
+        <xsl:conditional-content>
+          <a>
+            <xsl:if test="current-date() lt xs:date('1900-01-01')">
+              <b/>
+            </xsl:if>
+          </a>
+        </xsl:conditional-content>
+        <xsl:on-empty select="$a"/>
       </xsl:stream>
     </out>
   </xsl:template>
-  
-  <!-- within xsl:stream, use LRE/on-empty: empty document constructed -->
-  
-  <xsl:template name="cy-048" use-when="$RUN">
+
+  <!-- within xsl:stream, use LRE/on-empty: empty document node constructed -->
+
+  <xsl:template name="cy-043" use-when="$RUN">
     <out>
-      <xsl:variable name="a" as="element()"><a/></xsl:variable>
+      <xsl:variable name="a" as="element()">
+        <a/>
+      </xsl:variable>
+      <xsl:stream href="../docs/citygml.xml">
+        <xsl:conditional-content>
+          <a>
+            <xsl:if test="current-date() lt xs:date('1900-01-01')">
+              <b/>
+            </xsl:if>
+          </a>
+        </xsl:conditional-content>
+        <xsl:on-empty select="$a"/>
+      </xsl:stream>
+    </out>
+  </xsl:template>
+
+  <!-- within xsl:stream, use LRE/on-empty: empty comment node constructed -->
+
+  <xsl:template name="cy-044" use-when="$RUN">
+    <out>
+      <xsl:variable name="a" as="element()">
+        <a/>
+      </xsl:variable>
+      <xsl:stream href="../docs/special.xml">
+        <xsl:conditional-content>
+          <a>
+            <xsl:if test="current-date() lt xs:date('1900-01-01')">
+              <xsl:sequence select="special/comment()[2]"/>
+            </xsl:if>
+          </a>
+        </xsl:conditional-content>
+        <xsl:on-empty select="$a"/>
+      </xsl:stream>
+    </out>
+  </xsl:template>
+
+  <!-- within xsl:stream, use LRE/on-empty: empty PI node constructed -->
+
+  <xsl:template name="cy-045" use-when="$RUN">
+    <out>
+      <xsl:variable name="a" as="element()">
+        <a/>
+      </xsl:variable>
+      <xsl:stream href="../docs/special.xml">
+        <xsl:conditional-content>
+          <a>
+            <xsl:if test="current-date() lt xs:date('1900-01-01')">
+              <xsl:sequence select="special/processing-instruction()[2]"/>
+            </xsl:if>
+          </a>
+        </xsl:conditional-content>
+        <xsl:on-empty select="$a"/>
+      </xsl:stream>
+    </out>
+  </xsl:template>
+
+  <!-- within xsl:stream, use LRE/on-empty: empty element node constructed -->
+
+  <xsl:template name="cy-046" use-when="$RUN">
+    <out>
+      <xsl:variable name="a" as="element()">
+        <a/>
+      </xsl:variable>
+      <xsl:stream href="../docs/special.xml">
+        <xsl:for-each select="special">
+          <xsl:conditional-content>
+            <special>
+              <xsl:sequence select="f/@b"/>
+            </special>
+          </xsl:conditional-content>
+          <xsl:on-empty select="$a"/>
+        </xsl:for-each>
+      </xsl:stream>
+    </out>
+  </xsl:template>
+
+  <!-- within xsl:stream, use LRE/on-empty: empty element constructed -->
+
+  <xsl:template name="cy-047" use-when="$RUN">
+    <out>
+      <xsl:variable name="a" as="element()">
+        <a/>
+      </xsl:variable>
       <xsl:stream href="../docs/citygml.xml">
         <xsl:for-each select="*">
-          <dddd xsl:on-empty="$a">
-            <xsl:copy-of select="a/b/c/d/e/f/g"/>
-          </dddd>
-        </xsl:for-each>  
+          <xsl:conditional-content>
+            <dddd>
+              <xsl:copy-of select="a/b/c/d/e/f/g"/>
+            </dddd>
+          </xsl:conditional-content>
+          <xsl:on-empty select="$a"/>
+        </xsl:for-each>
       </xsl:stream>
     </out>
-  </xsl:template>  
-   
-  
-</xsl:transform>  
\ No newline at end of file
+  </xsl:template>
+
+  <!-- within xsl:stream, use LRE/on-empty: empty document constructed -->
+
+  <xsl:template name="cy-048" use-when="$RUN">
+    <out>
+      <xsl:variable name="a" as="element()">
+        <a/>
+      </xsl:variable>
+      <xsl:stream href="../docs/citygml.xml">
+        <xsl:for-each select="*">
+          <xsl:conditional-content>
+            <dddd>
+              <xsl:copy-of select="a/b/c/d/e/f/g"/>
+            </dddd>
+          </xsl:conditional-content>
+          <xsl:on-empty select="$a"/>
+        </xsl:for-each>
+      </xsl:stream>
+    </out>
+  </xsl:template>
+
+
+</xsl:transform>
--- a/tests/strm/si-LRE/si-lre-B.xsl	Fri Jul 10 10:08:59 2015 +0100
+++ b/tests/strm/si-LRE/si-lre-B.xsl	Fri Jul 10 11:38:29 2015 +0100
@@ -1,17 +1,15 @@
-<xsl:transform version="3.0" 
-    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    xmlns:map="http://www.w3.org/2005/xpath-functions/map"
-    xmlns:err="http://www.w3.org/2005/xqt-errors"
-    xmlns:xs="http://www.w3.org/2001/XMLSchema"
-    exclude-result-prefixes="map xs err">
-    
-    <xsl:variable name="RUN" select="true()" static="yes"/>
-    <xsl:strip-space elements="*"/>
-    
-  <xsl:import-schema schema-location="../docs/loans.xsd"/>  
-   
+<xsl:transform version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:map="http://www.w3.org/2005/xpath-functions/map"
+  xmlns:err="http://www.w3.org/2005/xqt-errors" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  exclude-result-prefixes="map xs err">
+
+  <xsl:variable name="RUN" select="true()" static="yes"/>
+  <xsl:strip-space elements="*"/>
+
+  <xsl:import-schema schema-location="../docs/loans.xsd"/>
+
   <!-- within xsl:stream, use LRE: schema-aware, validation=strict -->
-  
+
   <xsl:template name="cy-101" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans-noNS.xml">
@@ -22,13 +20,13 @@
             </myroot>
           </xsl:variable>
           <xsl:value-of select="$copy/* instance of element(*, myroot)"/>
-        </xsl:for-each>  
+        </xsl:for-each>
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: schema-aware, validation=lax -->
-  
+
   <xsl:template name="cy-102" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans-noNS.xml">
@@ -43,9 +41,9 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: schema-aware, validation=strip -->
-  
+
   <xsl:template name="cy-103" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans-noNS.xml">
@@ -56,13 +54,13 @@
             </myroot>
           </xsl:variable>
           <xsl:value-of select="$copy/* instance of element(*, myroot)"/>
-        </xsl:for-each>  
+        </xsl:for-each>
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: schema-aware, validation=preserve -->
-  
+
   <xsl:template name="cy-104" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans-noNS.xml">
@@ -73,13 +71,13 @@
             </myroot>
           </xsl:variable>
           <xsl:value-of select="$copy/* instance of element(*, myroot)"/>
-        </xsl:for-each>  
+        </xsl:for-each>
       </xsl:stream>
     </out>
-  </xsl:template>  
-  
+  </xsl:template>
+
   <!-- within xsl:stream, use LRE: schema-aware, validation by type -->
-  
+
   <xsl:template name="cy-105" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans-noNS.xml">
@@ -90,13 +88,13 @@
             </myroot>
           </xsl:variable>
           <xsl:value-of select="$copy/* instance of element(*, myroot)"/>
-        </xsl:for-each>  
+        </xsl:for-each>
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: schema-aware, validation=strict, invalid -->
-  
+
   <xsl:template name="cy-106" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans.xml">
@@ -107,13 +105,13 @@
             </myroot>
           </xsl:variable>
           <xsl:value-of select="$copy/* instance of element(*, myroot)"/>
-        </xsl:for-each>  
+        </xsl:for-each>
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: schema-aware, validation=lax, no element declaration available -->
-  
+
   <xsl:template name="cy-107" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans.xml">
@@ -124,13 +122,13 @@
             </root>
           </xsl:variable>
           <xsl:value-of select="$copy/* instance of element(*, myroot)"/>
-        </xsl:for-each>  
+        </xsl:for-each>
       </xsl:stream>
     </out>
-  </xsl:template> 
-  
+  </xsl:template>
+
   <!-- within xsl:stream, use LRE: schema-aware, validation by type, invalid (wrong namespace) -->
-  
+
   <xsl:template name="cy-108" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans.xml">
@@ -141,13 +139,13 @@
             </myroot>
           </xsl:variable>
           <xsl:value-of select="$copy/* instance of element(*, myroot)"/>
-        </xsl:for-each>  
+        </xsl:for-each>
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: schema-aware, validation=strict, no element declaration available, caught -->
-  
+
   <xsl:template name="cy-109" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans.xml">
@@ -160,13 +158,13 @@
               <xsl:value-of select="local-name-from-QName($err:code)"/>
             </xsl:catch>
           </xsl:try>
-        </xsl:for-each>  
+        </xsl:for-each>
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: schema-aware, validation by type, invalid, caught -->
-  
+
   <xsl:template name="cy-110" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans.xml">
@@ -179,13 +177,13 @@
               <xsl:value-of select="local-name-from-QName($err:code)"/>
             </xsl:catch>
           </xsl:try>
-        </xsl:for-each>  
+        </xsl:for-each>
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: schema-aware, validation=strict, argument is consuming and grounded -->
-  
+
   <xsl:template name="cy-111" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans-noNS.xml">
@@ -200,9 +198,9 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: schema-aware, validation=lax, argument is consuming and grounded -->
-  
+
   <xsl:template name="cy-112" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans-noNS.xml">
@@ -217,9 +215,9 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: schema-aware, validation=strip, argument is consuming and grounded -->
-  
+
   <xsl:template name="cy-113" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans-noNS.xml">
@@ -234,9 +232,9 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: schema-aware, validation=preserve, argument is consuming and grounded -->
-  
+
   <xsl:template name="cy-114" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans-noNS.xml">
@@ -250,10 +248,10 @@
         <xsl:value-of select="$copy instance of element(*, ACERequest)"/>
       </xsl:stream>
     </out>
-  </xsl:template>  
-  
+  </xsl:template>
+
   <!-- within xsl:stream, use LRE: schema-aware, validation by type, argument is consuming and grounded -->
-  
+
   <xsl:template name="cy-115" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans-noNS.xml">
@@ -268,44 +266,67 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: schema-aware, validate attribute node by type, success -->
-  
+
   <xsl:template name="cy-116" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans-noNS.xml">
         <xsl:for-each select="*">
           <myroot xsl:type="xs:decimal">
-            <xsl:value-of select="*/@version"/> 
+            <xsl:value-of select="*/@version"/>
           </myroot>
-        </xsl:for-each>    
+        </xsl:for-each>
       </xsl:stream>
     </out>
-  </xsl:template> 
-  
+  </xsl:template>
+
   <!-- within xsl:stream, use LRE: schema-aware, validate attribute node by type, failure -->
-  
+
   <xsl:template name="cy-117" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans-noNS.xml">
         <xsl:for-each select="*">
           <myroot xsl:type="xs:date">
-            <xsl:value-of select="*/@version"/> 
+            <xsl:value-of select="*/@version"/>
           </myroot>
-        </xsl:for-each>  
+        </xsl:for-each>
       </xsl:stream>
     </out>
   </xsl:template>
-  
+
   <!-- within xsl:stream, use LRE: schema-aware, validation=strict, on-empty must be empty or valid -->
-  
+
   <xsl:template name="cy-118" use-when="$RUN">
     <out>
       <xsl:stream href="../docs/loans-noNS.xml">
         <xsl:variable name="copy" as="node()?">
           <xsl:for-each select="*">
-            <myroot xsl:validation="strict" xsl:on-empty="()">
+            <xsl:conditional-content>
+              <myroot xsl:validation="strict">
+                <xsl:copy-of select="*/*/NONEXISTENT"/>
+              </myroot>
+            </xsl:conditional-content>
+          </xsl:for-each>
+        </xsl:variable>
+        <xsl:value-of select="empty($copy)"/>
+      </xsl:stream>
+    </out>
+  </xsl:template>
+
+  <!-- within xsl:stream, use LRE: schema-aware, validation=strict, on-empty must be empty or valid -->
+
+  <xsl:template name="cy-119" use-when="$RUN">
+    <xsl:variable name="e" as="element()">
+      <e/>
+    </xsl:variable>
+    <out>
+      <xsl:stream href="../docs/loans-noNS.xml">
+        <xsl:variable name="copy" as="node()?">
+          <xsl:for-each select="*">
+            <myroot xsl:validation="strict">
               <xsl:copy-of select="*/*/NONEXISTENT"/>
+              <xsl:on-empty select="$e"/>
             </myroot>
           </xsl:for-each>
         </xsl:variable>
@@ -313,17 +334,41 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
-  <!-- within xsl:stream, use LRE: schema-aware, validation=strict, on-empty must be empty or valid -->
-  
-  <xsl:template name="cy-119" use-when="$RUN">
-    <xsl:variable name="e" as="element()"><e/></xsl:variable>
+
+  <!-- within xsl:stream, use LRE: schema-aware, validation by type, on-empty must be empty or valid -->
+
+  <xsl:template name="cy-120" use-when="$RUN">
+    <xsl:variable name="e" as="element()">
+      <e>2</e>
+    </xsl:variable>
     <out>
       <xsl:stream href="../docs/loans-noNS.xml">
         <xsl:variable name="copy" as="node()?">
           <xsl:for-each select="*">
-            <myroot xsl:validation="strict" xsl:on-empty="$e">
-              <xsl:copy-of select="*/*/NONEXISTENT"/>
+            <myroot xsl:type="xs:integer">
+              <xsl:sequence select="*/*/NONEXISTENT/data()"/>
+              <xsl:on-empty select="$e"/>
+            </myroot>
+          </xsl:for-each>
+        </xsl:variable>
+        <xsl:copy-of select="$copy"/>
+      </xsl:stream>
+    </out>
+  </xsl:template>
+
+  <!-- within xsl:stream, use LRE: schema-aware, validation by type, on-empty must be empty or valid -->
+
+  <xsl:template name="cy-121" use-when="$RUN">
+    <xsl:variable name="e" as="element()">
+      <e>2.7</e>
+    </xsl:variable>
+    <out>
+      <xsl:stream href="../docs/loans-noNS.xml">
+        <xsl:variable name="copy" as="node()?">
+          <xsl:for-each select="*">
+            <myroot xsl:type="xs:integer">
+              <xsl:sequence select="*/*/NONEXISTENT/data()"/>
+              <xsl:on-empty select="$e"/>
             </myroot>
           </xsl:for-each>
         </xsl:variable>
@@ -331,43 +376,7 @@
       </xsl:stream>
     </out>
   </xsl:template>
-  
-  <!-- within xsl:stream, use LRE: schema-aware, validation by type, on-empty must be empty or valid -->
-  
-  <xsl:template name="cy-120" use-when="$RUN">
-    <xsl:variable name="e" as="element()"><e>2</e></xsl:variable>
-    <out>
-      <xsl:stream href="../docs/loans-noNS.xml">
-        <xsl:variable name="copy" as="node()?">
-          <xsl:for-each select="*">
-            <myroot xsl:type="xs:integer" xsl:on-empty="$e">
-              <xsl:value-of select="*/*/NONEXISTENT"/>
-            </myroot>
-          </xsl:for-each>
-        </xsl:variable>
-        <xsl:copy-of select="$copy"/>
-      </xsl:stream>
-    </out>
-  </xsl:template>
-  
-  <!-- within xsl:stream, use LRE: schema-aware, validation by type, on-empty must be empty or valid -->
-  
-  <xsl:template name="cy-121" use-when="$RUN">
-    <xsl:variable name="e" as="element()"><e>2.7</e></xsl:variable>
-    <out>
-      <xsl:stream href="../docs/loans-noNS.xml">
-        <xsl:variable name="copy" as="node()?">
-          <xsl:for-each select="*">
-            <myroot xsl:type="xs:integer" xsl:on-empty="$e">
-              <xsl:value-of select="*/*/NONEXISTENT"/>
-            </myroot>
-          </xsl:for-each>
-        </xsl:variable>
-        <xsl:value-of select="empty($copy)"/>
-      </xsl:stream>
-    </out>
-  </xsl:template>
-  
 
-  
-</xsl:transform>  
\ No newline at end of file
+
+
+</xsl:transform>
--- a/tests/strm/si-LRE/si-lre-C.xsl	Fri Jul 10 10:08:59 2015 +0100
+++ b/tests/strm/si-LRE/si-lre-C.xsl	Fri Jul 10 11:38:29 2015 +0100
@@ -310,7 +310,9 @@
     <xsl:template name="s-050" use-when="$RUN">
       <xsl:stream href="../docs/books.xml">
         <out>
-          <a xsl:on-empty="()"><xsl:sequence select="./BOOKLIST/BOOKS/ITEM/PRICE/data()"/></a>
+          <xsl:conditional-content>
+            <a><xsl:sequence select="./BOOKLIST/BOOKS/ITEM/PRICE/data()"/></a>
+          </xsl:conditional-content>
         </out>
       </xsl:stream>
     </xsl:template>
@@ -320,7 +322,9 @@
     <xsl:template name="s-051" use-when="$RUN">
       <xsl:stream href="../docs/books.xml">
         <out>
-          <a xsl:on-empty="()"><xsl:sequence select="./BOOKLIST/BOOKS/ITEM/PRICETAG"/></a>
+          <xsl:conditional-content>
+            <a><xsl:sequence select="./BOOKLIST/BOOKS/ITEM/PRICETAG"/></a>
+          </xsl:conditional-content>
         </out>
       </xsl:stream>
     </xsl:template>
@@ -330,7 +334,10 @@
     <xsl:template name="s-052" use-when="$RUN">
       <xsl:stream href="../docs/books.xml">
         <out>
-          <a xsl:on-empty="head(//*)"><xsl:sequence select="1 to 10"/></a>
+          <a>
+            <xsl:sequence select="1 to 10"/>
+            <xsl:on-empty select="head(//*)"/>
+          </a>
         </out>
       </xsl:stream>
     </xsl:template>
@@ -341,7 +348,10 @@
       <xsl:param name="s" select="20"/>
       <xsl:stream href="../docs/books.xml">
         <out>
-          <a xsl:on-empty="head(//TITLE)"><xsl:sequence select="$s to 10"/></a>
+          <a>
+            <xsl:sequence select="$s to 10"/>
+            <xsl:on-empty select="head(//TITLE)"/>
+          </a>
         </out>
       </xsl:stream>
     </xsl:template>
@@ -353,7 +363,10 @@
       <xsl:stream href="../docs/books.xml">
         <xsl:for-each select="BOOKLIST/BOOKS">
           <out>
-            <a xsl:on-empty="$e"><xsl:sequence select="ITEM/PRICETAG"/></a>
+            <xsl:conditional-content>
+              <a><xsl:sequence select="ITEM/PRICETAG"/></a>
+            </xsl:conditional-content>
+            <xsl:on-empty select="$e"/>
           </out>
         </xsl:for-each>  
       </xsl:stream>
@@ -371,7 +384,10 @@
       <xsl:stream href="../docs/books.xml">
         <xsl:for-each select="BOOKLIST/BOOKS">
           <out>
-            <a xsl:on-empty="$atts"><xsl:sequence select="ITEM/PRICETAG"/></a>
+            <xsl:conditional-content>
+              <a><xsl:sequence select="ITEM/PRICETAG"/></a>
+            </xsl:conditional-content>
+            <xsl:on-empty select="$atts"/>
           </out>
         </xsl:for-each>  
       </xsl:stream>
@@ -390,7 +406,10 @@
         <xsl:for-each select="BOOKLIST/BOOKS">
           <out>
             <xsl:try>
-              <a xsl:on-empty="$atts"><xsl:sequence select="ITEM/PRICETAG"/></a>
+              <xsl:conditional-content>
+                <a><xsl:sequence select="ITEM/PRICETAG"/></a>
+              </xsl:conditional-content>
+              <xsl:on-empty select="$atts"/>
               <xsl:catch errors="*:XTTE3310">
                 <fallback>OK</fallback>
               </xsl:catch>