Test validation of xsl:result-document with item-separator
authorMichael Kay <mike@saxonica.com>
Tue, 05 Dec 2017 23:11:06 +0000
changeset 1789 7fe5dce7e15e
parent 1788 c74e9fd5a0c0
child 1790 008e4a6227e6
Test validation of xsl:result-document with item-separator
tests/attr/validation/_validation-test-set.xml
tests/attr/validation/validation-0213.xsl
tests/attr/validation/validation-0214.xsl
tests/attr/validation/validation-0215.xsl
--- a/tests/attr/validation/_validation-test-set.xml	Tue Dec 05 23:09:29 2017 +0000
+++ b/tests/attr/validation/_validation-test-set.xml	Tue Dec 05 23:11:06 2017 +0000
@@ -673,6 +673,71 @@
          <error code="XTTE1510"/>
       </result>
    </test-case>
+   
+   <test-case name="validation-0213">
+      <description>Test validation of xsl:result-document: no href: output is valid</description>
+      <created by="Michael Kay" on="2017-11-30"/>
+      <environment ref="validation-02"/>
+      <dependencies>
+         <spec value="XSLT20+"/>
+         <feature value="schema_aware"/>
+      </dependencies>
+      <test>
+         <stylesheet file="validation-0213.xsl"/>
+      </test>
+      <result>
+         <all-of>
+            <assert>/*:html/*:head/*:title = 'Index of names'</assert>
+            <assert>/*:html/*:body/*:h1 = 'Index of names'</assert>
+            <assert>/comment() = 'The start'</assert>
+            <assert>/comment() = 'The end'</assert>
+         </all-of>
+      </result>
+   </test-case>
+   
+   <test-case name="validation-0214">
+      <description>Test validation of xsl:result-document: no href: output is invalid because of item-separator</description>
+      <created by="Michael Kay" on="2017-11-30"/>
+      <environment ref="validation-02"/>
+      <dependencies>
+         <spec value="XSLT20+"/>
+         <feature value="schema_aware"/>
+      </dependencies>
+      <test>
+         <stylesheet file="validation-0214.xsl"/>
+      </test>
+      <result>
+         <error code="XTTE1510"/>
+         <!--<all-of>
+            <assert>/*:html/*:head/*:title = 'Index of names'</assert>
+            <assert>/*:html/*:body/*:h1 = 'Index of names'</assert>
+            <assert>/comment() = 'The start'</assert>
+            <assert>/comment() = 'The end'</assert>
+         </all-of>-->
+      </result>
+   </test-case>
+   
+   <test-case name="validation-0215">
+      <description>Test validation=strip of xsl:result-document: no href: item-separator</description>
+      <created by="Michael Kay" on="2017-11-30"/>
+      <environment ref="validation-02"/>
+      <dependencies>
+         <spec value="XSLT20+"/>
+         <feature value="schema_aware"/>
+      </dependencies>
+      <test>
+         <stylesheet file="validation-0215.xsl"/>
+      </test>
+      <result>
+         <all-of>
+            <assert>/*:html/*:head/*:title = 'Index of names'</assert>
+            <assert>/*:html/*:body/*:h1 = 'Index of names'</assert>
+            <assert>/comment() = 'The start'</assert>
+            <assert>/comment() = 'The end'</assert>
+            <assert>/text() = '+++'</assert>
+         </all-of>
+      </result>
+   </test-case>
 
    <test-case name="validation-0301">
       <description>show atomization of type-annotated element nodes</description>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/attr/validation/validation-0213.xsl	Tue Dec 05 23:11:06 2017 +0000
@@ -0,0 +1,52 @@
+<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns="http://www.w3.org/1999/xhtml"
+    exclude-result-prefixes="xs"
+    version="2.0">
+
+    <!-- xsl:result-document validation: no href; valid -->
+    
+    <xsl:output method="xhtml" indent="yes"/>
+    
+    <!-- import the schema for the target XHTML vocabulary -->
+
+  <xsl:import-schema namespace="http://www.w3.org/1999/xhtml"
+    schema-location="xhtml1-transitional.xsd"/>
+
+    <xsl:param name="dir" select="'.'"/>
+
+    <xsl:template match="/">
+        <xsl:result-document validation="strict">
+            <xsl:call-template name="make-index"/>
+        </xsl:result-document>
+    </xsl:template>
+
+    <xsl:template name="make-index">
+        <xsl:comment>The start</xsl:comment>
+        <html>
+            <head>
+                <title>Index of names</title>
+            </head>
+            <body>
+                <h1>Index of names</h1>
+                <xsl:for-each-group select="/*/IndividualRec/IndivName/NamePart[@Level=1]"
+                    group-by=".">
+                    <xsl:sort select="current-grouping-key()"/>
+                    <h2>
+                        <xsl:value-of select="current-grouping-key()"/>
+                    </h2>
+                    <xsl:for-each select="current-group()">
+                        <p>
+                            <xsl:value-of select="ancestor::IndividualRec/IndivName[1]"/>
+                        </p>
+                    </xsl:for-each>
+                </xsl:for-each-group>
+            </body>
+            <xsl:if test="current-date() lt xs:date('1900-01-01')">
+              <body>Two bodies is bad news</body>
+            </xsl:if>
+        </html>
+        <xsl:comment>The end</xsl:comment>
+    </xsl:template>
+
+</xsl:transform>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/attr/validation/validation-0214.xsl	Tue Dec 05 23:11:06 2017 +0000
@@ -0,0 +1,52 @@
+<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns="http://www.w3.org/1999/xhtml"
+    exclude-result-prefixes="xs"
+    version="2.0">
+
+    <!-- xsl:result-document validation: no href; valid -->
+    
+    <xsl:output method="xhtml" indent="yes" item-separator="+++"/>
+    
+    <!-- import the schema for the target XHTML vocabulary -->
+
+  <xsl:import-schema namespace="http://www.w3.org/1999/xhtml"
+    schema-location="xhtml1-transitional.xsd"/>
+
+    <xsl:param name="dir" select="'.'"/>
+
+    <xsl:template match="/">
+        <xsl:result-document validation="strict">
+            <xsl:call-template name="make-index"/>
+        </xsl:result-document>
+    </xsl:template>
+
+    <xsl:template name="make-index">
+        <xsl:comment>The start</xsl:comment>
+        <html>
+            <head>
+                <title>Index of names</title>
+            </head>
+            <body>
+                <h1>Index of names</h1>
+                <xsl:for-each-group select="/*/IndividualRec/IndivName/NamePart[@Level=1]"
+                    group-by=".">
+                    <xsl:sort select="current-grouping-key()"/>
+                    <h2>
+                        <xsl:value-of select="current-grouping-key()"/>
+                    </h2>
+                    <xsl:for-each select="current-group()">
+                        <p>
+                            <xsl:value-of select="ancestor::IndividualRec/IndivName[1]"/>
+                        </p>
+                    </xsl:for-each>
+                </xsl:for-each-group>
+            </body>
+            <xsl:if test="current-date() lt xs:date('1900-01-01')">
+              <body>Two bodies is bad news</body>
+            </xsl:if>
+        </html>
+        <xsl:comment>The end</xsl:comment>
+    </xsl:template>
+
+</xsl:transform>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/attr/validation/validation-0215.xsl	Tue Dec 05 23:11:06 2017 +0000
@@ -0,0 +1,52 @@
+<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns="http://www.w3.org/1999/xhtml"
+    exclude-result-prefixes="xs"
+    version="2.0">
+
+    <!-- xsl:result-document validation: no href; item-separator; valid -->
+    
+    <xsl:output method="xhtml" indent="no" item-separator="+++"/>
+    
+    <!-- import the schema for the target XHTML vocabulary -->
+
+  <xsl:import-schema namespace="http://www.w3.org/1999/xhtml"
+    schema-location="xhtml1-transitional.xsd"/>
+
+    <xsl:param name="dir" select="'.'"/>
+
+    <xsl:template match="/">
+        <xsl:result-document validation="preserve">
+            <xsl:call-template name="make-index"/>
+        </xsl:result-document>
+    </xsl:template>
+
+    <xsl:template name="make-index">
+        <xsl:comment>The start</xsl:comment>
+        <html>
+            <head>
+                <title>Index of names</title>
+            </head>
+            <body>
+                <h1>Index of names</h1>
+                <xsl:for-each-group select="/*/IndividualRec/IndivName/NamePart[@Level=1]"
+                    group-by=".">
+                    <xsl:sort select="current-grouping-key()"/>
+                    <h2>
+                        <xsl:value-of select="current-grouping-key()"/>
+                    </h2>
+                    <xsl:for-each select="current-group()">
+                        <p>
+                            <xsl:value-of select="ancestor::IndividualRec/IndivName[1]"/>
+                        </p>
+                    </xsl:for-each>
+                </xsl:for-each-group>
+            </body>
+            <xsl:if test="current-date() lt xs:date('1900-01-01')">
+              <body>Two bodies is bad news</body>
+            </xsl:if>
+        </html>
+        <xsl:comment>The end</xsl:comment>
+    </xsl:template>
+
+</xsl:transform>