New xsl:next-match tests, e.g. across package boundaries
authorMichael Kay <mike@saxonica.com>
Thu, 02 Nov 2017 16:14:07 +0000
changeset 1783 b0e20148f68c
parent 1782 e632cdb9a197
child 1784 3390faae04e0
New xsl:next-match tests, e.g. across package boundaries
tests/insn/next-match/_next-match-test-set.xml
tests/insn/next-match/next-match-033.xsl
tests/insn/next-match/next-match-034.xsl
tests/insn/next-match/next-match-035.xsl
tests/insn/next-match/next-match-036-lib.xsl
tests/insn/next-match/next-match-036.xsl
tests/insn/next-match/next-match-037.xsl
--- a/tests/insn/next-match/_next-match-test-set.xml	Thu Nov 02 12:05:40 2017 +0000
+++ b/tests/insn/next-match/_next-match-test-set.xml	Thu Nov 02 16:14:07 2017 +0000
@@ -584,4 +584,86 @@
          <assert-xml><![CDATA[<out>found</out>]]></assert-xml>
       </result>
    </test-case>
+   
+   <test-case name="next-match-033">
+      <description>Test of xsl:next-match and no other matching templates are found. 
+         Verifies that built-in template rules are invoked. Uses explicit on-no-match.</description>
+      <created by="Michael Kay" on="2017-11-02"/>
+      <environment ref="next-match022"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="next-match-033.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><tag><tag>Example of apply-imports</tag></tag><bag><bag>Example of apply-templates</bag></bag></out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="next-match-034">
+      <description>Test of xsl:next-match and no other matching templates are found. 
+         Verifies that built-in template rules are invoked. Uses explicit on-no-match.</description>
+      <created by="Michael Kay" on="2017-11-02"/>
+      <environment ref="next-match022"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="next-match-034.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><tag></tag><bag></bag></out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="next-match-035">
+      <description>Test of xsl:next-match and no other matching templates are found. 
+         Verifies that built-in template rules are invoked. Uses explicit on-no-match.</description>
+      <created by="Michael Kay" on="2017-11-02"/>
+      <environment ref="next-match022"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="next-match-035.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><tag>[Example of apply-imports]</tag><bag>[Example of apply-templates]</bag></out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="next-match-036">
+      <description>Test of xsl:next-match across package boundaries.</description>
+      <created by="Michael Kay" on="2017-11-02"/>
+      <environment ref="next-match022"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <package name="http://xslt-tests/next-match-036-lib" file="next-match-036-lib.xsl" role="secondary"/>
+         <stylesheet file="next-match-036.xsl"/>
+         <initial-mode name="m"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><tag2><tag>Example of apply-imports</tag></tag2><bag>Example of apply-templates</bag></out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="next-match-037">
+      <description>Test of xsl:next-match across package boundaries via call-template.</description>
+      <created by="Michael Kay" on="2017-11-02"/>
+      <environment ref="next-match022"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <package name="http://xslt-tests/next-match-036-lib" file="next-match-036-lib.xsl" role="secondary"/>
+         <stylesheet file="next-match-037.xsl"/>
+         <initial-mode name="m"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><tag2><ttt><tag>[Example of apply-imports]</tag></ttt></tag2><bag>[Example of apply-templates]</bag></out>]]></assert-xml>
+      </result>
+   </test-case>
 </test-set>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/next-match/next-match-033.xsl	Thu Nov 02 16:14:07 2017 +0000
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<t:transform xmlns:t="http://www.w3.org/1999/XSL/Transform" version="3.0">
+   <!-- Purpose: Test of xsl:next-match and no other matching templates are found. 
+  				Verifies that built-in template rules are invoked. 
+            Uses shallow-copy built-in rule-set -->
+   
+   <t:mode on-no-match="shallow-copy"/>
+
+   <t:template match="doc">
+      <out>
+         <t:apply-templates select="*">
+            <t:with-param name="p1" select="'top'"/>
+         </t:apply-templates>
+      </out>
+   </t:template>
+
+   <t:template match="tag">
+      <tag>
+         <t:next-match/>
+      </tag>
+   </t:template>
+
+   <t:template match="bag">
+      <bag>
+         <t:next-match/>
+      </bag>
+   </t:template>
+</t:transform>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/next-match/next-match-034.xsl	Thu Nov 02 16:14:07 2017 +0000
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<t:transform xmlns:t="http://www.w3.org/1999/XSL/Transform" version="3.0">
+   <!-- Purpose: Test of xsl:next-match and no other matching templates are found. 
+  				Verifies that built-in template rules are invoked. 
+            Uses shallow-copy built-in rule-set -->
+   
+   <t:mode on-no-match="deep-skip"/>
+
+   <t:template match="doc">
+      <out>
+         <t:apply-templates select="*">
+            <t:with-param name="p1" select="'top'"/>
+         </t:apply-templates>
+      </out>
+   </t:template>
+
+   <t:template match="tag">
+      <tag>
+         <t:next-match/>
+      </tag>
+   </t:template>
+
+   <t:template match="bag">
+      <bag>
+         <t:next-match/>
+      </bag>
+   </t:template>
+</t:transform>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/next-match/next-match-035.xsl	Thu Nov 02 16:14:07 2017 +0000
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<t:transform xmlns:t="http://www.w3.org/1999/XSL/Transform" version="3.0"
+   expand-text="1">
+   <!-- Purpose: Test of xsl:next-match and no other matching templates are found. 
+  				Verifies that built-in template rules are invoked. 
+            Uses shallow-copy built-in rule-set -->
+   
+   <t:mode on-no-match="shallow-skip"/>
+
+   <t:template match="doc">
+      <out>
+         <t:apply-templates select="*">
+            <t:with-param name="p1" select="'top'"/>
+         </t:apply-templates>
+      </out>
+   </t:template>
+
+   <t:template match="tag">
+      <tag>
+         <t:next-match/>
+      </tag>
+   </t:template>
+
+   <t:template match="bag">
+      <bag>
+         <t:next-match/>
+      </bag>
+   </t:template>
+   
+   <t:template match="text()">[{.}]</t:template>
+</t:transform>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/next-match/next-match-036-lib.xsl	Thu Nov 02 16:14:07 2017 +0000
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<t:package xmlns:t="http://www.w3.org/1999/XSL/Transform" version="3.0"
+   name="http://xslt-tests/next-match-036-lib"
+   expand-text="1" default-mode="m">
+   <!-- Purpose: Current mode selected in a library package does not contain overriding template rules
+   from the using package-->
+   
+   <t:mode name="m" visibility="public"/>
+
+   <t:template match="doc">
+      <out>
+         <t:apply-templates select="*"/>
+      </out>
+   </t:template>
+
+   <t:template match="tag">
+      <tag>
+         <t:next-match/>
+      </tag>
+   </t:template>
+
+   <t:template match="bag">
+      <bag>
+         <t:next-match/>
+      </bag>
+   </t:template>
+   
+</t:package>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/next-match/next-match-036.xsl	Thu Nov 02 16:14:07 2017 +0000
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<t:transform xmlns:t="http://www.w3.org/1999/XSL/Transform" version="3.0"
+   expand-text="1">
+   <!-- Purpose: next-match across package boundaries -->
+   
+   <t:use-package name="http://xslt-tests/next-match-036-lib">
+      <t:override>
+         <t:template match="tag" mode="m">
+            <tag2><t:next-match/></tag2>
+         </t:template>
+      </t:override>
+   </t:use-package>
+      
+   
+
+</t:transform>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/next-match/next-match-037.xsl	Thu Nov 02 16:14:07 2017 +0000
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<t:transform xmlns:t="http://www.w3.org/1999/XSL/Transform" version="3.0"
+   expand-text="1">
+   <!-- Purpose: next-match across package boundaries -->
+   
+   <t:use-package name="http://xslt-tests/next-match-036-lib">
+      <t:override>
+         <t:template match="tag" mode="m">
+            <tag2><t:call-template name="ttt"/></tag2>
+         </t:template>
+         
+         <t:template match="text()" mode="m">[{.}]</t:template>
+      </t:override>
+   </t:use-package>
+   
+   <t:template name="ttt">
+      <ttt><t:next-match/></ttt>
+   </t:template>
+   
+   
+      
+   
+
+</t:transform>