New test set for xsl:apply-imports
authorMichael Kay <mike@saxonica.com>
Mon, 25 Jan 2016 10:28:46 +0000
changeset 1213 b62e4ad649b8
parent 1212 a38bdcb0a71e
child 1214 7fd567cafa00
New test set for xsl:apply-imports
catalog.xml
tests/insn/apply-imports/_apply-imports-test-set.xml
tests/insn/apply-imports/apply-imports-001.xsl
tests/insn/apply-imports/apply-imports-001a.xsl
tests/insn/apply-imports/apply-imports-001b.xsl
--- a/catalog.xml	Mon Jan 25 10:28:14 2016 +0000
+++ b/catalog.xml	Mon Jan 25 10:28:46 2016 +0000
@@ -97,6 +97,7 @@
       <!-- Instructions -->
       
       <test-set name="analyze-string" file="tests/insn/analyze-string/_analyze-string-test-set.xml"/>
+      <test-set name="apply-imports" file="tests/insn/apply-imports/_apply-imports-test-set.xml"/>
       <test-set name="apply-templates" file="tests/insn/apply-templates/_apply-templates-test-set.xml"/> 
       <test-set name="assert" file="tests/insn/assert/_assert-test-set.xml"/>
       <test-set name="attribute" file="tests/insn/attribute/_attribute-test-set.xml"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/apply-imports/_apply-imports-test-set.xml	Mon Jan 25 10:28:46 2016 +0000
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<test-set xmlns="http://www.w3.org/2012/10/xslt-test-catalog" xmlns:xs="http://www.w3.org/2001/XMLSchema" name="apply-imports">
+   <description>Tests xsl:apply-imports (note, most of the tests for this are elsewhere, e.g. under "import")</description>
+   <environment name="apply-imports-A">
+      <source role=".">
+         <content><![CDATA[<doc>
+  <foo att1="c">
+    <foo att1="b">
+      <foo att1="a">
+        <baz att1="wrong"/>
+      </foo>
+    </foo>
+  </foo>
+</doc>]]></content>
+      </source>
+   </environment>
+
+   <test-case name="apply-imports-001">
+      <description>Test apply-imports on atomic values.</description>
+      <created by="Michael Kay" on="2016-01-19"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="apply-imports-001.xsl" role="principal"/>
+         <stylesheet file="apply-imports-001b.xsl" role="secondary"/>
+         <stylesheet file="apply-imports-001c.xsl" role="secondary"/>
+      </test>
+      <result>
+         <assert>/out = "R1R2BQ3BQ4AP5"</assert>
+      </result>
+   </test-case>
+
+</test-set>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/apply-imports/apply-imports-001.xsl	Mon Jan 25 10:28:46 2016 +0000
@@ -0,0 +1,27 @@
+<?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:my="my" exclude-result-prefixes="xs my"
+  version="3.0">
+
+
+
+  <xsl:template name="xsl:initial-template">
+    <out>
+      <xsl:apply-templates select="1 to 5"/>
+    </out>
+  </xsl:template>
+
+  <xsl:template match=".[. ge 5]" priority="5">
+    <xsl:text>A</xsl:text>
+    <xsl:apply-imports/>
+  </xsl:template>
+
+  <xsl:template match=".[. ge 3]" priority="3">
+    <xsl:text>B</xsl:text>
+    <xsl:apply-imports/>
+  </xsl:template>
+  
+  <xsl:import href="apply-imports-001a.xsl"/>
+  <xsl:import href="apply-imports-001b.xsl"/>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/apply-imports/apply-imports-001a.xsl	Mon Jan 25 10:28:46 2016 +0000
@@ -0,0 +1,25 @@
+<?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:my="my" exclude-result-prefixes="xs my"
+  version="3.0">
+
+
+
+  <xsl:template name="xsl:initial-template">
+    <out>
+      <xsl:apply-templates select="1 to 5"/>
+    </out>
+  </xsl:template>
+
+  <xsl:template match=".[. ge 5]" priority="5">
+    <xsl:text>X</xsl:text>
+    <xsl:apply-imports/>
+  </xsl:template>
+
+  <xsl:template match=".[. ge 3]" priority="3">
+    <xsl:text>Y</xsl:text>
+    <xsl:apply-imports/>
+  </xsl:template>
+  
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/apply-imports/apply-imports-001b.xsl	Mon Jan 25 10:28:46 2016 +0000
@@ -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:my="my" exclude-result-prefixes="xs my"
+  version="3.0">
+
+
+
+  <xsl:template name="xsl:initial-template">
+    <out>
+      <xsl:apply-templates select="1 to 5"/>
+    </out>
+  </xsl:template>
+
+  <xsl:template match=".[. ge 5]" priority="5">
+    <xsl:text>P</xsl:text>
+    <xsl:apply-imports/>
+  </xsl:template>
+
+  <xsl:template match=".[. ge 3]" priority="3">
+    <xsl:text>Q</xsl:text>
+    <xsl:apply-imports/>
+  </xsl:template>
+  
+  <xsl:template match=".[. ge 1]" priority="1">
+    <xsl:text>R</xsl:text>
+    <xsl:apply-imports/>
+  </xsl:template>
+  
+
+</xsl:stylesheet>