Test xsl:result-document with dynamic format attribute (Saxon bug)
authorMichael Kay <mike@saxonica.com>
Mon, 11 Jan 2016 11:29:56 +0000
changeset 1201 5fe86a4739be
parent 1200 6da4ce1bab22
child 1202 8215c06f7661
child 1205 58927760170e
Test xsl:result-document with dynamic format attribute (Saxon bug)
tests/insn/result-document/_result-document-test-set.xml
tests/insn/result-document/result-document-0285.xsl
--- a/tests/insn/result-document/_result-document-test-set.xml	Mon Jan 11 11:29:28 2016 +0000
+++ b/tests/insn/result-document/_result-document-test-set.xml	Mon Jan 11 11:29:56 2016 +0000
@@ -1729,6 +1729,33 @@
         </all-of> 
       </result>
    </test-case>
+   
+   <test-case name="result-document-0285">
+      <description>Test AVT in the @format attribute of an xsl:result-document. (Saxon bug 2559)</description>
+      <created by="Michael Kay" on="2016-01-06"/>
+      <environment>
+         <source role=".">
+            <content><![CDATA[<doc><foo>text</foo></doc>]]></content>
+         </source>
+      </environment>
+      <dependencies>
+         <spec value="XSLT20+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="result-document-0285.xsl"/>
+         <output serialize="yes" tree="no"/>
+      </test>
+      <result>
+         <all-of>
+            <assert-result-document uri="out1.xml">
+               <serialization-matches><![CDATA[^<out><doc>]]></serialization-matches>
+            </assert-result-document>
+            <assert-result-document uri="out2.xml">
+               <serialization-matches><![CDATA[^<\?xml.+<out>\s+<doc>.+]]></serialization-matches>
+            </assert-result-document>
+         </all-of>
+      </result>
+   </test-case>
 
    <test-case name="result-document-0301">
       <description>Test AVT in the @method of an xsl:result-document.</description>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/result-document/result-document-0285.xsl	Mon Jan 11 11:29:56 2016 +0000
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
+  xmlns:z="http://example.com/z">
+
+  <!-- Purpose: Dynamic @format attribute -->
+
+  <xsl:output name="format1" method="xml" omit-xml-declaration="yes" indent="no"/>
+  <xsl:output name="format2" method="xml" omit-xml-declaration="no" indent="yes"/>
+
+  <xsl:template match="/">
+    <xsl:variable name="source" select="."/>
+    <xsl:for-each select="1 to 2">
+      <xsl:result-document href="out{.}.xml" format="format{.}">
+        <out><xsl:copy-of select="$source"/></out>
+      </xsl:result-document>
+    </xsl:for-each>
+  </xsl:template>
+</xsl:transform>