Adding more xsl:on-empty tests
authorabraaksm
Tue, 09 Feb 2016 07:16:23 +0100
changeset 1228 8f2f0982148d
parent 1227 741ceefda514
child 1229 e270be25ddc5
Adding more xsl:on-empty tests
tests/insn/on-empty/_on-empty-test-set.xml
tests/insn/on-empty/on-empty-113.xsl
tests/insn/on-empty/on-empty-113a.xsl
tests/insn/on-empty/on-empty-113b.xsl
tests/insn/on-empty/on-empty-114a.xsl
tests/insn/on-empty/on-empty-114b.xsl
tests/insn/on-empty/on-empty-115a.xsl
tests/insn/on-empty/on-empty-115b.xsl
tests/insn/on-empty/on-empty-115c.xsl
tests/insn/on-empty/on-empty-115d.xsl
tests/insn/on-empty/on-empty-115e.xsl
--- a/tests/insn/on-empty/_on-empty-test-set.xml	Tue Feb 09 07:15:43 2016 +0100
+++ b/tests/insn/on-empty/_on-empty-test-set.xml	Tue Feb 09 07:16:23 2016 +0100
@@ -854,79 +854,130 @@
       </result>
    </test-case>
 
-   <test-case name="on-empty-113">
+   <test-case name="on-empty-113a">
       <description>Test with on-empty, combined with for-each</description>
       <created by="Abel Braaksma" on="2016-01-12"/>
       <dependencies>
          <spec value="XSLT30+"/>
       </dependencies>
       <test>
-         <stylesheet file="on-empty-113.xsl"/>
+         <stylesheet file="on-empty-113a.xsl"/>
       </test>
       <result>
-         <assert-string-value>START-->1  | 3  | 5  | 7  | 9  | 11  | 13  | 15  | 17  | 19  | 21  | 23  | 25  | 27  | 29  | 31  | 33  | 35  | 37  | 39  | 41  | 43  | 45  | 47  | 49  | 51  | 53  | 55  | 57  | 59  | 61  | 63  | 65  | 67  | 69  | 71  | 73  | 75  | 77  | 79  | 81  | 83  | 85  | 87  | 89  | 91  | 93  | 95  | 97  | 99 &lt;-- END |</assert-string-value>
-      </result>
-   </test-case>
-
-
-   <test-case name="on-empty-114">
-      <description>Test with on-empty, nested with variables and significant space</description>
-      <created by="Abel Braaksma" on="2016-01-12"/>
-      <dependencies>
-         <spec value="XSLT30+"/>
-      </dependencies>
-      <test>
-         <stylesheet file="on-empty-111.xsl"/>
-      </test>
-      <result>
-         <assert-xml><![CDATA[<empty><empty>42</empty></empty>]]></assert-xml>
+         <assert-string-value>START-->1|3|5|7|9|11|13|15|17|19|21|23|25|27|29|31|33|35|37|39|41|43|45|47|49|51|53|55|57|59|61|63|65|67|69|71|73|75|77|79|81|83|85|87|89|91|93|95|97|99&lt;-- END</assert-string-value>
       </result>
    </test-case>
    
-   
-   <test-case name="on-empty-115">
-      <description>Test with on-empty, nested with variables and significant space</description>
+   <test-case name="on-empty-113b">
+      <description>Test with on-empty, combined with for-each, subtle variant in spaces generated from the -a version of the test</description>
       <created by="Abel Braaksma" on="2016-01-12"/>
       <dependencies>
          <spec value="XSLT30+"/>
       </dependencies>
       <test>
-         <stylesheet file="on-empty-111.xsl"/>
+         <stylesheet file="on-empty-113b.xsl"/>
       </test>
       <result>
-         <assert-xml><![CDATA[<empty><empty>42</empty></empty>]]></assert-xml>
+         <assert-string-value>START-->1 |3 |5 |7 |9 |11 |13 |15 |17 |19 |21 |23 |25 |27 |29 |31 |33 |35 |37 |39 |41 |43 |45 |47 |49 |51 |53 |55 |57 |59 |61 |63 |65 |67 |69 |71 |73 |75 |77 |79 |81 |83 |85 |87 |89 |91 |93 |95 |97 |99&lt;-- END</assert-string-value>
       </result>
    </test-case>
    
