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 2024/08/11 09:34:58 UTC

(xalan-java) branch xalan-j_xslt3.0 updated: committing implementation improvements for jira issue XALANJ-2773, and adding few related conformance tests

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 92a0dda52 committing implementation improvements for jira issue XALANJ-2773, and adding few related conformance tests
92a0dda52 is described below

commit 92a0dda52ef325aed961aeafd76714d08bc398ab
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Sun Aug 11 15:04:45 2024 +0530

    committing implementation improvements for jira issue XALANJ-2773, and adding few related conformance tests
---
 src/org/apache/xalan/templates/ElemForEach.java    | 33 ++++++++++---
 src/org/apache/xalan/templates/ElemIterate.java    | 38 ++++++++++-----
 src/org/apache/xalan/templates/ElemValueOf.java    | 12 ++++-
 src/org/apache/xalan/templates/ElemVariable.java   | 18 ++++++++
 src/org/apache/xpath/XPath.java                    |  6 +++
 src/org/apache/xpath/axes/LocPathIterator.java     | 25 ++++++++--
 src/org/apache/xpath/compiler/XPathParser.java     | 54 ++++++++++++++++++----
 src/org/apache/xpath/functions/FunctionOneArg.java | 27 +++++++++++
 .../apache/xpath/functions/math/FuncMathAcos.java  |  2 +-
 .../apache/xpath/functions/math/FuncMathAsin.java  |  2 +-
 .../apache/xpath/functions/math/FuncMathAtan.java  |  2 +-
 .../apache/xpath/functions/math/FuncMathAtan2.java |  4 +-
 .../apache/xpath/functions/math/FuncMathCos.java   |  2 +-
 .../apache/xpath/functions/math/FuncMathExp.java   |  2 +-
 .../apache/xpath/functions/math/FuncMathExp10.java |  2 +-
 .../apache/xpath/functions/math/FuncMathLog.java   |  2 +-
 .../apache/xpath/functions/math/FuncMathLog10.java |  2 +-
 .../apache/xpath/functions/math/FuncMathPi.java    |  2 +-
 .../apache/xpath/functions/math/FuncMathPow.java   |  4 +-
 .../apache/xpath/functions/math/FuncMathSin.java   |  2 +-
 .../apache/xpath/functions/math/FuncMathSqrt.java  |  5 +-
 .../apache/xpath/functions/math/FuncMathTan.java   |  2 +-
 .../xpath3/XPathExprFunctionCallSuffixTests.java   | 50 ++++++++++++++++++++
 tests/xpath_function_call_suffix/gold/test12.out   | 17 +++++++
 tests/xpath_function_call_suffix/gold/test13.out   | 17 +++++++
 tests/xpath_function_call_suffix/gold/test14.out   |  1 +
 tests/xpath_function_call_suffix/gold/test15.out   |  1 +
 tests/xpath_function_call_suffix/gold/test16.out   | 17 +++++++
 tests/xpath_function_call_suffix/test12.xsl        | 48 +++++++++++++++++++
 tests/xpath_function_call_suffix/test13.xsl        | 49 ++++++++++++++++++++
 tests/xpath_function_call_suffix/test14.xsl        | 42 +++++++++++++++++
 tests/xpath_function_call_suffix/test15.xsl        | 43 +++++++++++++++++
 tests/xpath_function_call_suffix/test16.xsl        | 48 +++++++++++++++++++
 33 files changed, 532 insertions(+), 49 deletions(-)

