New test for streaming top-level comments and PIs
authorMichael Kay <mike@saxonica.com>
Tue, 29 Aug 2017 21:35:27 +0100
changeset 1750 43e577571d14
parent 1749 8d690566c193
child 1751 8c7f1df6467d
New test for streaming top-level comments and PIs
tests/attr/streamable/_streamable-test-set.xml
tests/attr/streamable/streamable-145.xml
tests/attr/streamable/streamable-145.xsl
--- a/tests/attr/streamable/_streamable-test-set.xml	Tue Aug 29 21:34:50 2017 +0100
+++ b/tests/attr/streamable/_streamable-test-set.xml	Tue Aug 29 21:35:27 2017 +0100
@@ -2775,4 +2775,29 @@
       </result>
    </test-case>
    
+   <test-case name="streamable-145">
+      <description>Copy comments and PI children of the document node</description>
+      <created by="Michael Kay after Martin Honnen" on="2017-08-21"/>
+      <environment>
+         <source role="." file="streamable-145.xml" streaming="true"/>
+      </environment>
+      <test>
+         <stylesheet file="streamable-145.xsl"/>
+      </test>
+      <result>
+         <all-of>
+            <assert>/processing-instruction(pi) = 'a'</assert>
+            <assert>/comment() = ' comment 1 '</assert>
+            <assert>/root/processing-instruction(pi) = 'b'</assert>
+            <assert>/root/comment() = ' comment 2 '</assert>
+            <assert>/root/items/processing-instruction(pi) = 'c'</assert>
+            <assert>/root/items/comment() = ' comment 3 '</assert>
+            <assert>/root/processing-instruction(pi) = 'd'</assert>
+            <assert>/root/comment() = ' comment 4 '</assert>
+            <assert>/processing-instruction(pi) = 'e'</assert>
+            <assert>/comment() = ' comment 5 '</assert>
+         </all-of>
+      </result>
+   </test-case>
+   
 </test-set>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/attr/streamable/streamable-145.xml	Tue Aug 29 21:35:27 2017 +0100
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?pi a?>
+<!-- comment 1 -->
+<root>
+    <?pi b?>
+    <!-- comment 2 -->
+    <items>
+        <?pi c?>
+        <!-- comment 3 -->
+        <item>a</item>
+        <item>b</item>
+    </items>
+    <?pi d?>
+    <!-- comment 4 -->
+</root>
+<?pi e?>
+<!-- comment 5 -->
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/attr/streamable/streamable-145.xsl	Tue Aug 29 21:35:27 2017 +0100
@@ -0,0 +1,12 @@
+<?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:math="http://www.w3.org/2005/xpath-functions/math" 
+    exclude-result-prefixes="xs math" 
+    version="3.0">
+    
+    <xsl:param name="STREAMABLE" static="yes" as="xs:boolean" select="true()"/>
+    
+    <xsl:mode _streamable="{$STREAMABLE}" on-no-match="shallow-copy"/>
+    
+</xsl:stylesheet>
\ No newline at end of file