Interaction of several overridden functions
authorMichael Kay <mike@saxonica.com>
Mon, 18 Sep 2017 23:33:02 +0100
changeset 1761 f491f8795c7c
parent 1760 748a74a64be2
child 1762 4a005a206233
Interaction of several overridden functions
tests/decl/override/_override-test-set.xml
tests/decl/override/override-f-033a.xsl
tests/decl/override/override-f-033b.xsl
--- a/tests/decl/override/_override-test-set.xml	Mon Sep 18 23:31:36 2017 +0100
+++ b/tests/decl/override/_override-test-set.xml	Mon Sep 18 23:33:02 2017 +0100
@@ -536,6 +536,18 @@
       </result>
    </test-case>
    
+   <test-case name="override-f-033">
+      <description>Call an overridden functions from an overridden function</description>
+      <created by="Michael Kay" on="2017-09-07"/>
+      <test>
+         <package file="override-f-033a.xsl" role="principal"/>
+         <package file="override-f-033b.xsl" role="secondary"/>
+      </test>
+      <result>
+         <assert>/out = "29"</assert>
+      </result>
+   </test-case>
+   
    
    <test-case name="override-t-001">
       <description>Successful override of a named template, when called from overriding package</description>
@@ -1353,8 +1365,12 @@
    <test-case name="override-misc-007">
       <description>Streamed accumulators in different packages can have the same name</description>
       <created by="Michael Kay" on="2015-03-01"/>
-      <modified by="Michael Kay" on="2014-08-22" change="spec change, @new-value->@select"/>
+      <modified by="Michael Kay" on="2015-08-22" change="spec change, @new-value->@select"/>
+      <modified by="Michael Kay" on="2017-09-11" change="add dependency on streaming"/>
       <environment ref="override-misc-F"/>
+      <dependencies>
+         <feature value="streaming"/>
+      </dependencies>
       <test>
          <package file="override-misc-007.xsl" role="principal"/>
          <initial-template name="main"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/override/override-f-033a.xsl	Mon Sep 18 23:33:02 2017 +0100
@@ -0,0 +1,28 @@
+<xsl:package 
+  name="http://www.w3.org/xslt30tests/override-f-033a"
+  package-version="1.0.0"
+  version="3.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:p="http://www.w3.org/xslt30tests/override-f-033b"
+  expand-text="yes"
+  exclude-result-prefixes="#all">
+  
+  <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:override>
+  </xsl:use-package>
+  
+  <xsl:template name="xsl:initial-template">
+    <out>{p:f((1,2,3))}</out>
+  </xsl:template>
+  
+</xsl:package>   
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/override/override-f-033b.xsl	Mon Sep 18 23:33:02 2017 +0100
@@ -0,0 +1,27 @@
+<xsl:package 
+  name="http://www.w3.org/xslt30tests/override-f-033b"
+  package-version="1.0.0"
+  version="3.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:p="http://www.w3.org/xslt30tests/override-f-033b"
+  exclude-result-prefixes="#all">
+  
+  
+  
+    <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 0 else head($in) + p:h(tail($in)))"/>
+    </xsl:function>
+  
+    <xsl:function name="p:g" as="xs:integer" visibility="public">
+      <xsl:sequence select="61"/>
+    </xsl:function>
+  
+    <xsl:function name="p:h" as="xs:integer" visibility="public">
+      <xsl:param name="in" as="xs:integer*"/>
+      <xsl:sequence select="p:f($in)"/>
+    </xsl:function>  
+ 
+  
+</xsl:package>   
\ No newline at end of file