Create a variant of existing next-match tests
authorMichael Kay <mike@saxonica.com>
Tue, 08 Aug 2017 17:50:43 +0100
changeset 1732 b799292c156f
parent 1731 c49bbc54d5cc
child 1733 09ec9af1b442
Create a variant of existing next-match tests
tests/decl/import/_import-test-set.xml
tests/decl/import/import-2201.xsl
tests/decl/import/import-2201a.xsl
tests/decl/import/import-2202.xsl
tests/decl/import/import-2202a.xsl
--- a/tests/decl/import/_import-test-set.xml	Tue Aug 08 17:49:12 2017 +0100
+++ b/tests/decl/import/_import-test-set.xml	Tue Aug 08 17:50:43 2017 +0100
@@ -789,9 +789,7 @@
          <stylesheet file="import-2201a.xsl" role="secondary"/>
       </test>
       <result>
-         <assert-xml><![CDATA[<out>
-  <wrap><wrap><wrap><wrap><wrap><wrap>Original content</wrap></wrap></wrap></wrap></wrap></wrap>
-</out>]]></assert-xml>
+         <assert-xml><![CDATA[<out a="23" glob="93.7"><wrap><wrap><wrap><wrap><wrap><wrap>Original content</wrap></wrap></wrap></wrap></wrap></wrap></out>]]></assert-xml>
       </result>
    </test-case>
 
--- a/tests/decl/import/import-2201.xsl	Tue Aug 08 17:49:12 2017 +0100
+++ b/tests/decl/import/import-2201.xsl	Tue Aug 08 17:50:43 2017 +0100
@@ -1,22 +1,27 @@
 <?xml version="1.0"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
 
-    <!-- Purpose: See what happens to next-match when multiple imports of the same stylesheet
-       module occur. -->
+  <!-- Purpose: See what happens to next-match when multiple imports of the same stylesheet
+       module occur. Also tests that named templates, attribute sets, and global variables can exist
+       in modules imported multiple times -->
 
-<xsl:import href="import-2201a.xsl"/>
-<xsl:import href="import-2201a.xsl"/>
-<xsl:import href="import-2201a.xsl"/>
-<xsl:import href="import-2201a.xsl"/>
-<xsl:import href="import-2201a.xsl"/>
-<xsl:import href="import-2201a.xsl"/>
+  <xsl:import href="import-2201a.xsl"/>
+  <xsl:import href="import-2201a.xsl"/>
+  <xsl:import href="import-2201a.xsl"/>
+  <xsl:import href="import-2201a.xsl"/>
+  <xsl:import href="import-2201a.xsl"/>
+  <xsl:import href="import-2201a.xsl"/>
 
-<xsl:output method="xml" encoding="UTF-8" indent="no"/>
+  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
+  <xsl:strip-space elements="*"/>
 
-<xsl:template match="doc">
-  <out>
-    <xsl:apply-templates/>
-  </out>
-</xsl:template>
+  <xsl:template match="doc">
+    <out xsl:use-attribute-sets="aset" glob="{$glob}">
+      <xsl:call-template name="named">
+        <xsl:with-param name="p" select="42"/>
+      </xsl:call-template>
+      <xsl:apply-templates/>
+    </out>
+  </xsl:template>
 
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
--- a/tests/decl/import/import-2201a.xsl	Tue Aug 08 17:49:12 2017 +0100
+++ b/tests/decl/import/import-2201a.xsl	Tue Aug 08 17:50:43 2017 +0100
@@ -1,10 +1,21 @@
 <?xml version="1.0"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
 
-<xsl:template match="p">
-  <wrap>
-    <xsl:next-match/>
-  </wrap>
-</xsl:template>
+  <xsl:template match="p">
+    <wrap>
+      <xsl:next-match/>
+    </wrap>
+  </xsl:template>
 
-</xsl:stylesheet>
\ No newline at end of file
+  <xsl:template name="named">
+    <xsl:param name="p" required="yes"/>
+    <xsl:sequence select="$p[852]"/>
+  </xsl:template>
+
+  <xsl:attribute-set name="aset">
+    <xsl:attribute name="a" select="23"/>
+  </xsl:attribute-set>
+
+  <xsl:variable name="glob" select="93.7"/>
+
+</xsl:stylesheet>
--- a/tests/decl/import/import-2202.xsl	Tue Aug 08 17:49:12 2017 +0100
+++ b/tests/decl/import/import-2202.xsl	Tue Aug 08 17:50:43 2017 +0100
@@ -4,12 +4,12 @@
     <!-- Purpose: See what happens to next-match when multiple includes of the same stylesheet
        module occur. (Recoverable error) -->
 
-<xsl:include href="import-2201a.xsl"/>
-<xsl:include href="import-2201a.xsl"/>
-<xsl:include href="import-2201a.xsl"/>
-<xsl:include href="import-2201a.xsl"/>
-<xsl:include href="import-2201a.xsl"/>
-<xsl:include href="import-2201a.xsl"/>
+<xsl:include href="import-2202a.xsl"/>
+<xsl:include href="import-2202a.xsl"/>
+<xsl:include href="import-2202a.xsl"/>
+<xsl:include href="import-2202a.xsl"/>
+<xsl:include href="import-2202a.xsl"/>
+<xsl:include href="import-2202a.xsl"/>
 
 <xsl:output method="xml" encoding="UTF-8" indent="no"/>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/import/import-2202a.xsl	Tue Aug 08 17:50:43 2017 +0100
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
+
+  <xsl:template match="p">
+    <wrap>
+      <xsl:next-match/>
+    </wrap>
+  </xsl:template>
+
+</xsl:stylesheet>