New test case for copying a no-namespace element into a tree with a default namespace on an ancestor element
authorMichael Kay <mike@saxonica.com>
Mon, 03 Sep 2018 00:01:27 +0100
changeset 1884 86f29c06b4b4
parent 1883 af210ed49409
child 1885 c95de77a4228
New test case for copying a no-namespace element into a tree with a default namespace on an ancestor element
tests/type/namespace/_namespace-test-set.xml
tests/type/namespace/namespace-1901.xsl
tests/type/namespace/namespace-19a.xml
tests/type/namespace/namespace-19b.xml
--- a/tests/type/namespace/_namespace-test-set.xml	Mon Sep 03 00:00:40 2018 +0100
+++ b/tests/type/namespace/_namespace-test-set.xml	Mon Sep 03 00:01:27 2018 +0100
@@ -46,6 +46,11 @@
          <content><![CDATA[<doc><a:a xmlns:a="http://a.uri/"> </a:a><b:a xmlns:b="http://b.uri/"> </b:a><A:b xmlns:A="http://a.uri/"> </A:b><B:b xmlns:B="http://b.uri/"> </B:b></doc>]]></content>
       </source>
    </environment>
+   
+   <environment name="namespace-19">
+      <source role="." file="namespace-19a.xml"/>
+      <source file="namespace-19b.xml"/>
+   </environment>
 
    <environment name="namespace-23">
       <source role=".">
@@ -978,6 +983,24 @@
          </all-of>
       </result>
    </test-case>
+   
+   <test-case name="namespace-1901">
+      <description>Test that a no-namespace element copied into a document having a default namespace
+         acquires an xmlns="" undeclaration. Saxon bug 3889.</description>
+      <created by="Michael Kay" on="2018-08-31"/>
+      <environment ref="namespace-19"/>
+      <dependencies>
+         <spec value="XSLT20+"/>
+         <feature value="serialization"/>
+      </dependencies>
+      <test>
+         <stylesheet file="namespace-1901.xsl"/>
+         <output serialize="yes"/>
+      </test>
+      <result>
+         <serialization-matches><![CDATA[<header xmlns=['"]['"]><x>]]></serialization-matches>
+      </result>
+   </test-case>
 
    <test-case name="namespace-2001">
       <description>TEST copied namespace clashing with namespace of parent element Results require
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/type/namespace/namespace-1901.xsl	Mon Sep 03 00:01:27 2018 +0100
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:b="test.com/b"
+    xmlns:c="test.com/c" 
+    exclude-result-prefixes="#all" version="3.0">
+    
+    <xsl:output method="xml" indent="no"/>
+
+    <!-- Test that the no-namespace "header" element is serialized correctly
+         with an xmlns="" undeclaration. Saxon bug 3889 -->
+ 
+    <xsl:template match="/*">
+        <xsl:copy>
+            <xsl:sequence select="doc('namespace-19b.xml')/b:request"/>
+        </xsl:copy>
+    </xsl:template>
+    
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/type/namespace/namespace-19a.xml	Mon Sep 03 00:01:27 2018 +0100
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="test.com/c">
+    <data>DATA</data>
+</form>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/type/namespace/namespace-19b.xml	Mon Sep 03 00:01:27 2018 +0100
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<b:request xmlns:b="test.com/b">
+    <header><x>HEADER</x></header>
+    <b:service>SERVICE</b:service>
+</b:request>