-   
-   <test-case name="on-empty-116">
-      <description>Test with on-empty, nested with variables and significant space</description>
+   <test-case name="on-empty-114a">
+      <description>Test with on-empty, combined with for-each and on-non-empty to test subtle differences in spaces generated</description>
       <created by="Abel Braaksma" on="2016-01-12"/>
       <dependencies>
          <spec value="XSLT30+"/>
       </dependencies>
       <test>
-         <stylesheet file="on-empty-111.xsl"/>
+         <stylesheet file="on-empty-114a.xsl"/>
       </test>
       <result>
-         <assert-xml><![CDATA[<empty><empty>42</empty></empty>]]></assert-xml>
+         <assert-string-value>START-->1 | 3 | 5 | 7 | 9 | 11 | 13 | 15 | 17 | 19 | 21 | 23 | 25 | 27 | 29 | 31 | 33 | 35 | 37 | 39 | 41 | 43 | 45 | 47 | 49 | 51 | 53 | 55 | 57 | 59 | 61 | 63 | 65 | 67 | 69 | 71 | 73 | 75 | 77 | 79 | 81 | 83 | 85 | 87 | 89 | 91 | 93 | 95 | 97 | 99 &lt;-- END</assert-string-value>
       </result>
    </test-case>
    
-   
-   <test-case name="on-empty-117">
-      <description>Test with on-empty, nested with variables and significant space</description>
+   <test-case name="on-empty-114b">
+      <description>Test with on-empty, combined with for-each and on-non-empty to test subtle differences in spaces generated, combare with -a version</description>
       <created by="Abel Braaksma" on="2016-01-12"/>
       <dependencies>
          <spec value="XSLT30+"/>
       </dependencies>
       <test>
-         <stylesheet file="on-empty-111.xsl"/>
+         <stylesheet file="on-empty-114b.xsl"/>
       </test>
       <result>
-         <assert-xml><![CDATA[<empty><empty>42</empty></empty>]]></assert-xml>
+         <assert-string-value>START-->1  |3  |5  |7  |9  |11  |13  |15  |17  |19  |21  |23  |25  |27  |29  |31  |33  |35  |37  |39  |41  |43  |45  |47  |49  |51  |53  |55  |57  |59  |61  |63  |65  |67  |69  |71  |73  |75  |77  |79  |81  |83  |85  |87  |89  |91  |93  |95  |97  |99 &lt;-- END</assert-string-value>
+      </result>
+   </test-case>
+   
+   <test-case name="on-empty-115a">
+      <description>Test with on-empty, nested with variables and significant space in simple content seqtor: xsl:comment</description>
+      <created by="Abel Braaksma" on="2016-01-12"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="on-empty-115a.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<!-- -->]]></assert-xml>
       </result>
    </test-case>
 
+   <test-case name="on-empty-115b">
+      <description>Test with on-empty, nested with variables and significant space in simple content seqtor: xsl:namespace</description>
+      <created by="Abel Braaksma" on="2016-01-12"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="on-empty-115b.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<foo xmlns:bar=" "/>]]></assert-xml>
+      </result>
+   </test-case>
+
+   <test-case name="on-empty-115c">
+      <description>Test with on-empty, nested with variables and significant space in simple content seqtor: xsl:attribute</description>
+      <created by="Abel Braaksma" on="2016-01-12"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="on-empty-115c.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<foo bar=" "/>]]></assert-xml>
+      </result>
+   </test-case>
+
+   <test-case name="on-empty-115d">
+      <description>Test with on-empty, nested with variables and significant space in simple content seqtor: xsl:processing-instruction</description>
+      <created by="Abel Braaksma" on="2016-01-12"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="on-empty-115d.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<?foo ?>]]></assert-xml>
+      </result>
+   </test-case>
+
+   <test-case name="on-empty-115e">
+      <description>Test with on-empty, nested with variables and significant space in simple content seqtor: xsl:value-of (text node)</description>
+      <created by="Abel Braaksma" on="2016-01-12"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="on-empty-115e.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<foo> </foo>]]></assert-xml>
+      </result>
+   </test-case>
 
 </test-set>
