Test xsl:initial-template returning a sequence
authorMichael Kay <mike@saxonica.com>
Mon, 13 Nov 2017 14:29:41 +0000
changeset 1786 600f360051be
parent 1785 99d9c32f0fac
child 1787 6e4397bf2f98
Test xsl:initial-template returning a sequence
tests/misc/initial-template/_initial-template-test-set.xml
tests/misc/initial-template/initial-template-004.xsl
--- a/tests/misc/initial-template/_initial-template-test-set.xml	Mon Nov 13 14:29:09 2017 +0000
+++ b/tests/misc/initial-template/_initial-template-test-set.xml	Mon Nov 13 14:29:41 2017 +0000
@@ -105,6 +105,30 @@
       </result>
    </test-case>
    
+   <test-case name="initial-template-004">
+      <description>test initial-template returning a sequence</description>
+      <created by="Michael Kay" on="2017-11-11"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="initial-template-004.xsl"/>
+         <initial-template name="main"/>
+         <output tree="no" result-var="result"/>
+         <!-- Bug 30196 introduces test driver capability for the query to return a sequence -->
+      </test>
+      <result>
+         <assert>deep-equal($result, (123.5,
+            -18,
+            12.6,
+            14.2,
+            123.6,
+            -56,
+            123.5,
+            123.6))</assert>
+      </result>
+   </test-case>
+   
    <test-case name="initial-template-080">
       <description>A processor that doesn't support backwards compatibility raises no error unless 1.0 code is executed</description>
       <created by="Michael Kay" on="2017-04-29"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/misc/initial-template/initial-template-004.xsl	Mon Nov 13 14:29:41 2017 +0000
@@ -0,0 +1,28 @@
+<?xml version="1.0"?> 
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:my="http://my.net/"
+  exclude-result-prefixes="my xs">
+
+  <!-- PURPOSE test initial-template invocations -->
+  
+  <xsl:param name="a" select="12"/>
+  <xsl:variable name="b" select="$a * 2"/>
+  
+  <xsl:variable name="data" as="element()*">
+    <a id="1">123.5</a>
+    <a id="2">-18</a>
+    <a id="3">12.6</a>
+    <a id="4">14.2</a>
+    <a id="5">123.60</a>
+    <a id="6">-56.0</a>
+    <a id="7">123.5</a>
+    <a id="8">123.6</a>
+  </xsl:variable>
+
+  <xsl:template name="main" as="xs:decimal*">
+    <xsl:sequence select="$data/self::a ! xs:decimal(.)"/>
+  </xsl:template>
+
+ 
+
+</xsl:stylesheet>