Add tests for EQName-based syntax in xsl:strip-space
authorMichael Kay <mike@saxonica.com>
Sat, 02 Feb 2019 20:26:04 +0000
changeset 1955 df4636738305
parent 1954 003b45edc3e9
child 1956 4624e4c75d67
Add tests for EQName-based syntax in xsl:strip-space
tests/decl/strip-space/_strip-space-test-set.xml
tests/decl/strip-space/strip-space-025.xsl
tests/decl/strip-space/strip-space-026.xsl
tests/decl/strip-space/strip-space-027.xsl
tests/decl/strip-space/strip-space-028.xsl
--- a/tests/decl/strip-space/_strip-space-test-set.xml	Sat Feb 02 20:25:08 2019 +0000
+++ b/tests/decl/strip-space/_strip-space-test-set.xml	Sat Feb 02 20:26:04 2019 +0000
@@ -645,4 +645,91 @@
          </all-of>
       </result>
    </test-case>
+   
+   <test-case name="strip-space-025">
+      <description>
+         Test EQNames in strip-space
+      </description>
+      <created by="Michael Kay" on="2019-01-25"/>
+      <environment ref="strip-space-07"/>
+      <dependencies>
+         <spec value="XSLT10+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="strip-space-025.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out>ab
+       c
+       d
+  </out>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="strip-space-026">
+      <description>
+         no confict reported in 2.0 if there are two identical strip-space or
+         preserve-space declarations (using EQName syntax)
+      </description>
+      <created by="Michael Kay" on="2019-01-25"/>
+      <environment ref="strip-space-17"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="strip-space-026.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<document><section/><section/><section/></document>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="strip-space-027">
+      <description>
+         Test import precedence for xsl:strip-space using EQName syntax
+      </description>
+      <created by="Michael Kay" on="2012-11-07"/>
+      <environment>
+         <source role=".">
+            <content><![CDATA[<abc:doc xmlns:abc="http://abc.uri/">
+<abc:w>   </abc:w>
+<abc:x>   </abc:x>
+<abc:y>   </abc:y>
+<abc:z>   </abc:z>
+<q>    </q>
+</abc:doc>]]></content>
+         </source>
+      </environment>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="strip-space-027.xsl"/>
+         <stylesheet file="strip-space-020a.xsl" role="secondary"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<abc:doc xmlns:abc="http://abc.uri/"><abc:w>   </abc:w><abc:x/><abc:y/><abc:z/><q>    </q></abc:doc>]]></assert-xml>
+      </result>
+   </test-case>
+   
+   <test-case name="strip-space-028">
+      <description>
+         Two conflicting xsl:strip-space/preserve-space declarations (static error in XSLT 3.0)
+      </description>
+      <created by="Michael Kay" on="2019-01-25"/>
+      <environment>
+         <source role=".">
+            <content><![CDATA[<doc><a> </a><b> </b><c> </c></doc>]]></content>
+         </source>
+      </environment>
+      <dependencies>
+         <spec value="XSLT30+" />
+      </dependencies>
+      <test>
+         <stylesheet file="strip-space-028.xsl"/>
+      </test>
+      <result>
+         <error code="XTSE0270" />
+      </result>
+   </test-case>
 </test-set>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/strip-space/strip-space-025.xsl	Sat Feb 02 20:26:04 2019 +0000
@@ -0,0 +1,14 @@
+<?xml version="1.0"?> 
+
+<!-- Another Test for white-space -->
+ 
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0">
+  <xsl:strip-space elements="Q{}test1"/>
+  
+  <xsl:template match="doc">
+    <out>
+	    <xsl:apply-templates select="*"/>
+    </out>
+  </xsl:template>
+   
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/strip-space/strip-space-026.xsl	Sat Feb 02 20:26:04 2019 +0000
@@ -0,0 +1,18 @@
+<xsl:stylesheet version="2.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  
+  <!-- no confict reported in 2.0 if there are two 
+       identical strip-space or preserve-space declarations -->
+        <?spec xslt#strip?>
+
+  <xsl:output method="xml" indent="no" />
+
+  <xsl:strip-space elements="document"/>
+  <xsl:strip-space elements="Q{}document"/>
+
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/strip-space/strip-space-027.xsl	Sat Feb 02 20:26:04 2019 +0000
@@ -0,0 +1,13 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
+xmlns:abc="http://abc.uri/">
+
+<!-- Test import precedence for xsl:strip-space -->
+
+<xsl:import href="strip-space-020a.xsl"/>
+    <xsl:strip-space elements="Q{http://abc.uri/}*"/>
+    <xsl:preserve-space elements="Q{http://abc.uri/}w"/>
+
+<xsl:template match="/"><xsl:copy-of select="."/></xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/strip-space/strip-space-028.xsl	Sat Feb 02 20:26:04 2019 +0000
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+
+<!-- test two conflicting xsl:strip-space declarations (recoverable error) --> 
+<?spec xslt#strip?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
+  <xsl:strip-space elements="a b Q{}c"/>
+  <xsl:preserve-space elements="Q{}b"/>
+  <xsl:template match="/"><xsl:copy-of select="."/></xsl:template>
+</xsl:stylesheet>