Test that exclude-result-prefix is cumulative, and that it applies to URIs, not to prefixes
authorMichael Kay <mike@saxonica.com>
Fri, 14 Dec 2018 23:36:10 +0000
changeset 1928 9054a2d3f6d0
parent 1927 5d884354c5d5
child 1929 2f9b80ba010e
Test that exclude-result-prefix is cumulative, and that it applies to URIs, not to prefixes
tests/insn/lre/_lre-test-set.xml
tests/insn/lre/lre-027.xsl
tests/insn/lre/lre-028.xsl
--- a/tests/insn/lre/_lre-test-set.xml	Fri Dec 14 23:35:18 2018 +0000
+++ b/tests/insn/lre/_lre-test-set.xml	Fri Dec 14 23:36:10 2018 +0000
@@ -497,6 +497,50 @@
       </result>
    </test-case>
    
+   <test-case name="lre-027">
+      <description>Test that exclude-result-prefixes is cumulative.</description>
+      <created by="Michael Kay" on="2018-12-14"/>
+      <dependencies>
+         <spec value="XSLT20+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="lre-027.xsl"/>
+         <initial-template name="main"/>
+      </test>
+      <result>
+         <all-of>
+            <assert>/out/namespace::four="http://four.com"</assert>
+            <assert>empty(/out/namespace::one)</assert>
+            <assert>empty(/out/namespace::two)</assert>
+            <assert>empty(/out/namespace::three)</assert>
+         </all-of>
+      </result>
+   </test-case>
+   
+   <test-case name="lre-028">
+      <description>Test that exclude-result-prefixes applies to URIs not to prefixes.</description>
+      <created by="Michael Kay" on="2018-12-14"/>
+      <dependencies>
+         <spec value="XSLT20+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="lre-028.xsl"/>
+         <initial-template name="main"/>
+      </test>
+      <result>
+         <all-of>
+            <assert>/out/namespace::one="http://eins.com"</assert>
+            <assert>/out/namespace::four="http://vier.com"</assert>
+            <assert>/out/namespace::quatre="http://four.com"</assert>
+            <assert>empty(/out/namespace::two)</assert>
+            <assert>empty(/out/namespace::three)</assert>
+            <assert>empty(/out/namespace::un)</assert>
+            <assert>empty(/out/namespace::deux)</assert>
+            <assert>empty(/out/namespace::trois)</assert>
+         </all-of>
+      </result>
+   </test-case>
+   
    <test-case name="lre-104">
       <description>LRE with on-empty.</description>
       <created by="Michael Kay" on="2013-07-30"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/lre/lre-027.xsl	Fri Dec 14 23:36:10 2018 +0000
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
+    xmlns:one="http://one.com"
+    xmlns:two="http://two.com"
+    xmlns:three="http://three.com"
+    xmlns:four="http://four.com"
+    exclude-result-prefixes="one">
+
+<?spec xslt#lre-namespaces?>
+    <!-- Purpose: Test that exclude-result-prefixes is cumulative. -->
+
+<xsl:template name="main">
+  <out xsl:exclude-result-prefixes="two three"/>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/lre/lre-028.xsl	Fri Dec 14 23:36:10 2018 +0000
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
+    xmlns:one="http://one.com"
+    xmlns:two="http://two.com"
+    xmlns:three="http://three.com"
+    xmlns:four="http://four.com"
+    exclude-result-prefixes="one two three">
+
+<?spec xslt#lre-namespaces?>
+    <!-- Purpose: Test that exclude-result-prefixes applies to URIs, not to prefixes. -->
+
+<xsl:template name="main"
+    xmlns:one="http://eins.com"
+    xmlns:two="http://zwei.com"
+    xmlns:three="http://drei.com"
+    xmlns:four="http://vier.com"
+    xmlns:un="http://one.com"
+    xmlns:deux="http://two.com"
+    xmlns:trois="http://three.com"
+    xmlns:quatre="http://four.com"
+    >
+  <out xsl:exclude-result-prefixes="two three"/>
+</xsl:template>
+    
+    <xsl:variable name="expected">
+        <out xmlns:one="http://eins.com"
+            xmlns:four="http://vier.com"
+            xmlns:quatre="http://four.com"/>
+    </xsl:variable>
+
+</xsl:stylesheet>