Test changes for bug 28774 (shallow-skip)
authorMichael Kay <mike@saxonica.com>
Fri, 12 Jun 2015 13:00:48 +0100
changeset 987 55bdb4168724
parent 986 a8baa54eb4b3
child 988 f87c2cc8d879
Test changes for bug 28774 (shallow-skip)
tests/attr/mode/_mode-test-set.xml
tests/attr/mode/mode-0015.xsl
tests/attr/mode/mode-1420.xsl
tests/attr/mode/mode-1426.xsl
--- a/tests/attr/mode/_mode-test-set.xml	Thu Jun 11 16:00:56 2015 +0100
+++ b/tests/attr/mode/_mode-test-set.xml	Fri Jun 12 13:00:48 2015 +0100
@@ -350,6 +350,23 @@
       </result>
    </test-case>
    
+   <test-case name="mode-0015">
+      <description>Test xsl:mode on-no-match matching elements having attribute nodes. See bug 28774.</description>
+      <keywords>xsl:mode on-no-match-attribute shallow-skip shallow-copy text-only-copy variable-reference namespace-nodes parentless-nodes</keywords>
+      <created by="Michael Kay" on="2015-06-12"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="streaming"/>
+      </dependencies>
+      <test>
+         <stylesheet file="mode-0015.xsl"/>
+         <initial-template name="main"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><c><foo><matched/></foo></c><d><matched/></d><s/></out>]]></assert-xml>
+      </result>
+   </test-case>
+   
    <test-case name="mode-0101">
       <description>Simple test of xsl:apply-templates with mode.</description>
       <keywords>matching-mode</keywords>
@@ -1204,7 +1221,7 @@
    </test-case>
 
    <test-case name="mode-1417">
-      <description>Test xsl:mode on-no-match="discard"</description>
+      <description>Test xsl:mode on-no-match="shallow-skip"</description>
       <keywords>xsl:mode on-no-match-attribute shallow-skip matching-mode</keywords>
       <created by="Michael Kay" on="2012-11-07"/>
       <environment ref="mode-14"/>
@@ -1221,7 +1238,7 @@
    </test-case>
 
    <test-case name="mode-1418">
-      <description>Test xsl:mode on-no-match="discard"; streaming</description>
+      <description>Test xsl:mode on-no-match="shallow-skip"; streaming</description>
       <keywords>xsl:mode on-no-match-attribute streamable shallow-skip matching-mode</keywords>
       <created by="Michael Kay" on="2012-11-07"/>
       <environment ref="mode-14s"/>
@@ -1239,7 +1256,7 @@
    </test-case>
 
    <test-case name="mode-1419">
-      <description>Test xsl:mode on-no-match="discard"</description>
+      <description>Test xsl:mode on-no-match="shallow-skip"</description>
       <keywords>xsl:mode on-no-match-attribute shallow-skip matching-mode xsl:next-match</keywords>
       <created by="Michael Kay" on="2012-11-07"/>
       <environment ref="mode-14"/>
@@ -1256,9 +1273,10 @@
    </test-case>
 
    <test-case name="mode-1420">
-      <description>Test xsl:mode on-no-match="discard"; streaming</description>
+      <description>Test xsl:mode on-no-match="shallow-skip"; streaming</description>
       <keywords>xsl:mode on-no-match-attribute streamable shallow-skip matching-mode xsl:next-match</keywords>
       <created by="Michael Kay" on="2012-11-07"/>
+      <modified by="Michael Kay" on="2015-06-12" change="spec change for bug 28774"/>
       <environment ref="mode-14s"/>
       <dependencies>
          <spec value="XSLT30+"/>
@@ -1269,12 +1287,12 @@
          <initial-mode name="s"/>
       </test>
       <result>
-         <assert-xml><![CDATA[<out>Genesis</out>]]></assert-xml>
+         <assert-xml><![CDATA[<out>Genesis<nr>1</nr><nr>2</nr></out>]]></assert-xml>
       </result>
    </test-case>
 
    <test-case name="mode-1421">