--- a/tests/insn/on-empty/on-empty-113.xsl	Tue Feb 09 07:15:43 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-    <!-- basic tests with xsl:on-empty in combination with other constructs -->
-    
-    <xsl:output method="text" />
-  
-    <xsl:template match="/" name="xsl-initial-template">
-        <xsl:for-each select="1 to 100">
-            <xsl:text expand-text="yes">{ if(. = 1) then 'START-->' else ''}</xsl:text>
-            <xsl:sequence select="''" />
-            <xsl:value-of select="if(. mod 2) then . else ''" />
-            <xsl:sequence select="''" />
-            <xsl:sequence select="if(. mod 2) then () else '|'"/>
-            <xsl:text expand-text="yes">{''}</xsl:text>
-            <xsl:text expand-text="yes">{ if(. = 100) then '&lt;-- END' else ''}</xsl:text>
-        </xsl:for-each>
-    </xsl:template>
-
-</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/on-empty/on-empty-113a.xsl	Tue Feb 09 07:16:23 2016 +0100
@@ -0,0 +1,17 @@
+<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <!-- basic tests with xsl:on-empty in combination with other constructs -->
+    
+    <xsl:output method="text" />
+  
+    <xsl:template match="/" name="xsl:initial-template">
+        <xsl:for-each select="1 to 100">
+            <xsl:text expand-text="yes">{ if(. = 1) then 'START-->' else ''}</xsl:text>
+            <xsl:sequence select="''" />
+            <xsl:value-of select="if(. mod 2) then . else ''" />
+            <xsl:text expand-text="yes">{''}</xsl:text>
+            <xsl:text expand-text="yes">{ if(. = 100) then '&lt;-- END' else ''}</xsl:text>
+            <xsl:on-empty select="'|'" />
+        </xsl:for-each>
+    </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/on-empty/on-empty-113b.xsl	Tue Feb 09 07:16:23 2016 +0100
@@ -0,0 +1,17 @@
+<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <!-- basic tests with xsl:on-empty in combination with other constructs -->
+    
+    <xsl:output method="text" />
+  
+    <xsl:template match="/" name="xsl:initial-template">
+        <xsl:for-each select="1 to 100">
+            <xsl:text expand-text="yes">{ if(. = 1) then 'START-->' else ''}</xsl:text>
+            <xsl:sequence select="''" />
+            <xsl:value-of select="if(. mod 2) then . else ''" />
+            <xsl:text expand-text="yes">{''}</xsl:text>
+            <xsl:sequence select="if(. = 100) then '&lt;-- END' else ''" />
+            <xsl:on-empty select="'|'" />
+        </xsl:for-each>
+    </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/on-empty/on-empty-114a.xsl	Tue Feb 09 07:16:23 2016 +0100
@@ -0,0 +1,18 @@
+<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <!-- basic tests with xsl:on-empty in combination with other constructs -->
+    
+    <xsl:output method="text" />
+  
+    <xsl:template match="/" name="xsl:initial-template">
+        <xsl:for-each select="1 to 100">
+            <xsl:on-non-empty select="''" />
+            <xsl:text expand-text="yes">{ if(. = 1) then 'START-->' else ''}</xsl:text>
+            <xsl:sequence select="''" />
+            <xsl:value-of select="if(. mod 2) then . else ''" />
+            <xsl:text expand-text="yes">{''}</xsl:text>
+            <xsl:sequence select="if(. = 100) then '&lt;-- END' else ''" />
+            <xsl:on-empty select="'|'" />
+        </xsl:for-each>
+    </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/on-empty/on-empty-114b.xsl	Tue Feb 09 07:16:23 2016 +0100
@@ -0,0 +1,18 @@
+<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <!-- basic tests with xsl:on-empty in combination with other constructs -->
+    
+    <xsl:output method="text" />
+  
+    <xsl:template match="/" name="xsl:initial-template">
+        <xsl:for-each select="1 to 100">
+            <xsl:text expand-text="yes">{ if(. = 1) then 'START-->' else ''}</xsl:text>
+            <xsl:sequence select="''" />
+            <xsl:value-of select="if(. mod 2) then . else ''" />
+            <xsl:text expand-text="yes">{''}</xsl:text>
+            <xsl:sequence select="if(. = 100) then '&lt;-- END' else ''" />
+            <xsl:on-non-empty select="''" />
+            <xsl:on-empty select="'|'" />
+        </xsl:for-each>
+    </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/on-empty/on-empty-115a.xsl	Tue Feb 09 07:16:23 2016 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:math="http://www.w3.org/2005/xpath-functions/math"
+    exclude-result-prefixes="xs math"
+    version="3.0">
+    
+    <xsl:template match="/" name="xsl:initial-template">
+        <xsl:variable name="non-empty">
+            <xsl:sequence select="''" />
+            <xsl:sequence select="''" />
+        </xsl:variable>
+        
+        <xsl:comment>
+            <xsl:copy-of select="$non-empty"/>
+            <xsl:on-empty>WRONG! the document node contains a space, it is not empty!!!</xsl:on-empty>
+        </xsl:comment>
+    </xsl:template>
+    
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/on-empty/on-empty-115b.xsl	Tue Feb 09 07:16:23 2016 +0100
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:math="http://www.w3.org/2005/xpath-functions/math"
+    exclude-result-prefixes="xs math"
+    version="3.0">
+    
+    <xsl:template match="/" name="xsl:initial-template">
+        <xsl:variable name="non-empty">
+            <xsl:sequence select="''" />
+            <xsl:sequence select="''" />
+        </xsl:variable>
+        
+        <foo>
+            <xsl:namespace name="bar">
+                <xsl:copy-of select="$non-empty"/>
+                <xsl:on-empty>WRONG! the document node contains a space, it is not empty!!!</xsl:on-empty>
+            </xsl:namespace>
+        </foo>
+    </xsl:template>
+    
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/on-empty/on-empty-115c.xsl	Tue Feb 09 07:16:23 2016 +0100
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:math="http://www.w3.org/2005/xpath-functions/math"
+    exclude-result-prefixes="xs math"
+    version="3.0">
+    
+    <xsl:template match="/" name="xsl:initial-template">
+        <xsl:variable name="non-empty">
+            <xsl:sequence select="''" />
+            <xsl:sequence select="''" />
+        </xsl:variable>
+        
+        <foo>
+            <xsl:attribute name="bar">
+                <xsl:copy-of select="$non-empty"/>
+                <xsl:on-empty>WRONG! the document node contains a space, it is not empty!!!</xsl:on-empty>
+            </xsl:attribute>
+        </foo>
+    </xsl:template>
+    
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/on-empty/on-empty-115d.xsl	Tue Feb 09 07:16:23 2016 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:math="http://www.w3.org/2005/xpath-functions/math"
+    exclude-result-prefixes="xs math"
+    version="3.0">
+    
+    <xsl:template match="/" name="xsl:initial-template">
+        <xsl:variable name="non-empty">
+            <xsl:sequence select="''" />
+            <xsl:sequence select="''" />
+        </xsl:variable>
+        
+        <xsl:processing-instruction name="foo">
+            <xsl:copy-of select="$non-empty"/>
+            <xsl:on-empty>WRONG! the document node contains a space, it is not empty!!!</xsl:on-empty>
+        </xsl:processing-instruction>
+    </xsl:template>
+    
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/on-empty/on-empty-115e.xsl	Tue Feb 09 07:16:23 2016 +0100
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:math="http://www.w3.org/2005/xpath-functions/math"
+    exclude-result-prefixes="xs math"
+    version="3.0">
+    
+    <xsl:template match="/" name="xsl:initial-template">
+        <xsl:variable name="non-empty">
+            <xsl:sequence select="''" />
+            <xsl:sequence select="''" />
+        </xsl:variable>
+        
+        <foo>
+            <xsl:value-of>
+                <xsl:copy-of select="$non-empty"/>
+                <xsl:on-empty>WRONG! the document node contains a space, it is not empty!!!</xsl:on-empty>
+            </xsl:value-of>
+        </foo>
+    </xsl:template>
+    
+</xsl:stylesheet>
\ No newline at end of file