New attribute-set tests
authorMichael Kay <mike@saxonica.com>
Fri, 20 Mar 2015 14:08:52 +0000
changeset 835 c7ae38f48058
parent 834 965eb9df9b86
child 836 ef3b05bcb835
New attribute-set tests
tests/decl/attribute-set/_attribute-set-test-set.xml
tests/decl/attribute-set/attribute-set-0106.xsl
tests/decl/attribute-set/attribute-set-0107.xsl
--- a/tests/decl/attribute-set/_attribute-set-test-set.xml	Fri Mar 20 14:05:35 2015 +0000
+++ b/tests/decl/attribute-set/_attribute-set-test-set.xml	Fri Mar 20 14:08:52 2015 +0000
@@ -93,6 +93,51 @@
          <assert-xml><![CDATA[<out><test4 color="black" texture="matt"/></out>]]></assert-xml>
       </result>
    </test-case>
+   
+   <test-case name="attribute-set-0106">
+      <description>
+         A terminating recursive attribute set. 
+         (It's not entirely clear whether the spec allows this. It works in Saxon 9.6 but not in 9.7)</description>
+      <keywords>xsl:use-attribute-sets lre </keywords>
+      <created by="Michael Kay" on="2015-03-02"/>
+      <environment ref="attribute-set-01"/>
+      <dependencies>
+         <spec value="XSLT20+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="attribute-set-0106.xsl"/>
+      </test>
+      <result>
+         <any-of>
+            <error code="XTDE0640"/>
+            <assert-xml><![CDATA[<out><test1 color="|matt|matt|matt|matt|matt|matt|matt|matt|matt|matt|matt|matt|matt|matt|matt|matt|matt"
+          texture="matt"/></out>]]></assert-xml>
+         </any-of>   
+      </result>
+   </test-case>
+   
+   <test-case name="attribute-set-0107">
+      <description>Focus-dependent attribute set</description>
+      <keywords>xsl:use-attribute-sets lre </keywords>
+      <created by="Michael Kay" on="2015-03-02"/>
+      <environment ref="attribute-set-01"/>
+      <dependencies>
+         <spec value="XSLT20+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="attribute-set-0107.xsl"/>
+      </test>
+      <result>
+        <assert-xml><![CDATA[<out><section class="section" position="1"
+        /><section class="section" position="2"/><p class="p" position="3"/><p class="p" position="4"
+        /><section class="section" position="5"/><p class="p" position="6"
+        /><section class="section" position="7"/><p class="p" position="8"/><p class="p" position="9"
+        /><section class="section" position="10"/><p class="p" position="11"/><p class="p" position="12"/><p class="p" position="13"
+        /><section class="section" position="14"/><p class="p" position="15"/><p class="p" position="16"/></out>
+]]></assert-xml>  
+      </result>
+   </test-case>
+
 
    <test-case name="attribute-set-0201">
       <description>Set attributes of a LRE from multiple attribute sets.</description>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/attribute-set/attribute-set-0106.xsl	Fri Mar 20 14:08:52 2015 +0000
@@ -0,0 +1,26 @@
+<?xml version="1.0"?> 
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
+
+  <!-- PURPOSE: A terminating recursive attribute set. It's not entirely clear whether the spec allows this. -->
+  <?spec xslt#attribute-sets?>
+
+  <xsl:attribute-set name="set1">
+    <xsl:attribute name="color">
+          <xsl:for-each select="*">
+            <xsl:variable name="x">
+              <e xsl:use-attribute-sets="set1"/>
+            </xsl:variable>
+            <xsl:value-of select="string-join($x//@*, '|')"/>
+          </xsl:for-each>
+    </xsl:attribute>
+    <xsl:attribute name="texture">matt</xsl:attribute>
+  </xsl:attribute-set>
+
+  <xsl:template match="/">
+    <out>
+      <test1 xsl:use-attribute-sets="set1"></test1>
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/attribute-set/attribute-set-0107.xsl	Fri Mar 20 14:08:52 2015 +0000
@@ -0,0 +1,21 @@
+<?xml version="1.0"?> 
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
+
+  <!-- PURPOSE: A focus-dependent attribute set. (Fails in Saxon because of incorrect loop-lifting) -->
+  <?spec xslt#attribute-sets?>
+
+  <xsl:attribute-set name="set1">
+    <xsl:attribute name="class" select="name()"/>
+    <xsl:attribute name="position" select="position()"/>
+  </xsl:attribute-set>
+
+  <xsl:template match="/">
+    <out>
+      <xsl:for-each select="doc//*">
+        <xsl:copy use-attribute-sets="set1"/>
+      </xsl:for-each>  
+    </out>
+  </xsl:template>
+
+</xsl:stylesheet>