Error case: overridden component is in the wrong used package
authorMichael Kay <mike@saxonica.com>
Fri, 14 Dec 2018 23:31:04 +0000
changeset 1924 5bb7357846d0
parent 1923 fdb0348dc0cc
child 1925 71129363292b
Error case: overridden component is in the wrong used package
tests/decl/override/_override-test-set.xml
tests/decl/override/override-f-036.xsl
--- a/tests/decl/override/_override-test-set.xml	Fri Dec 14 23:30:06 2018 +0000
+++ b/tests/decl/override/_override-test-set.xml	Fri Dec 14 23:31:04 2018 +0000
@@ -623,7 +623,23 @@
       <result>
          <assert>/out = "0 1 2 3 4 5 7 8 9 10"</assert>
       </result>
-   </test-case> 
+   </test-case>
+   
+   <test-case name="override-f-036">
+      <description>Use two packages; try to override a component from the wrong used package</description>
+      <created by="Michael Kay" on="2018-11-20"/>
+      <dependencies>
+         <feature value="higher_order_functions"/>
+      </dependencies>
+      <test>
+         <package file="override-f-036.xsl" role="principal"/>
+         <package file="override-f-032b.xsl" role="secondary"/>
+         <package file="override-f-033b.xsl" role="secondary"/>
+      </test>
+      <result>
+         <error code="XTSE3058"/>
+      </result>
+   </test-case>
    
    
    <test-case name="override-t-001">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/override/override-f-036.xsl	Fri Dec 14 23:31:04 2018 +0000
@@ -0,0 +1,44 @@
+<xsl:package 
+  name="http://www.w3.org/xslt30tests/override-f-032a"
+  package-version="1.0.1"
+  version="3.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:f="http://www.w3.org/xslt30tests/override-f-032"
+  xmlns:p="http://www.w3.org/xslt30tests/override-f-033b"
+  exclude-result-prefixes="xs f"
+  expand-text="yes">
+
+  <!-- Uses two packages, xsl:override appears under the wrong xsl:use-package declaration -->
+  
+  
+  <xsl:use-package name="http://www.w3.org/xslt30tests/override-f-032b" package-version="*">
+    
+  </xsl:use-package>
+  
+  <xsl:use-package name="http://www.w3.org/xslt30tests/override-f-033b" package-version="1.0.0">
+    <xsl:override>
+      <xsl:function name="p:f" as="xs:integer" visibility="public">
+        <xsl:param name="in" as="xs:integer*"/>
+        <xsl:sequence select="p:g() + (if (empty($in)) then 23 else head($in) + p:h(tail($in)))"/>
+      </xsl:function>
+      
+      <xsl:function name="p:g" as="xs:integer" visibility="public">
+        <xsl:sequence select="if (current-date() lt xs:date('1900-01-01')) then p:g()+1 else 0"/>
+      </xsl:function>
+
+      <xsl:function name="f:g" as="xs:integer" visibility="public">
+        <xsl:sequence select="4"/>
+      </xsl:function>
+      
+    </xsl:override>
+   
+  </xsl:use-package>
+  
+  <xsl:template name="xsl:initial-template">
+    <out>{f:f()()}</out>
+  </xsl:template>
+
+ 
+  
+</xsl:package>   
\ No newline at end of file