New tests for item-separator
authorMichael Kay <mike@saxonica.com>
Tue, 05 Dec 2017 23:08:26 +0000
changeset 1787 6e4397bf2f98
parent 1786 600f360051be
child 1788 c74e9fd5a0c0
New tests for item-separator
tests/insn/result-document/_result-document-test-set.xml
tests/insn/result-document/result-document-0305.xsl
tests/insn/result-document/result-document-1408.xsl
--- a/tests/insn/result-document/_result-document-test-set.xml	Mon Nov 13 14:29:41 2017 +0000
+++ b/tests/insn/result-document/_result-document-test-set.xml	Tue Dec 05 23:08:26 2017 +0000
@@ -1918,6 +1918,27 @@
          <assert-serialization method="adaptive"><![CDATA[map{"a":22}|<elem/>|a="5"]]></assert-serialization>  
       </result>
    </test-case>
+   
+   <test-case name="result-document-0305">
+      <description>With xsl:result-document, override item-separator specifying #absent</description>
+      <created by="Michael Kay" on="2017-12-05"/>
+      <environment>
+         <source role=".">
+            <content><![CDATA[<doc><foo>text</foo></doc>]]></content>
+         </source>
+      </environment>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="serialization" satisfied="true"/>
+      </dependencies>
+      <test>
+         <stylesheet file="result-document-0305.xsl"/>
+         <output serialize="yes"/>
+      </test>
+      <result>
+         <assert-serialization method="text"><![CDATA[<!--begin-->1 2<!--end-->]]></assert-serialization>
+      </result>
+   </test-case>
 
    <test-case name="result-document-0401">
       <description>Test AVT in @cdata-section-elements of xsl:result-document.</description>
@@ -2831,6 +2852,24 @@
       </result>
    </test-case>
    
+   <test-case name="result-document-1408">
+      <description>Serialization with item-separator outputting nodes</description>
+      <created by="Michael Kay" on="2017-12-05"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="serialization" satisfied="true"/>
+      </dependencies>
+      <test>
+         <stylesheet file="result-document-1408.xsl"/>
+         <output serialize="yes" tree="no"/>
+      </test>
+      <result>
+         <all-of>
+            <serialization-matches><![CDATA[<!--start-->~11~12~13~14~15~<!--middle-->~16~17~18~19~20~<!--end-->$]]></serialization-matches>          
+         </all-of>
+      </result>
+   </test-case>
+   
    <test-case name="result-document-1501">
       <description>xsl:result-document within xsl:analyze-string</description>
       <created by="Michael Kay" on="2016-12-21"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/result-document/result-document-0305.xsl	Tue Dec 05 23:08:26 2017 +0000
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
+<!-- Purpose: build-tree=no on xsl:result-document.-->
+   
+   <xsl:output name="f" item-separator="|" omit-xml-declaration="yes"/>
+
+   <xsl:template match="/">
+      <xsl:result-document build-tree="no" format="f" item-separator="#absent" method="xml">
+         <xsl:comment>begin</xsl:comment>
+         <xsl:sequence select="1 to count(//*)"/>
+         <xsl:comment>end</xsl:comment>
+      </xsl:result-document>
+   </xsl:template>
+</xsl:transform>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/result-document/result-document-1408.xsl	Tue Dec 05 23:08:26 2017 +0000
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:transform xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+   version="3.0">
+
+   <xsl:param name="twiddle" select="'~'"/>
+
+   <!-- Purpose: Test serialization with item separator, outputting nodes -->
+
+   <xsl:template name="xsl:initial-template">
+      <xsl:result-document method="xml" indent="no" item-separator="{$twiddle}">
+         <xsl:comment>start</xsl:comment>
+         <xsl:sequence select="11 to 15"/>
+         <xsl:comment>middle</xsl:comment>
+         <xsl:sequence select="16 to 20"/>
+         <xsl:comment>end</xsl:comment>
+      </xsl:result-document>
+   </xsl:template>
+</xsl:transform>