Add some new namespace-alias tests
authorMichael Kay <mike@saxonica.com>
Sat, 02 Feb 2019 20:25:08 +0000
changeset 1954 003b45edc3e9
parent 1953 c7dd49276623
child 1955 df4636738305
Add some new namespace-alias tests
tests/decl/namespace-alias/_namespace-alias-test-set.xml
tests/decl/namespace-alias/namespace-alias-1003.xsl
tests/decl/namespace-alias/namespace-alias-1004.xsl
tests/decl/namespace-alias/namespace-alias-1005.xsl
tests/decl/namespace-alias/namespace-alias-1006.xsl
tests/decl/namespace-alias/namespace-alias-1901.xsl
--- a/tests/decl/namespace-alias/_namespace-alias-test-set.xml	Sat Feb 02 20:24:33 2019 +0000
+++ b/tests/decl/namespace-alias/_namespace-alias-test-set.xml	Sat Feb 02 20:25:08 2019 +0000
@@ -132,11 +132,75 @@
       </result>
    </test-case>
 
+   <test-case name="namespace-alias-1003">
+      <description>Test multiple namespace-alias declarations with namespaces declared locally</description>
+      <created by="Michael Kay" on="2019-01-23"/>
+      <environment ref="namespace-alias-10"/>
+      <dependencies>
+         <spec value="XSLT10+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="namespace-alias-1003.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><A:v xmlns:A="http://A.com/"/><B:w xmlns:B="http://B.com/"
+            /><C:x xmlns:C="http://C.com/"/><D:y xmlns:D="http://D.com/"/><E:z xmlns:E="http://E.com/"/></out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="namespace-alias-1004">
+      <description>Test multiple namespace-alias declarations with the same target; namespaces declared locally</description>
+      <created by="Michael Kay" on="2019-01-23"/>
+      <environment ref="namespace-alias-10"/>
+      <dependencies>
+         <spec value="XSLT10+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="namespace-alias-1004.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><A:v xmlns:A="http://A.com/"/><B:w xmlns:B="http://A.com/"
+            /><C:x xmlns:C="http://A.com/"/><D:y xmlns:D="http://A.com/"/><E:z xmlns:E="http://A.com/"/></out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="namespace-alias-1005">
+      <description>Test multiple namespace-alias declarations with the same target prefix and URI</description>
+      <created by="Michael Kay" on="2019-01-23"/>
+      <environment ref="namespace-alias-10"/>
+      <dependencies>
+         <spec value="XSLT10+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="namespace-alias-1005.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><A:v xmlns:A="http://A.com/"/><A:w xmlns:A="http://A.com/"
+            /><A:x xmlns:A="http://A.com/"/><A:y xmlns:A="http://A.com/"/><A:z xmlns:A="http://A.com/"/></out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="namespace-alias-1006">
+      <description>A circular chain of namespace aliases</description>
+      <created by="Michael Kay" on="2019-01-23"/>
+      <environment ref="namespace-alias-10"/>
+      <dependencies>
+         <spec value="XSLT10+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="namespace-alias-1006.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><b:v xmlns:b="http://b.com/"/><c:w xmlns:c="http://c.com/"
+            /><d:x xmlns:d="http://d.com/"/><e:y xmlns:e="http://e.com/"/><a:z xmlns:a="http://a.com/"/></out>]]></assert-xml>
+      </result>
+   </test-case>
 
    <test-case name="namespace-alias-1901">
       <description>TEST xsl:namespace-alias - stylesheet-prefix="#default"</description>
       <created by="Michael Kay" on="2012-11-07"/>
       <modified by="Michael Kay" on="2012-12-11" change="deleted xml:space=preserve - see bug 20270"/>
+      <modified by="Michael Kay" on="2019-01-24" change="see discussion in W3C bug 30397"/>
       <environment ref="namespace-alias-19"/>
       <dependencies>
          <spec value="XSLT20+"/>
@@ -198,7 +262,7 @@
    </test-case>
 
    <test-case name="namespace-alias-1905">