-      <description>Test xsl:mode on-no-match="discard"</description>
+      <description>Test xsl:mode on-no-match="shallow-skip"</description>
       <keywords>xsl:mode on-no-match-attribute shallow-copy shallow-skip matching-mode xsl:next-match non-matching-mode</keywords>
       <created by="Michael Kay" on="2012-11-07"/>
       <environment ref="mode-14"/>
@@ -1291,7 +1309,7 @@
    </test-case>
 
    <test-case name="mode-1422">
-      <description>Test xsl:mode on-no-match="discard"; streaming</description>
+      <description>Test xsl:mode on-no-match="shallow-skip"; streaming</description>
       <keywords>xsl:mode on-no-match-attribute streamable shallow-copy shallow-skip matching-mode non-matching-mode</keywords>
       <created by="Michael Kay" on="2012-11-07"/>
       <environment ref="mode-14s"/>
@@ -1371,7 +1389,7 @@
          <stylesheet file="mode-1426.xsl"/>
       </test>
       <result>
-         <assert>count(/book/chapter/v/c[. = 'error XTDE055 caught']) = 56</assert>
+         <assert>count(/book/chapter/v/c[. = 'error XTDE0555 caught']) = 56</assert>
       </result>
    </test-case>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/attr/mode/mode-0015.xsl	Fri Jun 12 13:00:48 2015 +0100
@@ -0,0 +1,32 @@
+<?xml version="1.0"?> 
+
+<!-- mode-0015 -->
+<!-- Michael Kay -->
+<!-- on-no-match=various, attribute nodes --> 
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  exclude-result-prefixes="xs">
+
+  <xsl:mode name="c" on-no-match="shallow-copy"/> 
+  <xsl:mode name="d" on-no-match="shallow-skip"/>
+  <xsl:mode name="s" on-no-match="text-only-copy"/>
+  
+  <xsl:variable name="temp" as="element()">
+    <foo bar="42"/>
+  </xsl:variable>
+  
+  <xsl:template name="main">
+    <out>
+      <c><xsl:apply-templates select="$temp" mode="c"/></c>
+      <d><xsl:apply-templates select="$temp" mode="d"/></d>
+      <s><xsl:apply-templates select="$temp" mode="s"/></s>
+    </out>
+  </xsl:template>
+  
+  <xsl:template match="@bar" mode="#all">
+    <matched/>
+  </xsl:template>
+  
+    
+</xsl:stylesheet>
\ No newline at end of file
--- a/tests/attr/mode/mode-1420.xsl	Thu Jun 11 16:00:56 2015 +0100
+++ b/tests/attr/mode/mode-1420.xsl	Fri Jun 12 13:00:48 2015 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0"?> 
 
-<!-- mode-onnomatch008s -->
+<!-- mode-1420 -->
 <!-- Michael Kay -->
 <!-- on-no-match="shallow-skip" with streaming --> 
 
@@ -20,6 +20,10 @@
     <xsl:value-of select="."/>
   </xsl:template>
   
+  <xsl:template match="@nr" mode="s">
+    <nr><xsl:value-of select="."/></nr>
+  </xsl:template>
+  
 
     
 </xsl:stylesheet>
\ No newline at end of file
--- a/tests/attr/mode/mode-1426.xsl	Thu Jun 11 16:00:56 2015 +0100
+++ b/tests/attr/mode/mode-1426.xsl	Fri Jun 12 13:00:48 2015 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0"?> 
 
-<!-- mode-onnomatch016s -->
+<!-- mode-1426 -->
 <!-- Michael Kay / mod. by ABr-->
 <!-- on-no-match=fail, failure case, with streaming; the error is caught, and reported back with a motionless construct --> 
 
@@ -29,7 +29,7 @@
                 <xsl:apply-templates />
                 <xsl:catch errors="err:XTDE0555" xmlns:err="http://www.w3.org/2005/xqt-errors"
                     exclude-result-prefixes="err">
-                    <c>error XTDE055 caught</c>
+                    <c>error XTDE0555 caught</c>
                 </xsl:catch>
             </xsl:try>
         </xsl:copy>