Test that xsl:namespace-alias operates on namespace URIs not on prefixes
authorMichael Kay <mike@saxonica.com>
Fri, 14 Dec 2018 23:30:06 +0000
changeset 1923 fdb0348dc0cc
parent 1922 4f5c77b4f645
child 1924 5bb7357846d0
Test that xsl:namespace-alias operates on namespace URIs not on prefixes
tests/decl/namespace-alias/_namespace-alias-test-set.xml
tests/decl/namespace-alias/namespace-alias-0903.xsl
--- a/tests/decl/namespace-alias/_namespace-alias-test-set.xml	Fri Dec 14 23:29:05 2018 +0000
+++ b/tests/decl/namespace-alias/_namespace-alias-test-set.xml	Fri Dec 14 23:30:06 2018 +0000
@@ -85,6 +85,21 @@
          <assert-xml><![CDATA[<result xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:attribute/></result>]]></assert-xml>
       </result>
    </test-case>
+   
+   <test-case name="namespace-alias-0903">
+      <description>Prefixes used in xsl:namespace-alias map immediately to a URI</description>
+      <created by="Michael Kay" on="2018-11-20"/>
+      <dependencies>
+         <spec value="XSLT10+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="namespace-alias-0903.xsl"/>
+         <initial-template name="main"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><bar:one xmlns:bar="http://bar1"/><bar:two xmlns:bar="http://bar2"/><bar:three xmlns:bar="http://bar3"/></out>]]></assert-xml>
+      </result>
+   </test-case>
 
    <test-case name="namespace-alias-1001">
       <description>TEST namespace-alias on attribute names BUG Saxon 6.3/013</description>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/namespace-alias/namespace-alias-0903.xsl	Fri Dec 14 23:30:06 2018 +0000
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xxx="http://www.w3.org/1999/XSL/Transform"
+  version="2.0">
+  
+  <!-- Prefixes in xsl:namespace-alias depend on the immediate namespace context -->
+  
+  <xsl:namespace-alias  stylesheet-prefix="foo" result-prefix="bar" xmlns:foo="http://foo1/" xmlns:bar="http://bar1"/>
+  
+  <xsl:namespace-alias  stylesheet-prefix="foo" result-prefix="bar" xmlns:foo="http://foo2/" xmlns:bar="http://bar2"/>
+  
+  <xsl:namespace-alias  stylesheet-prefix="foo" result-prefix="bar" xmlns:foo="http://foo3/" xmlns:bar="http://bar3"/>
+  
+  <xsl:template name="main">
+    <out>
+      <one xmlns="http://foo1/"/>
+      <two xmlns="http://foo2/"/>
+      <three xmlns="http://foo3/"/>
+    </out>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file