You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mu...@apache.org on 2023/08/12 16:25:05 UTC

[xalan-java] branch xalan-j_xslt3.0 updated: committing a new working test case, for xpath 3.1 dynamic function call implementation. also committing as well, minor improvements to comments within one of xalanj codebase file on this dev repos branch.

This is an automated email from the ASF dual-hosted git repository.

mukulg pushed a commit to branch xalan-j_xslt3.0
in repository https://gitbox.apache.org/repos/asf/xalan-java.git


The following commit(s) were added to refs/heads/xalan-j_xslt3.0 by this push:
     new 02172812 committing a new working test case, for xpath 3.1 dynamic function call implementation. also committing as well, minor improvements to comments within one of xalanj codebase file on this dev repos branch.
     new fd95c863 Merge pull request #49 from mukulga/xalan-j_xslt3.0_mukul
02172812 is described below

commit 0217281291c6eab265f00cbbf980e34fe8618f11
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Sat Aug 12 21:51:37 2023 +0530

    committing a new working test case, for xpath 3.1 dynamic function call implementation. also committing as well, minor improvements to comments within one of xalanj codebase file on this dev repos branch.
---
 .../XPathHigherOrderBuiltinFunctionsSupport.java   |  6 +--
 tests/dynamic_function_call/gold/test15.out        |  1 +
 tests/dynamic_function_call/test15.xsl             | 45 ++++++++++++++++++++++
 .../xalan/xpath3/DynamicFunctionCallTests.java     | 10 +++++
 4 files changed, 58 insertions(+), 4 deletions(-)

diff --git a/src/org/apache/xpath/functions/XPathHigherOrderBuiltinFunctionsSupport.java b/src/org/apache/xpath/functions/XPathHigherOrderBuiltinFunctionsSupport.java
index a0a4fbae..f9ee24df 100644
--- a/src/org/apache/xpath/functions/XPathHigherOrderBuiltinFunctionsSupport.java
+++ b/src/org/apache/xpath/functions/XPathHigherOrderBuiltinFunctionsSupport.java
@@ -45,11 +45,9 @@ public class XPathHigherOrderBuiltinFunctionsSupport extends Function3Args {
 
     /**
      * This method, evaluates an XPath expression to produce an xdm sequence, that
-     * can be used as an argument to an XPath higher order function call.
+     * can be used as argument to an XPath higher order function call.
      *  
-     * @param xpathExpr      an XPath expression, that is evaluated by this method,
-     *                       to produce an xdm sequence that can be used as an
-     *                       argument to the call of an XPath higher order function.
+     * @param xpathExpr      an XPath expression, that is evaluated by this method
      * @param xctxt          an XPath context object
      * 
      * @return               an xdm sequence produced by this method.
diff --git a/tests/dynamic_function_call/gold/test15.out b/tests/dynamic_function_call/gold/test15.out
new file mode 100644
index 00000000..94a9e9e8
--- /dev/null
+++ b/tests/dynamic_function_call/gold/test15.out
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><result>13</result>
diff --git a/tests/dynamic_function_call/test15.xsl b/tests/dynamic_function_call/test15.xsl
new file mode 100644
index 00000000..66a71377
--- /dev/null
+++ b/tests/dynamic_function_call/test15.xsl
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="3.0">
+                
+   <!-- Author: mukulg@apache.org -->                
+                
+   <!-- This XSLT stylesheet test case, borrows an higher-order function example 
+        from wikipedia article https://en.wikipedia.org/wiki/Higher-order_function. -->
+
+   <xsl:output method="xml" indent="yes"/>
+   
+   <!-- with this variable declaration, an XPath inline function expression, 
+        takes as argument a function and applies that function to a particular 
+        value twice. -->
+   <xsl:variable name="twice" select="function($f, $x) { $f($f($x)) }"/>
+   
+   <!-- a variable declaration, specifying a normal XPath inline function
+        expression. -->
+   <xsl:variable name="plusThree" select="function($a) { $a + 3 }"/>
+      
+   <xsl:template match="/">      
+      <result>
+         <xsl:value-of select="$twice($plusThree, 7)"/> 
+      </result>
+   </xsl:template>
+   
+   <!--
+      * Licensed to the Apache Software Foundation (ASF) under one
+      * or more contributor license agreements. See the NOTICE file
+      * distributed with this work for additional information
+      * regarding copyright ownership. The ASF licenses this file
+      * to you under the Apache License, Version 2.0 (the  "License");
+      * you may not use this file except in compliance with the License.
+      * You may obtain a copy of the License at
+      *
+      *     http://www.apache.org/licenses/LICENSE-2.0
+      *
+      * Unless required by applicable law or agreed to in writing, software
+      * distributed under the License is distributed on an "AS IS" BASIS,
+      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      * See the License for the specific language governing permissions and
+      * limitations under the License.
+   -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/org/apache/xalan/xpath3/DynamicFunctionCallTests.java b/tests/org/apache/xalan/xpath3/DynamicFunctionCallTests.java
index 1d7940cf..aef54c6d 100644
--- a/tests/org/apache/xalan/xpath3/DynamicFunctionCallTests.java
+++ b/tests/org/apache/xalan/xpath3/DynamicFunctionCallTests.java
@@ -186,5 +186,15 @@ public class DynamicFunctionCallTests extends XslTransformTestsUtil {
         
         runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
     }
+    
+    @Test
+    public void xslDynamicFunctionCallTest15() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test15.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test15.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test15.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
 
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org