One document, two streams reading it
authorMichael Kay <mike@saxonica.com>
Tue, 05 Dec 2017 23:13:57 +0000
changeset 1791 98e61a8aba13
parent 1790 008e4a6227e6
child 1792 df4de18a7be9
One document, two streams reading it
tests/insn/source-document/_source-document-test-set.xml
tests/insn/source-document/stream-207.xsl
--- a/tests/insn/source-document/_source-document-test-set.xml	Tue Dec 05 23:11:56 2017 +0000
+++ b/tests/insn/source-document/_source-document-test-set.xml	Tue Dec 05 23:13:57 2017 +0000
@@ -438,6 +438,23 @@
       </result>
    </test-case>
    
+   <test-case name="stream-207">
+      <description>Same streamed input file as principal input and read using xsl:source-document</description>
+      <created by="Michael Kay" on="2017-11-28"/>
+      <environment>
+         <source role="." file="Psalm100.xml" streaming="true"/>
+      </environment>
+      <test>
+         <stylesheet file="stream-207.xsl"/>
+      </test>
+      <result>
+         <all-of>
+            <assert>count(distinct-values(//@args)) = 1</assert>
+            <assert>count(distinct-values(//@details)) = 12</assert>
+         </all-of>
+      </result>
+   </test-case>
+   
    <test-case name="stream-210">
       <description>xsl:source-document (streamable="yes")  reading the same input file more than once</description>
       <created by="Michael Kay after Martin Honnen" on="2016-02-19"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/source-document/stream-207.xsl	Tue Dec 05 23:13:57 2017 +0000
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="#all"
+    >
+    
+    <xsl:mode streamable="yes"/>
+    
+    <xsl:template match="/">
+        <data>
+            <xsl:for-each select="/*/part-list/score-part">
+                <xsl:variable name="partId" select="string(@id)"/>
+                <xsl:variable name="partName" select="string(part-name[1])"/>
+                <xsl:source-document href="Psalm100.xml" streamable="yes">
+                    <part id="{$partId}" name="{$partName}" measures="{count(//measure[parent::part/@id=$partId])}"/>	
+                </xsl:source-document>
+            </xsl:for-each>
+        </data>     
+    </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file