-      <description/>
+      <description>Alias the XML namespace</description>
       <created by="Michael Kay" on="2012-11-07"/>
       <environment ref="namespace-alias-19"/>
       <dependencies>
@@ -317,7 +381,9 @@
    </test-case>
 
    <test-case name="namespace-alias-4701">
-      <description>Purpose: Test basic functionality of namespace-alias. Where XSL elements are created by using Literal Result Elements. namespace24 is very similar, but it creates the axsl:stylesheet element via xsl:element.</description>
+      <description>Purpose: Test basic functionality of namespace-alias. 
+         Where XSL elements are created by using Literal Result Elements. 
+         namespace24 is very similar, but it creates the axsl:stylesheet element via xsl:element.</description>
       <created by="Michael Kay" on="2012-11-07"/>
       <environment ref="namespace-alias-47"/>
       <dependencies>
@@ -347,7 +413,7 @@
    </test-case>
 
    <test-case name="namespace-alias-5801">
-      <description>namespace35</description>
+      <description>Another test for aliasing the XSL namespace</description>
       <created by="Michael Kay" on="2012-11-07"/>
       <environment>
          <source role=".">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/namespace-alias/namespace-alias-1003.xsl	Sat Feb 02 20:25:08 2019 +0000
@@ -0,0 +1,24 @@
+<xsl:stylesheet version="2.0" 
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+	
+	<!-- Aliases for multiple namespaces; namespace declarations defined locally -->
+	<?spec xslt#namespace-aliasing?>
+
+
+	<xsl:namespace-alias stylesheet-prefix="a" result-prefix="A" xmlns:a="http://a.com/" xmlns:A="http://A.com/"/>
+	<xsl:namespace-alias stylesheet-prefix="b" result-prefix="B" xmlns:b="http://b.com/" xmlns:B="http://B.com/"/>
+	<xsl:namespace-alias stylesheet-prefix="c" result-prefix="C" xmlns:c="http://c.com/" xmlns:C="http://C.com/"/>
+	<xsl:namespace-alias stylesheet-prefix="d" result-prefix="D" xmlns:d="http://d.com/" xmlns:D="http://D.com/"/>
+	<xsl:namespace-alias stylesheet-prefix="e" result-prefix="E" xmlns:e="http://e.com/" xmlns:E="http://E.com/"/>
+	
+    <xsl:output method="xml"/>
+	<xsl:template match="/">
+		<out>
+			<v xmlns="http://a.com/"/>
+			<w xmlns="http://b.com/"/>
+			<x xmlns="http://c.com/"/>
+			<y xmlns="http://d.com/"/>
+			<z xmlns="http://e.com/"/>
+		</out>
+	</xsl:template>
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/namespace-alias/namespace-alias-1004.xsl	Sat Feb 02 20:25:08 2019 +0000
@@ -0,0 +1,24 @@
+<xsl:stylesheet version="2.0" 
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+	
+	<!-- Aliases for multiple namespaces with the same target; namespace declarations defined locally -->
+	<?spec xslt#namespace-aliasing?>
+
+
+	<xsl:namespace-alias stylesheet-prefix="a" result-prefix="A" xmlns:a="http://a.com/" xmlns:A="http://A.com/"/>
+	<xsl:namespace-alias stylesheet-prefix="b" result-prefix="B" xmlns:b="http://b.com/" xmlns:B="http://A.com/"/>
+	<xsl:namespace-alias stylesheet-prefix="c" result-prefix="C" xmlns:c="http://c.com/" xmlns:C="http://A.com/"/>
+	<xsl:namespace-alias stylesheet-prefix="d" result-prefix="D" xmlns:d="http://d.com/" xmlns:D="http://A.com/"/>
+	<xsl:namespace-alias stylesheet-prefix="e" result-prefix="E" xmlns:e="http://e.com/" xmlns:E="http://A.com/"/>
+	
+    <xsl:output method="xml"/>
+	<xsl:template match="/">
+		<out>
+			<v xmlns="http://a.com/"/>
+			<w xmlns="http://b.com/"/>
+			<x xmlns="http://c.com/"/>
+			<y xmlns="http://d.com/"/>
+			<z xmlns="http://e.com/"/>
+		</out>
+	</xsl:template>
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/namespace-alias/namespace-alias-1005.xsl	Sat Feb 02 20:25:08 2019 +0000
@@ -0,0 +1,24 @@
+<xsl:stylesheet version="2.0" 
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+	
+	<!-- Aliases for multiple namespaces with the same target prefix and URI -->
+	<?spec xslt#namespace-aliasing?>
+
+
+	<xsl:namespace-alias stylesheet-prefix="a" result-prefix="A" xmlns:a="http://a.com/" xmlns:A="http://A.com/"/>
+	<xsl:namespace-alias stylesheet-prefix="b" result-prefix="A" xmlns:b="http://b.com/" xmlns:A="http://A.com/"/>
+	<xsl:namespace-alias stylesheet-prefix="c" result-prefix="A" xmlns:c="http://c.com/" xmlns:A="http://A.com/"/>
+	<xsl:namespace-alias stylesheet-prefix="d" result-prefix="A" xmlns:d="http://d.com/" xmlns:A="http://A.com/"/>
+	<xsl:namespace-alias stylesheet-prefix="e" result-prefix="A" xmlns:e="http://e.com/" xmlns:A="http://A.com/"/>
+	
+    <xsl:output method="xml"/>
+	<xsl:template match="/">
+		<out>
+			<v xmlns="http://a.com/"/>
+			<w xmlns="http://b.com/"/>
+			<x xmlns="http://c.com/"/>
+			<y xmlns="http://d.com/"/>
+			<z xmlns="http://e.com/"/>
+		</out>
+	</xsl:template>
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/namespace-alias/namespace-alias-1006.xsl	Sat Feb 02 20:25:08 2019 +0000
@@ -0,0 +1,24 @@
+<xsl:stylesheet version="2.0" 
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+	
+	<!-- A circular chain of namespace aliases -->
+	<?spec xslt#namespace-aliasing?>
+
+
+	<xsl:namespace-alias stylesheet-prefix="a" result-prefix="b" xmlns:a="http://a.com/" xmlns:b="http://b.com/"/>
+	<xsl:namespace-alias stylesheet-prefix="b" result-prefix="c" xmlns:b="http://b.com/" xmlns:c="http://c.com/"/>
+	<xsl:namespace-alias stylesheet-prefix="c" result-prefix="d" xmlns:c="http://c.com/" xmlns:d="http://d.com/"/>
+	<xsl:namespace-alias stylesheet-prefix="d" result-prefix="e" xmlns:d="http://d.com/" xmlns:e="http://e.com/"/>
+	<xsl:namespace-alias stylesheet-prefix="e" result-prefix="a" xmlns:e="http://e.com/" xmlns:a="http://a.com/"/>
+	
+    <xsl:output method="xml"/>
+	<xsl:template match="/">
+		<out>
+			<v xmlns="http://a.com/"/>
+			<w xmlns="http://b.com/"/>
+			<x xmlns="http://c.com/"/>
+			<y xmlns="http://d.com/"/>
+			<z xmlns="http://e.com/"/>
+		</out>
+	</xsl:template>
+</xsl:stylesheet>
--- a/tests/decl/namespace-alias/namespace-alias-1901.xsl	Sat Feb 02 20:24:33 2019 +0000
+++ b/tests/decl/namespace-alias/namespace-alias-1901.xsl	Sat Feb 02 20:25:08 2019 +0000
@@ -1,6 +1,7 @@
 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
 	<!-- TEST xsl:namespace-alias - stylesheet-prefix="#default" -->
+	<!-- See W3C bug 39307 for discussion of whether the result should be version="1.0" or xsl:version="1.0" -->
 
 	<xsl:import href="namespace-alias-1002a.xsl"/>