diff --git a/src/org/apache/xalan/templates/ElemForEach.java b/src/org/apache/xalan/templates/ElemForEach.java
index 9b0ee5d52..1b5085e2e 100644
--- a/src/org/apache/xalan/templates/ElemForEach.java
+++ b/src/org/apache/xalan/templates/ElemForEach.java
@@ -446,9 +446,7 @@ public class ElemForEach extends ElemTemplateElement implements ExpressionOwner
         }
     }
     else if (m_selectExpression instanceof LocPathIterator) {
-        LocPathIterator locPathIterator = (LocPathIterator)m_selectExpression;
-        
-        Function func = locPathIterator.getFuncExpr();          
+        LocPathIterator locPathIterator = (LocPathIterator)m_selectExpression;          
         
         boolean isProcessAsNodeset = true;
         DTMIterator dtmIter = null;                     
@@ -460,19 +458,40 @@ public class ElemForEach extends ElemTemplateElement implements ExpressionOwner
         }
         
         if (dtmIter != null) {
-        	ResultSequence rSeq = null;
+        	ResultSequence inpSeq = null;
+        	
+        	Function func = locPathIterator.getFuncExpr();
+        	XPathDynamicFunctionCall dfc = locPathIterator.getDynamicFuncCallExpr();
+        	
         	if (func != null) {
-        		rSeq = new ResultSequence();
+        		// Evaluate an XPath path expression like /a/b/funcCall(..)
+        		inpSeq = new ResultSequence();
         		int nextNode;
         		while ((nextNode = dtmIter.nextNode()) != DTM.NULL)
         		{
         			XNodeSet singletonXPathNode = new XNodeSet(nextNode, xctxt);
         			xctxt.setXPath3ContextItem(singletonXPathNode);                              
         			XObject funcEvalResult = func.execute(xctxt);
-        			rSeq.add(funcEvalResult);
+        			inpSeq.add(funcEvalResult);
+        		}
+        		
+        		processSequenceOrArray(transformer, xctxt, inpSeq);
+                
+                return;
+        	}
+        	else if (dfc != null) {
+        		// Evaluate an XPath path expression like /a/b/$funcCall(..)
+        		inpSeq = new ResultSequence();
+        		int nextNode;
+        		while ((nextNode = dtmIter.nextNode()) != DTM.NULL)
+        		{
+        			XNodeSet singletonXPathNode = new XNodeSet(nextNode, xctxt);
+        			xctxt.setXPath3ContextItem(singletonXPathNode);                              
+        			XObject dfcEvalResult = dfc.execute(xctxt);
+        			inpSeq.add(dfcEvalResult);
         		}
         		
-        		processSequenceOrArray(transformer, xctxt, rSeq);
+        		processSequenceOrArray(transformer, xctxt, inpSeq);
                 
                 return;
         	}
diff --git a/src/org/apache/xalan/templates/ElemIterate.java b/src/org/apache/xalan/templates/ElemIterate.java
index ea3c97cf8..c674c5a32 100644
--- a/src/org/apache/xalan/templates/ElemIterate.java
+++ b/src/org/apache/xalan/templates/ElemIterate.java
@@ -34,6 +34,7 @@ import org.apache.xpath.XPath;
 import org.apache.xpath.XPathContext;
 import org.apache.xpath.axes.LocPathIterator;
 import org.apache.xpath.functions.Function;
+import org.apache.xpath.functions.XPathDynamicFunctionCall;
 import org.apache.xpath.objects.ResultSequence;
 import org.apache.xpath.objects.XNodeSet;
 import org.apache.xpath.objects.XObject;
@@ -182,13 +183,13 @@ public class ElemIterate extends ElemTemplateElement implements ExpressionOwner
            
            verifyXslElemIterateChildElementsSequence(xctxt);
            
-           XObject evalResult = null;
-           
-           Function func = null;
+           XObject inpXObject = null;
            
            if (m_selectExpression instanceof LocPathIterator) {
         	   LocPathIterator locPathIter = (LocPathIterator)m_selectExpression;
-               func = locPathIter.getFuncExpr();
+        	   
+        	   Function func = locPathIter.getFuncExpr();
+        	   XPathDynamicFunctionCall dfc = locPathIter.getDynamicFuncCallExpr();
                
                DTMIterator dtmIter = null;
                try {
@@ -201,6 +202,7 @@ public class ElemIterate extends ElemTemplateElement implements ExpressionOwner
                if (dtmIter != null) {
             	   ResultSequence rSeq = null;
             	   if (func != null) {
+            		   // Evaluate an XPath path expression like /a/b/funcCall(..)
             		   rSeq = new ResultSequence();
             		   int nextNode;
             		   while ((nextNode = dtmIter.nextNode()) != DTM.NULL)
@@ -211,23 +213,37 @@ public class ElemIterate extends ElemTemplateElement implements ExpressionOwner
             			   rSeq.add(funcEvalResult);
             		   }
             		   
-            		   evalResult = rSeq;
+            		   inpXObject = rSeq;
+            	   }
+            	   else if (dfc != null) {
+            		   // Evaluate an XPath path expression like /a/b/$funcCall(..)
+            		   rSeq = new ResultSequence();
+            		   int nextNode;
+            		   while ((nextNode = dtmIter.nextNode()) != DTM.NULL)
+            		   {
+            			   XNodeSet singletonXPathNode = new XNodeSet(nextNode, xctxt);
+            			   xctxt.setXPath3ContextItem(singletonXPathNode);                              
+            			   XObject funcEvalResult = dfc.execute(xctxt);
+            			   rSeq.add(funcEvalResult);
+            		   }
+            		   
+            		   inpXObject = rSeq;
             	   }
                }
            }
            
-           if (evalResult == null) {
-              evalResult = m_selectExpression.execute(xctxt);
+           if (inpXObject == null) {
+              inpXObject = m_selectExpression.execute(xctxt);
            }
            
            List<XObject> itemsToBeProcessed = null;
                
-           if ((evalResult instanceof ResultSequence) || (evalResult instanceof XPathArray)) {
-        	   if (evalResult instanceof ResultSequence) {
-        		   itemsToBeProcessed = ((ResultSequence)evalResult).getResultSequenceItems();
+           if ((inpXObject instanceof ResultSequence) || (inpXObject instanceof XPathArray)) {
+        	   if (inpXObject instanceof ResultSequence) {
+        		   itemsToBeProcessed = ((ResultSequence)inpXObject).getResultSequenceItems();
         	   }
         	   else {
-        		   XPathArray xpathArr = (XPathArray)evalResult;
+        		   XPathArray xpathArr = (XPathArray)inpXObject;
         		   itemsToBeProcessed = xpathArr.getNativeArray();
         	   }
                    
diff --git a/src/org/apache/xalan/templates/ElemValueOf.java b/src/org/apache/xalan/templates/ElemValueOf.java
index c530c8034..4d7020deb 100644
--- a/src/org/apache/xalan/templates/ElemValueOf.java
+++ b/src/org/apache/xalan/templates/ElemValueOf.java
@@ -460,7 +460,8 @@ public class ElemValueOf extends ElemTemplateElement {
                   else if (expr instanceof LocPathIterator) {
                      LocPathIterator locPathIterator = (LocPathIterator)expr;
                      
-                     Function func = locPathIterator.getFuncExpr();;
+                     Function func = locPathIterator.getFuncExpr();
+                     XPathDynamicFunctionCall dfc = locPathIterator.getDynamicFuncCallExpr();
                      
                      DTMIterator dtmIter = null;                     
                      try {
@@ -478,10 +479,19 @@ public class ElemValueOf extends ElemTemplateElement {
                            XNodeSet singletonXPathNode = new XNodeSet(nextNode, xctxt);
                            String resultStr = "";
                            if (func != null) {
+                        	  // Evaluate an XPath path expression like /a/b/funcCall(..).
+                        	  // Find one result item, since this is within a loop.
                               xctxt.setXPath3ContextItem(singletonXPathNode);                              
                               XObject funcEvalResult = func.execute(xctxt);
                               resultStr = XslTransformEvaluationHelper.getStrVal(funcEvalResult);                               
                            }
+                           else if (dfc != null) {
+                        	   // Evaluate an XPath path expression like /a/b/$funcCall(..).
+                        	   // Find one result item, since this is within a loop.
+                               xctxt.setXPath3ContextItem(singletonXPathNode);                              
+                               XObject evalResult = dfc.execute(xctxt);
+                               resultStr = XslTransformEvaluationHelper.getStrVal(evalResult);                               
+                           }
                            else {
                               resultStr = singletonXPathNode.str();
                            }
diff --git a/src/org/apache/xalan/templates/ElemVariable.java b/src/org/apache/xalan/templates/ElemVariable.java
index cf69f5a32..4017b23d0 100644
--- a/src/org/apache/xalan/templates/ElemVariable.java
+++ b/src/org/apache/xalan/templates/ElemVariable.java
@@ -40,6 +40,7 @@ import org.apache.xpath.axes.SelfIteratorNoPredicate;
 import org.apache.xpath.composite.SequenceTypeData;
 import org.apache.xpath.composite.SequenceTypeSupport;
 import org.apache.xpath.functions.Function;
+import org.apache.xpath.functions.XPathDynamicFunctionCall;
 import org.apache.xpath.functions.XSLConstructorStylesheetOrExtensionFunction;
 import org.apache.xpath.functions.XSLFunctionService;
 import org.apache.xpath.objects.ResultSequence;
@@ -486,6 +487,7 @@ public class ElemVariable extends ElemTemplateElement
             LocPathIterator locPathIterator = (LocPathIterator)selectExpression;
             
             Function func = locPathIterator.getFuncExpr();
+            XPathDynamicFunctionCall dfc = locPathIterator.getDynamicFuncCallExpr();
             
             DTMIterator dtmIter = null;                     
             try {
@@ -498,6 +500,7 @@ public class ElemVariable extends ElemTemplateElement
             if (dtmIter != null) {
                ResultSequence rSeq = null;
                if (func != null) {
+            	  // Evaluate an XPath path expression like /a/b/funcCall(..)
             	  rSeq = new ResultSequence();
             	  int nextNode;
             	  while ((nextNode = dtmIter.nextNode()) != DTM.NULL)
@@ -507,8 +510,23 @@ public class ElemVariable extends ElemTemplateElement
                       XObject funcEvalResult = func.execute(xctxt);
                       rSeq.add(funcEvalResult);
                   }
+            	  
             	  var = rSeq; 
                }
+               else if (dfc != null) {
+            	   // Evaluate an XPath path expression like /a/b/$funcCall(..)
+            	   rSeq = new ResultSequence();
+            	   int nextNode;
+            	   while ((nextNode = dtmIter.nextNode()) != DTM.NULL)
+            	   {
+            		   XNodeSet singletonXPathNode = new XNodeSet(nextNode, xctxt);
+            		   xctxt.setXPath3ContextItem(singletonXPathNode);                              
+            		   XObject evalResult = dfc.execute(xctxt);
+            		   rSeq.add(evalResult);
+            	   }
+            	   
+            	   var = rSeq; 
+               }
                else {
                   var = new XNodeSet(dtmIter);
                }
diff --git a/src/org/apache/xpath/XPath.java b/src/org/apache/xpath/XPath.java
index 4fee41efe..73891f384 100644
--- a/src/org/apache/xpath/XPath.java
+++ b/src/org/apache/xpath/XPath.java
@@ -42,6 +42,7 @@ import org.apache.xpath.compiler.FunctionTable;
 import org.apache.xpath.compiler.XPathParser;
 import org.apache.xpath.composite.XPathExprFunctionSuffix;
 import org.apache.xpath.functions.Function;
+import org.apache.xpath.functions.XPathDynamicFunctionCall;
 import org.apache.xpath.objects.ResultSequence;
 import org.apache.xpath.objects.XNumber;
 import org.apache.xpath.objects.XObject;
@@ -294,6 +295,11 @@ public class XPath implements Serializable, ExpressionOwner
     		expr2.exprSetParent((ExpressionNode)locator);
     		locPathIter.setFuncExpr((Function)expr2);
     	 }
+    	 else if ((expr instanceof LocPathIterator) && (expr2 instanceof XPathDynamicFunctionCall)) {
+     		LocPathIterator locPathIter = (LocPathIterator)expr;
+     		expr2.exprSetParent((ExpressionNode)locator);
+     		locPathIter.setDynamicFuncCallExpr((XPathDynamicFunctionCall)expr2);
+     	 }
       }
     }
     else if (MATCH == type)
diff --git a/src/org/apache/xpath/axes/LocPathIterator.java b/src/org/apache/xpath/axes/LocPathIterator.java
index b080e9990..94b664000 100644
--- a/src/org/apache/xpath/axes/LocPathIterator.java
+++ b/src/org/apache/xpath/axes/LocPathIterator.java
@@ -33,6 +33,7 @@ import org.apache.xpath.XPathContext;
 import org.apache.xpath.XPathVisitor;
 import org.apache.xpath.compiler.Compiler;
 import org.apache.xpath.functions.Function;
+import org.apache.xpath.functions.XPathDynamicFunctionCall;
 import org.apache.xpath.objects.XNodeSet;
 import org.apache.xpath.objects.XObject;
 import org.apache.xpath.res.XPATHErrorResources;
@@ -55,11 +56,19 @@ public abstract class LocPathIterator extends PredicatedNodeTest
     static final long serialVersionUID = -4602476357268405754L;
     
     /**
-     * If there's a function call suffix at an end of XPath expression 
-     * similar to /a/b/funcCall(..), we keep a compiled Function 
-     * object for funcCall(..) within this class field.  
+     * If there's a function call suffix at an end of XPath path expression 
+     * similar to /a/b/func(..), we keep a compiled Function 
+     * object for func(..) within this class field.  
      */
-    private Function m_func_expr = null;    
+    private Function m_func_expr = null;
+    
+    /**
+     * If there's an XPath dynamic function call suffix at an end of 
+     * XPath path expression similar to /a/b/$func(..), we keep a 
+     * compiled XPathDynamicFunctionCall object for $func(..) within 
+     * this class field.  
+     */
+    private XPathDynamicFunctionCall m_dfc_expr = null; 
 	
   /**
    * Create a LocPathIterator object.
@@ -1047,5 +1056,13 @@ public abstract class LocPathIterator extends PredicatedNodeTest
   public Function getFuncExpr() {
 	  return m_func_expr;
   }
+  
+  public void setDynamicFuncCallExpr(XPathDynamicFunctionCall dfc) {
+	  m_dfc_expr = dfc;
+  }
+  
+  public XPathDynamicFunctionCall getDynamicFuncCallExpr() {
+	  return m_dfc_expr;
+  }
 
 }
diff --git a/src/org/apache/xpath/compiler/XPathParser.java b/src/org/apache/xpath/compiler/XPathParser.java
index 00e5480bf..3eae2cc96 100644
--- a/src/org/apache/xpath/compiler/XPathParser.java
+++ b/src/org/apache/xpath/compiler/XPathParser.java
@@ -50,7 +50,6 @@ import org.apache.xml.utils.PrefixResolver;
 import org.apache.xpath.XPathProcessorException;
 import org.apache.xpath.composite.ForQuantifiedExprVarBinding;
 import org.apache.xpath.composite.LetExprVarBinding;
-import org.apache.xpath.composite.XPathExprFunctionSuffix;
 import org.apache.xpath.composite.SequenceTypeArrayTest;
 import org.apache.xpath.composite.SequenceTypeData;
 import org.apache.xpath.composite.SequenceTypeFunctionTest;
@@ -58,6 +57,7 @@ import org.apache.xpath.composite.SequenceTypeKindTest;
 import org.apache.xpath.composite.SequenceTypeMapTest;
 import org.apache.xpath.composite.SequenceTypeSupport;
 import org.apache.xpath.composite.XPathArrayConstructor;
+import org.apache.xpath.composite.XPathExprFunctionSuffix;
 import org.apache.xpath.composite.XPathForExpr;
 import org.apache.xpath.composite.XPathIfExpr;
 import org.apache.xpath.composite.XPathLetExpr;
@@ -3906,10 +3906,44 @@ public class XPathParser
       nextToken();
 
       if (!Step())
-      {
-        // RelativeLocationPath can't end with a trailing '/'
-        // "Location step expected following '/' or '//'"
-        error(XPATHErrorResources.ER_EXPECTED_LOC_STEP, null);
+      {    	  
+    	if (!isXPathPatternExcludeTrailingNodeFunctions() && ((m_tokenChar == '$') && (lookahead('(', 2)))) {
+            // XPath parse of expression like /a/b/$func(..), i.e an XPath path expression 
+    		// with a dynamic function call suffix.
+    		
+    		String xpathOneStr = "";
+    		String xpathTwoStr = "";
+    		for (int idx = 0; idx < (m_queueMark - 2); idx++) {
+    		   xpathOneStr += (String)(m_ops.m_tokenQueue.elementAt(idx)); 
+    		}
+    		
+    		// XPath dynamic function call string accumulation
+    		xpathTwoStr += m_token;
+    		nextToken();
+    		xpathTwoStr += m_token;
+    		nextToken();
+    		xpathTwoStr += m_token;
+    		nextToken();
+    		
+    		while (m_token != null) {
+     		   xpathTwoStr += m_token;
+     		   nextToken();     		   
+     	    }
+    		
+    		m_pathExprFunctionSuffix = new XPathExprFunctionSuffix();    	   
+     	    m_pathExprFunctionSuffix.setXPathOneStr(xpathOneStr);
+     	    m_pathExprFunctionSuffix.setXPathTwoStr(xpathTwoStr);
+     	   
+     	    int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH);
+     	    
+     	    m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH,
+                                             m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos);
+    	}
+    	else {
+           // RelativeLocationPath can't end with a trailing '/'
+           // "Location step expected following '/' or '//'"
+           error(XPATHErrorResources.ER_EXPECTED_LOC_STEP, null);
+    	}
       }
     }
 
@@ -4084,7 +4118,7 @@ public class XPathParser
     		   nextToken();
     		   xpathOneStr += m_token; 
     	   }
-    	   
+    	     
     	   for (int idx = scanOneEndPos; idx < scanTwoStartPos; idx++) {
     		  nextToken(); 
     	   }
@@ -5747,14 +5781,16 @@ public class XPathParser
    }
    
    /**
-    * This method checks, whether there's a function call suffix at an 
-    * end of XPath expression similar to /a/b/funcCall(..).
+    * This method checks, whether there's an XPath built-in node pattern like 
+    * node()/text()/comment() at an end of XPath expression. XPath node checks for 
+    * these patterns with predicate as suffix also need to be similarly excluded.
     */
    private boolean isXPathPatternExcludeTrailingNodeFunctions() {
 	  boolean isExclude = false;
 	  
 	  String currXPathPattern = m_ops.m_currentPattern;
-	  if (currXPathPattern.endsWith("node()") || currXPathPattern.endsWith("text()") || currXPathPattern.endsWith("comment()")) {
+	  if (currXPathPattern.endsWith("node()") || currXPathPattern.endsWith("text()") || 
+			                                                            currXPathPattern.endsWith("comment()")) {
 		  isExclude = true; 
 	  }
 	  else {
diff --git a/src/org/apache/xpath/functions/FunctionOneArg.java b/src/org/apache/xpath/functions/FunctionOneArg.java
index 04b005f39..7a2635860 100644
--- a/src/org/apache/xpath/functions/FunctionOneArg.java
+++ b/src/org/apache/xpath/functions/FunctionOneArg.java
@@ -20,10 +20,15 @@
  */
 package org.apache.xpath.functions;
 
+import javax.xml.transform.TransformerException;
+
 import org.apache.xalan.res.XSLMessages;
 import org.apache.xpath.Expression;
 import org.apache.xpath.ExpressionOwner;
+import org.apache.xpath.XPathContext;
 import org.apache.xpath.XPathVisitor;
+import org.apache.xpath.axes.SelfIteratorNoPredicate;
+import org.apache.xpath.objects.XObject;
 
 /**
  * Base class for functions that accept one argument.
@@ -173,5 +178,27 @@ public class FunctionOneArg extends Function implements ExpressionOwner
 
   	return true;
   }
+  
+  /**
+   * Get the effective value of function argument.
+   */
+  protected XObject getEffectiveFuncArgValue(Expression argExpr, XPathContext xctxt) throws TransformerException {
+	  XObject argValue = null;
+
+	  if (argExpr instanceof SelfIteratorNoPredicate) {
+		  XObject contextItem = xctxt.getXPath3ContextItem();
+		  if (contextItem != null) {
+			  argValue = contextItem;  
+		  }
+		  else {
+			  argValue = argExpr.execute(xctxt); 
+		  }
+	  }
+	  else {  
+		  argValue = argExpr.execute(xctxt);
+	  }
+	  
+	  return argValue;
+  }
 
 }
diff --git a/src/org/apache/xpath/functions/math/FuncMathAcos.java b/src/org/apache/xpath/functions/math/FuncMathAcos.java
index ba6786521..be512f179 100644
--- a/src/org/apache/xpath/functions/math/FuncMathAcos.java
+++ b/src/org/apache/xpath/functions/math/FuncMathAcos.java
@@ -64,7 +64,7 @@ public class FuncMathAcos extends FunctionOneArg
           return resultSeq;
        }
           
-       XObject arg0Result = arg0.execute(xctxt);
+       XObject arg0Result = getEffectiveFuncArgValue(arg0, xctxt);
        
        if (arg0Result instanceof XNumber) {
           double resultVal = Math.acos(((XNumber)arg0Result).num());
diff --git a/src/org/apache/xpath/functions/math/FuncMathAsin.java b/src/org/apache/xpath/functions/math/FuncMathAsin.java
index ce16047a4..abd9067b6 100644
--- a/src/org/apache/xpath/functions/math/FuncMathAsin.java
+++ b/src/org/apache/xpath/functions/math/FuncMathAsin.java
@@ -64,7 +64,7 @@ public class FuncMathAsin extends FunctionOneArg
           return resultSeq;
        }
           
-       XObject arg0Result = arg0.execute(xctxt);
+       XObject arg0Result = getEffectiveFuncArgValue(arg0, xctxt);
        
        if (arg0Result instanceof XNumber) {
           double resultVal = Math.asin(((XNumber)arg0Result).num());
diff --git a/src/org/apache/xpath/functions/math/FuncMathAtan.java b/src/org/apache/xpath/functions/math/FuncMathAtan.java
index 2bf1e3282..d34cbe28a 100644
--- a/src/org/apache/xpath/functions/math/FuncMathAtan.java
+++ b/src/org/apache/xpath/functions/math/FuncMathAtan.java
@@ -64,7 +64,7 @@ public class FuncMathAtan extends FunctionOneArg
           return resultSeq;
        }
           
-       XObject arg0Result = arg0.execute(xctxt);
+       XObject arg0Result = getEffectiveFuncArgValue(arg0, xctxt);
        
        if (arg0Result instanceof XNumber) {
           double resultVal = Math.atan(((XNumber)arg0Result).num());
diff --git a/src/org/apache/xpath/functions/math/FuncMathAtan2.java b/src/org/apache/xpath/functions/math/FuncMathAtan2.java
index 1ace7effc..52e91ac86 100644
--- a/src/org/apache/xpath/functions/math/FuncMathAtan2.java
+++ b/src/org/apache/xpath/functions/math/FuncMathAtan2.java
@@ -46,8 +46,8 @@ public class FuncMathAtan2 extends Function2Args {
         
         SourceLocator srcLocator = xctxt.getSAXLocator();
         
-        XObject arg0Result = (getArg0()).execute(xctxt);        
-        XObject arg1Result = (getArg1()).execute(xctxt);
+        XObject arg0Result = getEffectiveFuncArgValue(getArg0(), xctxt);        
+        XObject arg1Result = getEffectiveFuncArgValue(getArg1(), xctxt);
         
         double lDouble = getDoubleValue(arg0Result, srcLocator, "first");
         double rDouble = getDoubleValue(arg1Result, srcLocator, "second");
diff --git a/src/org/apache/xpath/functions/math/FuncMathCos.java b/src/org/apache/xpath/functions/math/FuncMathCos.java
index 60bef9794..f69a4d98a 100644
--- a/src/org/apache/xpath/functions/math/FuncMathCos.java
+++ b/src/org/apache/xpath/functions/math/FuncMathCos.java
@@ -64,7 +64,7 @@ public class FuncMathCos extends FunctionOneArg
           return resultSeq;
        }
           
-       XObject arg0Result = arg0.execute(xctxt);
+       XObject arg0Result = getEffectiveFuncArgValue(arg0, xctxt);
        
        if (arg0Result instanceof XNumber) {
           double resultVal = Math.cos(((XNumber)arg0Result).num());
diff --git a/src/org/apache/xpath/functions/math/FuncMathExp.java b/src/org/apache/xpath/functions/math/FuncMathExp.java
index 2bcbbe60a..11f631599 100644
--- a/src/org/apache/xpath/functions/math/FuncMathExp.java
+++ b/src/org/apache/xpath/functions/math/FuncMathExp.java
@@ -64,7 +64,7 @@ public class FuncMathExp extends FunctionOneArg
           return resultSeq;
        }
           
-       XObject arg0Result = arg0.execute(xctxt);
+       XObject arg0Result = getEffectiveFuncArgValue(arg0, xctxt);
        
        if (arg0Result instanceof XNumber) {
           double resultVal = Math.exp(((XNumber)arg0Result).num());
diff --git a/src/org/apache/xpath/functions/math/FuncMathExp10.java b/src/org/apache/xpath/functions/math/FuncMathExp10.java
index a5d80c340..2dcdc273f 100644
--- a/src/org/apache/xpath/functions/math/FuncMathExp10.java
+++ b/src/org/apache/xpath/functions/math/FuncMathExp10.java
@@ -64,7 +64,7 @@ public class FuncMathExp10 extends FunctionOneArg
           return resultSeq;
        }
           
-       XObject arg0Result = arg0.execute(xctxt);
+       XObject arg0Result = getEffectiveFuncArgValue(arg0, xctxt);
        
        if (arg0Result instanceof XNumber) {
           double resultVal = Math.pow(10, ((XNumber)arg0Result).num());
diff --git a/src/org/apache/xpath/functions/math/FuncMathLog.java b/src/org/apache/xpath/functions/math/FuncMathLog.java
index 7700b8416..8b63aa387 100644
--- a/src/org/apache/xpath/functions/math/FuncMathLog.java
+++ b/src/org/apache/xpath/functions/math/FuncMathLog.java
@@ -64,7 +64,7 @@ public class FuncMathLog extends FunctionOneArg
           return resultSeq;
        }
           
-       XObject arg0Result = arg0.execute(xctxt);
+       XObject arg0Result = getEffectiveFuncArgValue(arg0, xctxt);
        
        if (arg0Result instanceof XNumber) {
           double resultVal = Math.log(((XNumber)arg0Result).num());
diff --git a/src/org/apache/xpath/functions/math/FuncMathLog10.java b/src/org/apache/xpath/functions/math/FuncMathLog10.java
index 405b24412..982d882ff 100644
--- a/src/org/apache/xpath/functions/math/FuncMathLog10.java
+++ b/src/org/apache/xpath/functions/math/FuncMathLog10.java
@@ -64,7 +64,7 @@ public class FuncMathLog10 extends FunctionOneArg
           return resultSeq;
        }
           
-       XObject arg0Result = arg0.execute(xctxt);
+       XObject arg0Result = getEffectiveFuncArgValue(arg0, xctxt);
        
        if (arg0Result instanceof XNumber) {
           double resultVal = Math.log10(((XNumber)arg0Result).num());
diff --git a/src/org/apache/xpath/functions/math/FuncMathPi.java b/src/org/apache/xpath/functions/math/FuncMathPi.java
index 3eaa68f91..731e1701a 100644
--- a/src/org/apache/xpath/functions/math/FuncMathPi.java
+++ b/src/org/apache/xpath/functions/math/FuncMathPi.java
@@ -55,7 +55,7 @@ public class FuncMathPi extends Function
    */
   public void fixupVariables(java.util.Vector vars, int globalsSize)
   {
-    // no-op
+     // NO OP
   }
 
 }
diff --git a/src/org/apache/xpath/functions/math/FuncMathPow.java b/src/org/apache/xpath/functions/math/FuncMathPow.java
index 7951fccaa..68e05ea5b 100644
--- a/src/org/apache/xpath/functions/math/FuncMathPow.java
+++ b/src/org/apache/xpath/functions/math/FuncMathPow.java
@@ -46,8 +46,8 @@ public class FuncMathPow extends Function2Args {
         
         SourceLocator srcLocator = xctxt.getSAXLocator();
         
-        XObject arg0Result = (getArg0()).execute(xctxt);        
-        XObject arg1Result = (getArg1()).execute(xctxt);
+        XObject arg0Result = getEffectiveFuncArgValue(getArg0(), xctxt);        
+        XObject arg1Result = getEffectiveFuncArgValue(getArg1(), xctxt);
         
         double lDouble = getDoubleValue(arg0Result, srcLocator, "first");
         double rDouble = getDoubleValue(arg1Result, srcLocator, "second");
diff --git a/src/org/apache/xpath/functions/math/FuncMathSin.java b/src/org/apache/xpath/functions/math/FuncMathSin.java
index adb974a0c..94a1329eb 100644
--- a/src/org/apache/xpath/functions/math/FuncMathSin.java
+++ b/src/org/apache/xpath/functions/math/FuncMathSin.java
@@ -64,7 +64,7 @@ public class FuncMathSin extends FunctionOneArg
           return resultSeq;
        }
           
-       XObject arg0Result = arg0.execute(xctxt);
+       XObject arg0Result = getEffectiveFuncArgValue(arg0, xctxt);
        
        if (arg0Result instanceof XNumber) {
           double resultVal = Math.sin(((XNumber)arg0Result).num());
diff --git a/src/org/apache/xpath/functions/math/FuncMathSqrt.java b/src/org/apache/xpath/functions/math/FuncMathSqrt.java
index 3743d6439..4ce8875d2 100644
--- a/src/org/apache/xpath/functions/math/FuncMathSqrt.java
+++ b/src/org/apache/xpath/functions/math/FuncMathSqrt.java
@@ -63,8 +63,8 @@ public class FuncMathSqrt extends FunctionOneArg
           ResultSequence resultSeq = new ResultSequence();
           return resultSeq;
        }
-          
-       XObject arg0Result = arg0.execute(xctxt);
+       
+       XObject arg0Result = getEffectiveFuncArgValue(arg0, xctxt);
        
        if (arg0Result instanceof XNumber) {
           double resultVal = Math.sqrt(((XNumber)arg0Result).num());
@@ -125,4 +125,5 @@ public class FuncMathSqrt extends FunctionOneArg
        
        return result;
     }
+
 }
diff --git a/src/org/apache/xpath/functions/math/FuncMathTan.java b/src/org/apache/xpath/functions/math/FuncMathTan.java
index fb5f68ee8..92bda2579 100644
--- a/src/org/apache/xpath/functions/math/FuncMathTan.java
+++ b/src/org/apache/xpath/functions/math/FuncMathTan.java
@@ -64,7 +64,7 @@ public class FuncMathTan extends FunctionOneArg
           return resultSeq;
        }
           
-       XObject arg0Result = arg0.execute(xctxt);
+       XObject arg0Result = getEffectiveFuncArgValue(arg0, xctxt);
        
        if (arg0Result instanceof XNumber) {
           double resultVal = Math.tan(((XNumber)arg0Result).num());
diff --git a/tests/org/apache/xalan/xpath3/XPathExprFunctionCallSuffixTests.java b/tests/org/apache/xalan/xpath3/XPathExprFunctionCallSuffixTests.java
index 858ea65b0..cde77eafb 100644
--- a/tests/org/apache/xalan/xpath3/XPathExprFunctionCallSuffixTests.java
+++ b/tests/org/apache/xalan/xpath3/XPathExprFunctionCallSuffixTests.java
@@ -157,5 +157,55 @@ public class XPathExprFunctionCallSuffixTests extends XSLTransformTestsUtil {
         
         runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
     }
+    
+    @Test
+    public void xpathExprFunctionCallSuffixTest12() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test2.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test12.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test12.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xpathExprFunctionCallSuffixTest13() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test2.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test13.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test13.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xpathExprFunctionCallSuffixTest14() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test2.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test14.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test14.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xpathExprFunctionCallSuffixTest15() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test2.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test15.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test15.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xpathExprFunctionCallSuffixTest16() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test2.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test16.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test16.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
 
 }
diff --git a/tests/xpath_function_call_suffix/gold/test12.out b/tests/xpath_function_call_suffix/gold/test12.out
new file mode 100644
index 000000000..52af4e07c
--- /dev/null
+++ b/tests/xpath_function_call_suffix/gold/test12.out
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <num value="2">
+    <square>4</square>
+  </num>
+  <num value="4">
+    <square>16</square>
+  </num>
+  <num value="6">
+    <square>36</square>
+  </num>
+  <num value="8">
+    <square>64</square>
+  </num>
+  <num value="10">
+    <square>100</square>
+  </num>
+</result>
diff --git a/tests/xpath_function_call_suffix/gold/test13.out b/tests/xpath_function_call_suffix/gold/test13.out
new file mode 100644
index 000000000..52af4e07c
--- /dev/null
+++ b/tests/xpath_function_call_suffix/gold/test13.out
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <num value="2">
+    <square>4</square>
+  </num>
+  <num value="4">
+    <square>16</square>
+  </num>
+  <num value="6">
+    <square>36</square>
+  </num>
+  <num value="8">
+    <square>64</square>
+  </num>
+  <num value="10">
+    <square>100</square>
+  </num>
+</result>
diff --git a/tests/xpath_function_call_suffix/gold/test14.out b/tests/xpath_function_call_suffix/gold/test14.out
new file mode 100644
index 000000000..93ca5db41
--- /dev/null
+++ b/tests/xpath_function_call_suffix/gold/test14.out
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><result>4 16 36 64 100</result>
diff --git a/tests/xpath_function_call_suffix/gold/test15.out b/tests/xpath_function_call_suffix/gold/test15.out
new file mode 100644
index 000000000..93ca5db41
--- /dev/null
+++ b/tests/xpath_function_call_suffix/gold/test15.out
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><result>4 16 36 64 100</result>
diff --git a/tests/xpath_function_call_suffix/gold/test16.out b/tests/xpath_function_call_suffix/gold/test16.out
new file mode 100644
index 000000000..52af4e07c
--- /dev/null
+++ b/tests/xpath_function_call_suffix/gold/test16.out
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <num value="2">
+    <square>4</square>
+  </num>
+  <num value="4">
+    <square>16</square>
+  </num>
+  <num value="6">
+    <square>36</square>
+  </num>
+  <num value="8">
+    <square>64</square>
+  </num>
+  <num value="10">
+    <square>100</square>
+  </num>
+</result>
diff --git a/tests/xpath_function_call_suffix/test12.xsl b/tests/xpath_function_call_suffix/test12.xsl
new file mode 100644
index 000000000..d8aa93e18
--- /dev/null
+++ b/tests/xpath_function_call_suffix/test12.xsl
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:math="http://www.w3.org/2005/xpath-functions/math"
+                exclude-result-prefixes="math"				
+                version="3.0">
+                
+   <!-- Author: mukulg@apache.org -->                
+
+   <!-- use with test2.xml -->
+   
+   <!-- An XSLT test case to test, XPath path expression
+        having a dynamic function call suffix.
+   -->               			
+
+   <xsl:output method="xml" indent="yes"/>
+
+   <xsl:template match="/info">
+	  <result>
+	     <!-- Variable referring to an inline function definition, to calculate square of a number -->
+	     <xsl:variable name="sqr1" select="function($x) { $x * $x }"/>
+	     		 
+	     <xsl:for-each select="a/@val/$sqr1(number(.))">
+		   <num value="{math:sqrt(.)}">
+		      <square><xsl:value-of select="."/></square>
+		   </num>
+		 </xsl:for-each>
+      </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>
diff --git a/tests/xpath_function_call_suffix/test13.xsl b/tests/xpath_function_call_suffix/test13.xsl
new file mode 100644
index 000000000..0e8a137c5
--- /dev/null
+++ b/tests/xpath_function_call_suffix/test13.xsl
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:math="http://www.w3.org/2005/xpath-functions/math"
+                exclude-result-prefixes="xs math"				
+                version="3.0">
+                
+   <!-- Author: mukulg@apache.org -->                
+
+   <!-- use with test2.xml -->
+   
+   <!-- An XSLT test case to test, XPath path expression
+        having a dynamic function call suffix.
+   -->                			
+
+   <xsl:output method="xml" indent="yes"/>
+
+   <xsl:template match="/info">
+	  <result>
+	     <!-- Variable referring to an inline function definition, to calculate square of a number -->
+		 <xsl:variable name="sqr1" select="function($x as xs:double) as xs:double { $x * $x }"/>
+	     
+		 <xsl:for-each select="a/@val/$sqr1(xs:double(.))">
+		   <num value="{math:sqrt(.)}">
+		      <square><xsl:value-of select="."/></square>
+		   </num>
+		 </xsl:for-each>
+      </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>
diff --git a/tests/xpath_function_call_suffix/test14.xsl b/tests/xpath_function_call_suffix/test14.xsl
new file mode 100644
index 000000000..506e9e162
--- /dev/null
+++ b/tests/xpath_function_call_suffix/test14.xsl
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"                			
+                version="3.0">
+                
+   <!-- Author: mukulg@apache.org -->                
+
+   <!-- use with test2.xml -->
+   
+   <!-- An XSLT test case to test, XPath path expression
+        having a dynamic function call suffix.
+   -->                			
+
+   <xsl:output method="xml" indent="yes"/>
+
+   <xsl:template match="/info">
+	  <result>
+	     <!-- Variable referring to an inline function definition, to calculate square of a number -->
+	     <xsl:variable name="sqr1" select="function($x) { $x * $x }"/>
+		 
+	     <xsl:value-of select="a/@val/$sqr1(number(.))"/>		   
+      </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>
diff --git a/tests/xpath_function_call_suffix/test15.xsl b/tests/xpath_function_call_suffix/test15.xsl
new file mode 100644
index 000000000..f0bb4a8c1
--- /dev/null
+++ b/tests/xpath_function_call_suffix/test15.xsl
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"                				
+                version="3.0">
+                
+   <!-- Author: mukulg@apache.org -->                
+
+   <!-- use with test2.xml -->
+   
+   <!-- An XSLT test case to test, XPath path expression
+        having a dynamic function call suffix.
+   -->                 			
+
+   <xsl:output method="xml" indent="yes"/>
+
+   <xsl:template match="/info">
+	  <result>
+	     <!-- Variable referring to an inline function definition, to calculate square of a number -->
+	     <xsl:variable name="sqr1" select="function($x) { $x * $x }"/>
+		 
+	     <xsl:variable name="sqrSeq1" select="a/@val/$sqr1(number(.))"/>
+         <xsl:value-of select="$sqrSeq1"/>		 
+      </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>
diff --git a/tests/xpath_function_call_suffix/test16.xsl b/tests/xpath_function_call_suffix/test16.xsl
new file mode 100644
index 000000000..648c03801
--- /dev/null
+++ b/tests/xpath_function_call_suffix/test16.xsl
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:math="http://www.w3.org/2005/xpath-functions/math"
+                exclude-result-prefixes="math"				
+                version="3.0">
+                
+   <!-- Author: mukulg@apache.org -->                
+
+   <!-- use with test2.xml -->
+   
+   <!-- An XSLT test case to test, XPath path expression
+        having a dynamic function call suffix.
+   -->                			
+
+   <xsl:output method="xml" indent="yes"/>
+
+   <xsl:template match="/info">
+	  <result>
+	     <!-- Variable referring to an inline function definition, to calculate square of a number -->
+	     <xsl:variable name="sqr1" select="function($x) { $x * $x }"/>
+		 
+	     <xsl:iterate select="a/@val/$sqr1(number(.))">
+		   <num value="{math:sqrt(.)}">
+		      <square><xsl:value-of select="."/></square>
+		   </num>
+		 </xsl:iterate>
+      </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>


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