Add test case for spec bug 30171
authorMichael Kay <mike@saxonica.com>
Sat, 26 Aug 2017 08:48:43 +0100
changeset 1748 37e93626c0d2
parent 1747 eaccea174847
child 1749 8d690566c193
Add test case for spec bug 30171
tests/decl/variable/_variable-test-set.xml
tests/decl/variable/variable-0120.xsl
tests/decl/variable/variable-0120a.xsl
--- a/tests/decl/variable/_variable-test-set.xml	Thu Aug 17 17:51:08 2017 +0100
+++ b/tests/decl/variable/_variable-test-set.xml	Sat Aug 26 08:48:43 2017 +0100
@@ -407,6 +407,22 @@
          <assert-xml><![CDATA[<out v="1"/>]]></assert-xml>
       </result>
    </test-case>
+   
+   <test-case name="variable-0120">
+      <description>Within an overriding global variable, attempt to reference the overridden variable (spec bug 30171)</description>
+      <created by="Michael Kay" on="2017-08-26"/>
+      <environment ref="variable-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="variable-0120.xsl"/>
+         <stylesheet file="variable-0120a.xsl" role="secondary"/>
+      </test>
+      <result>
+         <error code="XPST0008"/>
+      </result>
+   </test-case>
 
    <test-case name="variable-0201">
       <description>basic test of tunnel parameters</description>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/variable/variable-0120.xsl	Sat Aug 26 08:48:43 2017 +0100
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+  <!-- Within an overriding global variable, attempt to reference the overridden variable -->
+  
+  <xsl:import href="variable-0120a.xsl"/>
+
+  <xsl:variable name="v" select="$v+1"/>
+  
+  <xsl:template match="/">
+    <out><xsl:value-of select="$v"/></out>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/variable/variable-0120a.xsl	Sat Aug 26 08:48:43 2017 +0100
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+  <!-- Within an overriding global variable, attempt to reference the overridden variable -->
+
+  <xsl:variable name="v" select="23"/> 
+
+</xsl:stylesheet>