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 2025/06/09 12:11:36 UTC

(xalan-java) branch xalan-j_xslt3.0_mvn updated: committing implementation of xsl:param's attribute 'required' and few fixes for w3c xslt 3.0 test suite

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

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


The following commit(s) were added to refs/heads/xalan-j_xslt3.0_mvn by this push:
     new 1349c9b3f committing implementation of xsl:param's attribute 'required' and few fixes for w3c xslt 3.0 test suite
1349c9b3f is described below

commit 1349c9b3f66d2d94a5e1018933bd9bfdfca3cb59
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Mon Jun 9 17:41:20 2025 +0530

    committing implementation of xsl:param's attribute 'required' and few fixes for w3c xslt 3.0 test suite
---
 README                                             |   8 +-
 .../apache/xalan/processor/XSLTAttributeDef.java   |   5 +-
 .../org/apache/xalan/processor/XSLTSchema.java     |  11 +-
 .../org/apache/xalan/res/XSLTErrorResources.java   |   5 +
 .../apache/xalan/templates/ElemApplyTemplates.java | 151 ++++-
 .../org/apache/xalan/templates/ElemFunction.java   | 165 +++--
 .../java/org/apache/xalan/templates/ElemParam.java |  47 +-
 .../org/apache/xalan/templates/ElemTemplate.java   |   8 +-
 .../org/apache/xalan/templates/ElemValueOf.java    |  15 +
 .../org/apache/xalan/templates/ElemVariable.java   |  50 +-
 .../xpath/composite/SequenceTypeSupport.java       |  30 +-
 .../java/org/apache/xpath/operations/Equals.java   |  67 ++
 .../org/apache/xpath/operations/InstanceOf.java    |  22 +-
 .../java/org/apache/xpath/operations/Plus.java     | 730 ++++++++++-----------
 .../xalan/tests/w3c/xslt3/W3CXSLT3Tests.java       |   2 +-
 .../w3c/xslt3/result/attr/_as-test-set_result.xml  |  10 +-
 .../w3c/xslt3/result/attr/_avt-test-set_result.xml |   2 +-
 .../xslt3/result/attr/_match-test-set_result.xml   |   2 +-
 .../xslt3/result/attr/_select-test-set_result.xml  |   2 +-
 .../result/decl/_attribute-set-test-set_result.xml |   2 +-
 .../result/decl/_character-map-test-set_result.xml |   2 +-
 .../result/decl/_function-test-set_result.xml      |   8 +-
 .../result/decl/_variable-test-set_result.xml      |  14 +-
 .../xslt3/result/expr/_axes-test-set_result.xml    |   2 +-
 .../result/expr/_castable-test-set_result.xml      |   2 +-
 .../result/expr/_expression-test-set_result.xml    |   2 +-
 .../w3c/xslt3/result/expr/_for-test-set_result.xml |   2 +-
 .../_higher-order-functions-test-set_result.xml    |   2 +-
 .../xslt3/result/expr/_math-test-set_result.xml    |   2 +-
 .../result/expr/_nodetest-test-set_result.xml      |   2 +-
 .../xslt3/result/expr/_path-test-set_result.xml    |   2 +-
 .../result/expr/_predicate-test-set_result.xml     |   2 +-
 .../result/fn/_deep-equal-test-set_result.xml      |   2 +-
 .../result/fn/_format-number-test-set_result.xml   |   2 +-
 .../w3c/xslt3/result/fn/_key-test-set_result.xml   |   2 +-
 .../xslt3/result/fn/_position-test-set_result.xml  |   2 +-
 .../w3c/xslt3/result/fn/_root-test-set_result.xml  |   2 +-
 .../insn/_analyze-string-test-set_result.xml       |   2 +-
 .../insn/_apply-templates-test-set_result.xml      |   2 +-
 .../result/insn/_attribute-test-set_result.xml     |   2 +-
 .../result/insn/_call-template-test-set_result.xml |   4 +-
 .../xslt3/result/insn/_choose-test-set_result.xml  |   2 +-
 .../xslt3/result/insn/_copy-test-set_result.xml    |  74 +--
 .../xslt3/result/insn/_element-test-set_result.xml |   2 +-
 .../insn/_for-each-group-test-set_result.xml       |   2 +-
 .../xslt3/result/insn/_iterate-test-set_result.xml |   6 +-
 .../result/insn/_sequence-test-set_result.xml      |   2 +-
 .../xslt3/result/insn/_sort-test-set_result.xml    |   6 +-
 .../w3c/xslt3/result/insn/_try-test-set_result.xml |   2 +-
 .../xslt3/result/misc/_regex-test-set_result.xml   |   2 +-
 .../xslt3/result/type/_boolean-test-set_result.xml |   6 +-
 .../xslt3/result/type/_date-test-set_result.xml    |   2 +-
 .../xslt3/result/type/_node-test-set_result.xml    |   2 +-
 .../xslt3/result/type/_string-test-set_result.xml  |   2 +-
 .../result/w3c_xslt3_testsuite_xalan-j_result.xml  |  10 +-
 .../tests/xpath3/XPathInstanceOfExprTests.java     |  10 +
 src/test/resources/instanceof_expr/gold/test10.out |   6 +
 src/test/resources/instanceof_expr/test10.xsl      |  41 ++
 src/test/resources/xsl_try_catch/test8.xsl         |   7 +-
 59 files changed, 962 insertions(+), 618 deletions(-)

diff --git a/README b/README
index 89d81ef21..f6e390816 100644
--- a/README
+++ b/README
@@ -17,7 +17,7 @@
 
 Copyright 1999-2025 The Apache Software Foundation
 
-Document last modified : 2025-06-06
+Document last modified : 2025-06-09
 
 Authors:
    Gary Gregory <gg...@apache.org>
@@ -59,16 +59,16 @@ The Maven build results like following shall be produced:
 [INFO]  T E S T S
 [INFO] -------------------------------------------------------
 [INFO] Running org.apache.xalan.tests.main.AllXalanXSLT3Tests
-[INFO] Tests run: 1088, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 44.119 s - in org.apache.xalan.tests.main.AllXalanXSLT3Tests
+[INFO] Tests run: 1089, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 37.261 s - in org.apache.xalan.tests.main.AllXalanXSLT3Tests
 [INFO]
 [INFO] Results:
 [INFO]
-[INFO] Tests run: 1088, Failures: 0, Errors: 0, Skipped: 0
+[INFO] Tests run: 1089, Failures: 0, Errors: 0, Skipped: 0
 [INFO]
 [INFO] ------------------------------------------------------------------------
 [INFO] BUILD SUCCESS
 [INFO] ------------------------------------------------------------------------
-[INFO] Total time:  01:35 min
+[INFO] Total time:  01:24 min
 
 
 If the user needs to run Xalan-J's XSLT 3.0 implementation via Java code, the value of JVM's system property 
diff --git a/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java b/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java
index e86777023..8103eb46b 100644
--- a/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java
+++ b/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java
@@ -1469,13 +1469,14 @@ public class XSLTAttributeDef
   {
 
     // Is this already checked somewhere else?  -sb
-    if (!(value.equals("yes") || value.equals("true") || value.equals("no") || value.equals("false")))
+    if (!(value.equals("yes") || value.equals("true") || value.equals("1") || 
+    	  value.equals("no") || value.equals("false") || value.equals("0")))
     {
       handleError(handler, XSLTErrorResources.INVALID_BOOLEAN, new Object[] {name,value}, null);
       return null;
    }
  
-     return new Boolean((value.equals("yes") || value.equals("true")) ? true : false);
+     return new Boolean((value.equals("yes") || value.equals("true") || value.equals("1")) ? true : false);
   }
 
   /**
diff --git a/src/main/java/org/apache/xalan/processor/XSLTSchema.java b/src/main/java/org/apache/xalan/processor/XSLTSchema.java
index ea7f6cf43..f733bb078 100644
--- a/src/main/java/org/apache/xalan/processor/XSLTSchema.java
+++ b/src/main/java/org/apache/xalan/processor/XSLTSchema.java
@@ -200,6 +200,11 @@ public class XSLTSchema extends XSLTElementDef
     // xsl:merge-source
     XSLTAttributeDef sortBeforeMergeAttrOpt = new XSLTAttributeDef(null, "sort-before-merge",
                                      XSLTAttributeDef.T_YESNO, false, false, XSLTAttributeDef.WARNING);
+    
+    // Optional.
+    // xsl:param                                      
+    XSLTAttributeDef requiredAttrOpt = new XSLTAttributeDef(null, "required",
+                                     XSLTAttributeDef.T_YESNO, false, false, XSLTAttributeDef.ERROR);
 
     // xsl:key                                 
     XSLTAttributeDef useAttr = new XSLTAttributeDef(null, "use",
@@ -819,8 +824,8 @@ public class XSLTSchema extends XSLTElementDef
                                 Constants.S_XSLNAMESPACEURL, "param",
                                 null /*alias */,
                                 templateElements /* elements */,  // %template;>
-                                new XSLTAttributeDef[]{ nameAttrRequired,
-                                                        selectAttrOpt, asAttrOpt, tunnelAttrOpt }, 
+                                new XSLTAttributeDef[]{ nameAttrRequired, selectAttrOpt, 
+                                		                asAttrOpt, tunnelAttrOpt, requiredAttrOpt }, 
                                                         new ProcessorTemplateElem(),
                                                         ElemParam.class /* class object */, 19, true);
     XSLTElementDef xslText =
@@ -1160,7 +1165,7 @@ public class XSLTSchema extends XSLTElementDef
                                            templateElementsAndParams /* elements */,
                                            new XSLTAttributeDef[]{
                                                    matchAttrOpt,
-                                                   nameAttrOpt_ERROR,
+                                                   nameAttrOpt_ERROR,                                                   
                                                    priorityAttr,
                                                    modeAttr,
                                                    asAttrOpt,
diff --git a/src/main/java/org/apache/xalan/res/XSLTErrorResources.java b/src/main/java/org/apache/xalan/res/XSLTErrorResources.java
index c1ddaa5cc..e7d197c5d 100644
--- a/src/main/java/org/apache/xalan/res/XSLTErrorResources.java
+++ b/src/main/java/org/apache/xalan/res/XSLTErrorResources.java
@@ -405,6 +405,8 @@ public class XSLTErrorResources extends ListResourceBundle
 	 "ER_FUNCTION_NOT_FOUND"; 
   public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = 
      "ER_CANT_HAVE_CONTENT_AND_SELECT";
+  public static final String ER_CANT_HAVE_CONTENT_AND_SELECT_LOC_AWARE = 
+     "ER_CANT_HAVE_CONTENT_AND_SELECT_LOC_AWARE";		  
   public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE";    
   public static final String ER_SET_FEATURE_NULL_NAME =
   	"ER_SET_FEATURE_NULL_NAME";
@@ -1191,6 +1193,9 @@ public class XSLTErrorResources extends ListResourceBundle
     // an XSLT keyword in this case and must not be translated.
     { ER_CANT_HAVE_CONTENT_AND_SELECT,
      "The {0} element must not have both content and a select attribute."},
+    
+    { ER_CANT_HAVE_CONTENT_AND_SELECT_LOC_AWARE,
+     "Line : {0}, Column : {1}. The {2} element must not have both content and a select attribute."},
 
     // Note to translators:  This message indicates that the value argument
     // of setParameter must be a valid Java Object.
diff --git a/src/main/java/org/apache/xalan/templates/ElemApplyTemplates.java b/src/main/java/org/apache/xalan/templates/ElemApplyTemplates.java
index 6b47ad4fb..38b36b4ac 100644
--- a/src/main/java/org/apache/xalan/templates/ElemApplyTemplates.java
+++ b/src/main/java/org/apache/xalan/templates/ElemApplyTemplates.java
@@ -34,6 +34,7 @@ import javax.xml.transform.TransformerException;
 import org.apache.xalan.transformer.StackGuard;
 import org.apache.xalan.transformer.TransformerImpl;
 import org.apache.xalan.xslt.util.XslTransformEvaluationHelper;
+import org.apache.xerces.xs.XSTypeDefinition;
 import org.apache.xml.dtm.DTM;
 import org.apache.xml.dtm.DTMCursorIterator;
 import org.apache.xml.serializer.SerializationHandler;
@@ -42,8 +43,10 @@ import org.apache.xml.utils.QName;
 import org.apache.xpath.VariableStack;
 import org.apache.xpath.XPath;
 import org.apache.xpath.XPathContext;
+import org.apache.xpath.composite.SequenceTypeData;
 import org.apache.xpath.composite.SequenceTypeSupport;
 import org.apache.xpath.composite.XPathSequenceConstructor;
+import org.apache.xpath.objects.ElemFunctionItem;
 import org.apache.xpath.objects.ResultSequence;
 import org.apache.xpath.objects.XBoolean;
 import org.apache.xpath.objects.XBooleanStatic;
@@ -51,9 +54,11 @@ import org.apache.xpath.objects.XMLNodeCursorImpl;
 import org.apache.xpath.objects.XNodeSetForDOM;
 import org.apache.xpath.objects.XNumber;
 import org.apache.xpath.objects.XObject;
+import org.apache.xpath.objects.XPathInlineFunction;
 import org.apache.xpath.objects.XRTreeFrag;
 import org.apache.xpath.objects.XString;
 import org.apache.xpath.operations.Variable;
+import org.apache.xpath.patterns.NodeTest;
 import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
@@ -469,6 +474,10 @@ public class ElemApplyTemplates extends ElemCallTemplate
 				  guard.checkForInfiniteLoop();
 
 			  int currentFrameBottom;
+			  
+			  XPath templateMatchXPath = template.getMatch();
+			  String templateMatchPatternStr = templateMatchXPath.getPatternString();
+			  
 			  if (template.m_frameSize > 0)
 			  {
 				  xctxt.pushRTFContext();
@@ -492,7 +501,27 @@ public class ElemApplyTemplates extends ElemCallTemplate
 								  if (ewp.m_qnameID == ep.m_qnameID)                  
 								  {
 									  XObject obj = vars.getLocalVariable(i, argsFrame);
-									  vars.setLocalVariable(paramIndex, obj);
+
+									  XObject argConvertedVal = null;
+									  String paramAsAttrStrVal = ep.getAs();
+
+									  if (paramAsAttrStrVal != null) {
+										  argConvertedVal = getParamValueAsAttributeProcessing(obj, templateMatchPatternStr, 
+												                                               elem.getPrefixTable(), i, paramAsAttrStrVal, transformer, xctxt);
+									  }
+									  else {
+										  argConvertedVal = obj;  
+									  }
+
+									  if (argConvertedVal instanceof ResultSequence) {                
+										  XMLNodeCursorImpl nodeSet = XslTransformEvaluationHelper.getXNodeSetFromResultSequence((ResultSequence)argConvertedVal, 
+												  xctxt);
+										  if (nodeSet != null) {
+											  argConvertedVal = nodeSet;  
+										  }
+									  }
+
+									  vars.setLocalVariable(paramIndex, argConvertedVal);
 									  break;
 								  }
 							  }              
@@ -626,6 +655,101 @@ public class ElemApplyTemplates extends ElemCallTemplate
 	  }
   }
 
+  /**
+   * Method definition to do type checking and required modification of xsl:template's xsl:param
+   * value using the XPath sequence type expression from xsl:param's 'as' attribute.
+   * 
+   * @param srcValue								      An XDM value on which type checking and 
+   *                                                      value conversion is required.
+   * @param templateMatchPatternStr                       xsl:template element's 'match' attribute's value
+   * @param prefixTable									  An XSL transformation's run-time XML namespace
+   *                                                      prefix table list.
+   * @param paramIdx									  An xsl:param's relative index value within sibling 
+   *                                                      xsl:param elements. 
+   * @param paramAsAttrStrVal							  String value of xsl:param's 'as' attribute
+   * @param transformer                                   An XSL transformation run-time TransformerImpl object
+   * @param xctxt										  An XPath context object
+   * @return											  An XDM value produced after conversion using xsl:param's 
+   *                                                      XPath sequence type 'as' attribute.
+   * @throws TransformerException
+   */
+  private XObject getParamValueAsAttributeProcessing(XObject srcValue, String templateMatchPatternStr, List prefixTable, 
+		                                             int paramIdx, String paramAsAttrStrVal, TransformerImpl transformer, 
+		                                             XPathContext xctxt) throws TransformerException {
+
+	  XObject argConvertedVal = null;
+
+	  SourceLocator srcLocator = xctxt.getSAXLocator(); 
+
+	  try {
+		  XPath seqTypeXPath = new XPath(paramAsAttrStrVal, srcLocator, xctxt.getNamespaceContext(), XPath.SELECT, null, true);            
+		  XObject seqTypeExpressionEvalResult = seqTypeXPath.execute(xctxt, xctxt.getContextNode(), xctxt.getNamespaceContext());
+		  SequenceTypeData seqExpectedTypeData = (SequenceTypeData)seqTypeExpressionEvalResult;
+
+		  XMLNodeCursorImpl nodeSet = SequenceTypeSupport.getNodeReference(srcValue);
+		  if (nodeSet != null) {
+			  XSTypeDefinition typeDef = nodeSet.getXsTypeDefinition();                    	                      	                      	  
+			  if (typeDef != null) {                    		  
+				  XSTypeDefinition typeDef2 = seqExpectedTypeData.getXsTypeDefinition();
+				  if (typeDef2 != null && isTypeXsDefinitionEqual(typeDef, typeDef2)) {                            	  
+					  argConvertedVal = nodeSet;                      			
+				  }
+				  else {
+					  throw new TransformerException("XPTY0004 : An XSL template call parameter value at position " + (paramIdx + 1) + " for "
+																							  + "template {" + templateMatchPatternStr + "}, doesn't "
+																							  + "match the declared parameter type " + paramAsAttrStrVal + ".", srcLocator);
+				  }
+			  }                    	  
+			  else if (seqExpectedTypeData.getSequenceTypeFunctionTest() != null) {                    		  
+				  DTMCursorIterator dtmIter = nodeSet.getContainedIter();                    		  
+				  if (dtmIter instanceof NodeTest) {
+					  try {
+						  ElemFunction elemFunction = XslTransformEvaluationHelper.getElemFunctionFromNodeTestExpression(
+								  																					(NodeTest)dtmIter, transformer, srcLocator);
+						  if (elemFunction != null) {
+							  // REVISIT : To check for elemFunction object's conformance with details in 
+							  // the object seqExpectedTypeData.getSequenceTypeFunctionTest()  
+							  argConvertedVal = new ElemFunctionItem(elemFunction);
+						  }
+					  }
+					  catch (TransformerException ex) {
+						  // NO OP
+					  }
+				  }
+			  }
+		  }
+		  else if ((seqExpectedTypeData.getSequenceTypeFunctionTest() != null) && (srcValue instanceof XPathInlineFunction)) {
+			  // REVISIT : To check for argValue's conformance with details in 
+			  // the object seqExpectedTypeData.getSequenceTypeFunctionTest()
+			  argConvertedVal = srcValue; 
+		  }
+
+		  if (argConvertedVal == null) {
+			  argConvertedVal = SequenceTypeSupport.castXDMValueToAnotherType(srcValue, paramAsAttrStrVal, null, xctxt, prefixTable);
+		  }
+
+		  if (argConvertedVal == null) {
+			  throw new TransformerException("XPTY0004 : An XSL template call parameter value at position " + (paramIdx + 1) + " for "
+																									  + "template {" + templateMatchPatternStr + "}, doesn't "
+																									  + "match the declared parameter type " + paramAsAttrStrVal + 
+																									  ".", srcLocator);
+		  }
+	  }
+	  catch (TransformerException ex) {
+		  if ((SequenceTypeSupport.INLINE_FUNCTION_PARAM_TYPECHECK_COUNT_ERROR).equals(ex.getMessage())) {
+			  throw new TransformerException("XPTY0004 : The number of XPath inline function parameters, is not equal to "
+					  																			+ "the number of expected type specifications for them.", srcLocator);   
+		  }
+		  else {
+			  throw new TransformerException("XPTY0004 : An XSL template call parameter value at position " + (paramIdx + 1) + " for "
+																							    + "template {" + templateMatchPatternStr + "}, doesn't "
+																							    + "match the declared parameter type " + paramAsAttrStrVal + ".", srcLocator);
+		  }
+	  }
+	  
+	  return argConvertedVal;	  
+  }
+
   /**
    * This method definition does, an XSL transformation for a sequence of 
    * XDM atomic values.
@@ -861,6 +985,31 @@ public class ElemApplyTemplates extends ElemCallTemplate
 	  return result;
   }
   
+  /**
+   * Check whether two XSTypeDefinition objects, represent the same schema type. 
+   */
+  private boolean isTypeXsDefinitionEqual(XSTypeDefinition typeDef1, XSTypeDefinition typeDef2) {	  
+	  boolean result = false;
+
+	  String typeName1 = typeDef1.getName();
+	  String typeNamespace1 = typeDef1.getNamespace();
+
+	  String typeName2 = typeDef2.getName();
+	  String typeNamespace2 = typeDef2.getNamespace();
+	  
+	  if ((typeNamespace1 == null) && (typeNamespace2 == null)) {
+		 result = typeName1.equals(typeName2);   
+	  }
+	  else if (((typeNamespace1 == null) && (typeNamespace2 != null)) || ((typeNamespace1 != null) && (typeNamespace2 == null))) {
+		 result = false; 
+	  }
+	  else if (typeNamespace1.equals(typeNamespace2) && typeName1.equals(typeName2)) {
+		 result = true; 
+	  }
+
+	  return result;
+  }
+  
   /**
    * A list containing objects of this class, is sortable in an ascending
    * order by numeric xs:double priority values.
diff --git a/src/main/java/org/apache/xalan/templates/ElemFunction.java b/src/main/java/org/apache/xalan/templates/ElemFunction.java
index f8d276f46..305a7f985 100644
--- a/src/main/java/org/apache/xalan/templates/ElemFunction.java
+++ b/src/main/java/org/apache/xalan/templates/ElemFunction.java
@@ -240,71 +240,8 @@ public class ElemFunction extends ElemTemplate
                  String paramAsAttrStrVal = ((ElemParam)elem).getAs();
                  
                  if (paramAsAttrStrVal != null) {
-                    try {
-                       XPath seqTypeXPath = new XPath(paramAsAttrStrVal, srcLocator, xctxt.getNamespaceContext(), XPath.SELECT, null, true);            
-                  	   XObject seqTypeExpressionEvalResult = seqTypeXPath.execute(xctxt, xctxt.getContextNode(), xctxt.getNamespaceContext());
-                  	   SequenceTypeData seqExpectedTypeData = (SequenceTypeData)seqTypeExpressionEvalResult;
-                  	  
-                       XMLNodeCursorImpl nodeSet = SequenceTypeSupport.getNodeReference(argValue);
-                       if (nodeSet != null) {
-                    	  XSTypeDefinition typeDef = nodeSet.getXsTypeDefinition();                    	                      	                      	  
-                    	  if (typeDef != null) {                    		  
-                              XSTypeDefinition typeDef2 = seqExpectedTypeData.getXsTypeDefinition();
-                              if (typeDef2 != null && isTypeXsDefinitionEqual(typeDef, typeDef2)) {                            	  
-                            	  argConvertedVal = nodeSet;                      			
-                              }
-                              else {
-                            	  throw new TransformerException("XPTY0004 : Function call argument at position " + (paramIdx + 1) + " for "
-                                                                                                  + "function {" + funcNameSpaceUri + "}" + funcLocalName + "(), doesn't "
-                                                                                                  + "match the declared parameter type " + paramAsAttrStrVal + ".", srcLocator);
-                              }
-                    	  }                    	  
-                    	  else if (seqExpectedTypeData.getSequenceTypeFunctionTest() != null) {                    		  
-                    		  DTMCursorIterator dtmIter = nodeSet.getContainedIter();                    		  
-                     		  if (dtmIter instanceof NodeTest) {
-                     			  try {
-                     				  ElemFunction elemFunction = XslTransformEvaluationHelper.getElemFunctionFromNodeTestExpression(
-                     						                                                                         (NodeTest)dtmIter, transformer, srcLocator);
-                     				  if (elemFunction != null) {
-                     					  // REVISIT : To check for elemFunction object's conformance with details in 
-                     					  // the object seqExpectedTypeData.getSequenceTypeFunctionTest()  
-                     					  argConvertedVal = new ElemFunctionItem(elemFunction);
-                     				  }
-                     			  }
-                     			  catch (TransformerException ex) {
-                     				  // NO OP
-                     			  }
-                     		  }
-                    	  }
-                       }
-                       else if ((seqExpectedTypeData.getSequenceTypeFunctionTest() != null) && (argValue instanceof XPathInlineFunction)) {
-                    	  // REVISIT : To check for argValue's conformance with details in 
-      					  // the object seqExpectedTypeData.getSequenceTypeFunctionTest()
-                  		  argConvertedVal = argValue; 
-                  	   }
-                       
-                       if (argConvertedVal == null) {
-                          argConvertedVal = SequenceTypeSupport.castXDMValueToAnotherType(argValue, paramAsAttrStrVal, null, 
-                    		                                                                                        xctxt, elem.getPrefixTable());
-                       }
-                       
-                       if (argConvertedVal == null) {
-                          throw new TransformerException("XPTY0004 : Function call argument at position " + (paramIdx + 1) + " for "
-                                                                            + "function {" + funcNameSpaceUri + "}" + funcLocalName + "(), doesn't "
-                                                                            + "match the declared parameter type " + paramAsAttrStrVal + ".", srcLocator); 
-                       }
-                    }
-                    catch (TransformerException ex) {
-                       if ((SequenceTypeSupport.INLINE_FUNCTION_PARAM_TYPECHECK_COUNT_ERROR).equals(ex.getMessage())) {
-                    	  throw new TransformerException("XPTY0004 : The number of inline function parameters, is not equal to "
-                    	  		                                             + "the number of expected type specifications for them.", srcLocator);   
-                       }
-                       else {
-                          throw new TransformerException("XPTY0004 : Function call argument at position " + (paramIdx + 1) + " for "
-                                                                                 + "function {" + funcNameSpaceUri + "}" + funcLocalName + "(), doesn't "
-                                                                                 + "match the declared parameter type " + paramAsAttrStrVal + ".", srcLocator);
-                       }
-                    }
+                    argConvertedVal = getParamValueAsAttributeProcessing(argValue, funcLocalName, funcNameSpaceUri, paramIdx, 
+                    		                                             elem.getPrefixTable(), paramAsAttrStrVal, transformer, xctxt);
                  }
                  else {
                 	argConvertedVal = argValue;  
@@ -398,7 +335,7 @@ public class ElemFunction extends ElemTemplate
       return funcResultConvertedVal;
   }
 
- /**
+  /**
    * This function is called after everything else has been
    * recomposed, and allows a xsl:function to set remaining
    * values that may be based on some other property that
@@ -743,5 +680,101 @@ public class ElemFunction extends ElemTemplate
 
 	  return seqTypeData;
   }
+  
+  /**
+   * Method definition to do type checking and required modification of xsl:function's xsl:param
+   * value using the XPath sequence type expression from xsl:param's 'as' attribute.
+   * 
+   * @param srcValue								      An XDM value on which type checking and 
+   *                                                      value conversion is required.
+   * @param funcLocalName								  An xsl:function's local name value from it's QName value
+   * @param funcNameSpaceUri                              An xsl:function's QName name's namespace uri                              	                                                      
+   * @param paramIdx									  An xsl:param's relative index value within sibling 
+   *                                                      xsl:param elements.
+   * @param prefixTable									  An XSL transformation's run-time XML namespace
+   *                                                      prefix table list.                                                       
+   * @param paramAsAttrStrVal							  String value of xsl:param's 'as' attribute
+   * @param transformer                                   An XSL transformation run-time TransformerImpl object
+   * @param xctxt										  An XPath context object
+   * @return											  An XDM value produced after conversion using xsl:param's 
+   *                                                      XPath sequence type 'as' attribute.
+   * @throws TransformerException
+   */
+  private XObject getParamValueAsAttributeProcessing(XObject srcValue, String funcLocalName, String funcNameSpaceUri, 
+		                                             int paramIdx, List prefixTable, String paramAsAttrStrVal, 
+		                                             TransformerImpl transformer, XPathContext xctxt) throws TransformerException {
+		
+	  XObject argConvertedVal = null;
+
+	  SourceLocator srcLocator = xctxt.getSAXLocator();
+
+	  try {
+		  XPath seqTypeXPath = new XPath(paramAsAttrStrVal, srcLocator, xctxt.getNamespaceContext(), XPath.SELECT, null, true);            
+		  XObject seqTypeExpressionEvalResult = seqTypeXPath.execute(xctxt, xctxt.getContextNode(), xctxt.getNamespaceContext());
+		  SequenceTypeData seqExpectedTypeData = (SequenceTypeData)seqTypeExpressionEvalResult;
+
+		  XMLNodeCursorImpl nodeSet = SequenceTypeSupport.getNodeReference(srcValue);
+		  if (nodeSet != null) {
+			  XSTypeDefinition typeDef = nodeSet.getXsTypeDefinition();                    	                      	                      	  
+			  if (typeDef != null) {                    		  
+				  XSTypeDefinition typeDef2 = seqExpectedTypeData.getXsTypeDefinition();
+				  if (typeDef2 != null && isTypeXsDefinitionEqual(typeDef, typeDef2)) {                            	  
+					  argConvertedVal = nodeSet;                      			
+				  }
+				  else {
+					  throw new TransformerException("XPTY0004 : An xsl:function call argument at position " + (paramIdx + 1) + " for "
+																								  + "function {" + funcNameSpaceUri + "}" + funcLocalName + "(), doesn't "
+																								  + "match the declared parameter type " + paramAsAttrStrVal + ".", srcLocator);
+				  }
+			  }                    	  
+			  else if (seqExpectedTypeData.getSequenceTypeFunctionTest() != null) {                    		  
+				  DTMCursorIterator dtmIter = nodeSet.getContainedIter();                    		  
+				  if (dtmIter instanceof NodeTest) {
+					  try {
+						  ElemFunction elemFunction = XslTransformEvaluationHelper.getElemFunctionFromNodeTestExpression(
+								  (NodeTest)dtmIter, transformer, srcLocator);
+						  if (elemFunction != null) {
+							  // REVISIT : To check for elemFunction object's conformance with details in 
+							  // the object seqExpectedTypeData.getSequenceTypeFunctionTest()  
+							  argConvertedVal = new ElemFunctionItem(elemFunction);
+						  }
+					  }
+					  catch (TransformerException ex) {
+						  // NO OP
+					  }
+				  }
+			  }
+		  }
+		  else if ((seqExpectedTypeData.getSequenceTypeFunctionTest() != null) && (srcValue instanceof XPathInlineFunction)) {
+			  // REVISIT : To check for argValue's conformance with details in 
+			  // the object seqExpectedTypeData.getSequenceTypeFunctionTest()
+			  argConvertedVal = srcValue; 
+		  }
+
+		  if (argConvertedVal == null) {
+			  argConvertedVal = SequenceTypeSupport.castXDMValueToAnotherType(srcValue, paramAsAttrStrVal, null, 
+					  xctxt, prefixTable);
+		  }
+
+		  if (argConvertedVal == null) {
+			  throw new TransformerException("XPTY0004 : An xsl:function call argument at position " + (paramIdx + 1) + " for "
+																					  + "function {" + funcNameSpaceUri + "}" + funcLocalName + "(), doesn't "
+																					  + "match the declared parameter type " + paramAsAttrStrVal + ".", srcLocator); 
+		  }
+	  }
+	  catch (TransformerException ex) {
+		  if ((SequenceTypeSupport.INLINE_FUNCTION_PARAM_TYPECHECK_COUNT_ERROR).equals(ex.getMessage())) {
+			  throw new TransformerException("XPTY0004 : The number of XPath inline function parameters, is not equal to "
+					  																  + "the number of expected type specifications for them.", srcLocator);   
+		  }
+		  else {
+			  throw new TransformerException("XPTY0004 : An xsl:function call argument at position " + (paramIdx + 1) + " for "
+																					  + "function {" + funcNameSpaceUri + "}" + funcLocalName + "(), doesn't "
+																					  + "match the declared parameter type " + paramAsAttrStrVal + ".", srcLocator);
+		  }
+	  }
+
+	  return argConvertedVal;	  
+	}
 
 }
diff --git a/src/main/java/org/apache/xalan/templates/ElemParam.java b/src/main/java/org/apache/xalan/templates/ElemParam.java
index 54464d828..0ab8d19b3 100644
--- a/src/main/java/org/apache/xalan/templates/ElemParam.java
+++ b/src/main/java/org/apache/xalan/templates/ElemParam.java
@@ -32,6 +32,7 @@ import org.apache.xml.utils.QName;
 import org.apache.xpath.VariableStack;
 import org.apache.xpath.XPathContext;
 import org.apache.xpath.composite.SequenceTypeSupport;
+import org.apache.xpath.objects.ResultSequence;
 import org.apache.xpath.objects.XObject;
 
 /**
@@ -71,6 +72,29 @@ public class ElemParam extends ElemVariable
   {
      return m_tunnelAttr;
   }
+  
+  /**
+   * An optional "required" attribute.
+   */
+  private boolean m_required = true;
+  
+  /**
+   * Set the "required" attribute.
+   * 
+   * @param required
+   */
+  public void setRequired(boolean required) {
+	  m_required = required; 
+  }
+  
+  /**
+   * Get the "required" attribute.
+   * 
+   * @return
+   */
+  public boolean getRequired() {
+	  return m_required;
+  }
 
   /**
    * Get an int constant identifying the type of element.
@@ -123,7 +147,6 @@ public class ElemParam extends ElemVariable
   
   /**
    * Execute a variable declaration and push it onto the variable stack.
-   * @see <a href="http://www.w3.org/TR/xslt#variables">variables in XSLT Specification</a>
    *
    * @param transformer non-null reference to the the current transform-time state.
    *
@@ -163,6 +186,7 @@ public class ElemParam extends ElemVariable
         
         try {
            XObject var = getValue(transformer, sourceNode);
+           
            if (var != null) {        	  
               transformer.getXPathContext().getVarStack().setLocalVariable(m_index, var);        	  
            }
@@ -173,9 +197,24 @@ public class ElemParam extends ElemVariable
            }
         }
         catch (TransformerException ex) {
-        	throw new TransformerException("XTTE0590 : The value to parameter '" + m_qname.toString() + "' cannot be assigned. "
-														                    + "Either the parameter's input is not available or parameter's value "
-														                    + "cannot be cast to an expected type.", srcLocator);   
+        	if (getParentElem() instanceof ElemTemplate) {        		
+        		org.apache.xpath.XPath selectXPathObj = getSelect();
+        		ElemTemplateElement elemTemplateElem = getFirstChildElem();
+        		if (!m_required && (selectXPathObj == null) && (elemTemplateElem == null)) {
+        			// Set the value of xsl:template parameter, to the default value i.e an empty sequence
+        		    transformer.getXPathContext().getVarStack().setLocalVariable(m_index, new ResultSequence());
+        		}
+        		else {
+        			throw new TransformerException("XTDE0700 : No value supplied for the required parameter $" + m_qname.toString() + ". "
+												        					+ "A value is required for the parameter because the"
+												        					+ " default value is not a valid instance of the required type.", srcLocator);
+        		}
+        	}
+        	else {
+	        	throw new TransformerException("XTTE0590 : The value to parameter '" + m_qname.toString() + "' cannot be assigned. "
+															                    + "Either the parameter's input is not available or parameter's value "
+															                    + "cannot be cast to an expected type.", srcLocator);
+        	}
         }	
     }
     else if (!(getParentElem() instanceof ElemFunction)) {
diff --git a/src/main/java/org/apache/xalan/templates/ElemTemplate.java b/src/main/java/org/apache/xalan/templates/ElemTemplate.java
index 2d15979ab..cec1029b6 100644
--- a/src/main/java/org/apache/xalan/templates/ElemTemplate.java
+++ b/src/main/java/org/apache/xalan/templates/ElemTemplate.java
@@ -348,7 +348,7 @@ public class ElemTemplate extends ElemTemplateElement
 	  
 	  StylesheetRoot.ComposeState cstate = sroot.getComposeState();
 	  java.util.Vector vnames = cstate.getVariableNames();
-	  if(null != m_matchPattern)
+	  if (null != m_matchPattern)
 		  m_matchPattern.fixupVariables(vnames, sroot.getComposeState().getGlobalsSize());
 
 	  cstate.resetStackFrameSize();
@@ -441,7 +441,8 @@ public class ElemTemplate extends ElemTemplateElement
 		  }
 		  catch (TransformerException ex) {
 			  String errMesg = ex.getMessage();
-			  if ((errMesg != null) && (errMesg.startsWith("XTTE0505") || errMesg.startsWith("XTTE0590"))) {
+			  if ((errMesg != null) && (errMesg.startsWith("XTTE0505") || errMesg.startsWith("XTTE0590") || 
+					                                                      errMesg.startsWith("XTDE0700"))) {
 				  throw ex;   
 			  }
 			  else {
@@ -476,7 +477,8 @@ public class ElemTemplate extends ElemTemplateElement
 	  
 	  Object xslFunctionResult = transformer.transformToGlobalRTFXslFunctionOrTemplate(this);
 	  
-	  Integer nodeDtmHandle = null;	  
+	  Integer nodeDtmHandle = null;
+	  
 	  try {
 		 nodeDtmHandle = Integer.valueOf(xslFunctionResult.toString());
 	     NodeList nodeList = (new XRTreeFrag(nodeDtmHandle.intValue(), xctxt, this)).convertToNodeset();
diff --git a/src/main/java/org/apache/xalan/templates/ElemValueOf.java b/src/main/java/org/apache/xalan/templates/ElemValueOf.java
index e4720d236..9d4f63300 100644
--- a/src/main/java/org/apache/xalan/templates/ElemValueOf.java
+++ b/src/main/java/org/apache/xalan/templates/ElemValueOf.java
@@ -394,6 +394,7 @@ public class ElemValueOf extends ElemTemplateElement {
                   }
                   else if (expr instanceof Variable) {
                       XObject evalResult = ((Variable)expr).execute(xctxt);
+                      
                       String strValue = null;
                       
                       if (evalResult instanceof XSAnyType) {
@@ -435,6 +436,20 @@ public class ElemValueOf extends ElemTemplateElement {
                       else if (evalResult instanceof ResultSequence) {
                     	 strValue = getEffectiveSequenceStrValue((ResultSequence)evalResult); 
                       }
+                      else if (evalResult instanceof XMLNodeCursorImpl) {
+                    	 XMLNodeCursorImpl xmlNodeCursorImpl = (XMLNodeCursorImpl)evalResult;
+                    	 DTMCursorIterator iter = xmlNodeCursorImpl.iterRaw();
+                    	 int nextNode;                    	 
+                    	 StringBuffer strBuff = new StringBuffer();                    	                     	 
+                    	 while ((nextNode = iter.nextNode()) != DTM.NULL) {
+                    		 XMLNodeCursorImpl nodeImpl = new XMLNodeCursorImpl(nextNode, xctxt);
+                    		 String nodeStrValue = nodeImpl.str();
+                    		 strBuff.append(nodeStrValue + " ");
+                    	 }
+                    	 
+                    	 strValue = strBuff.toString();
+                    	 strValue = strValue.trim();
+                      }
                       else {
                     	 strValue = XslTransformEvaluationHelper.getStrVal(evalResult);  
                       }
diff --git a/src/main/java/org/apache/xalan/templates/ElemVariable.java b/src/main/java/org/apache/xalan/templates/ElemVariable.java
index 8c3cb2157..dba7d26c5 100644
--- a/src/main/java/org/apache/xalan/templates/ElemVariable.java
+++ b/src/main/java/org/apache/xalan/templates/ElemVariable.java
@@ -636,9 +636,9 @@ public class ElemVariable extends ElemTemplateElement
         }
         else if (selectExpression instanceof NodeTest) {
         	// Checking for the possibility of a top level xsl:variable or xsl:param 
-        	// instruction, referring to a named xsl:function reference.
+        	// instruction, referring to a named xsl:function reference.        	        	
         	
-        	try {    			
+        	try {            	
     			ExpressionNode expressionNode = selectExpression.getExpressionOwner();
     			ExpressionNode stylesheetRootNode = null;
     			while (expressionNode != null) {
@@ -657,13 +657,12 @@ public class ElemVariable extends ElemTemplateElement
     			TemplateList templateList = stylesheetRoot.getTemplateListComposed();
     			XSL3FunctionService m_xslFunctionService = XSLFunctionBuilder.getXSLFunctionService();
     			
-    			ElemFunction elemFunction = null;
-    			
-    			if (m_xslFunctionService.isFuncArityWellFormed(funcLocalNameRef)) {        	   
+    			if (!"".equals(funcLocalNameRef) && m_xslFunctionService.isFuncArityWellFormed(funcLocalNameRef)) {        	   
     				int hashCharIdx = funcLocalNameRef.indexOf('#');
     				String funcNameRef2 = funcLocalNameRef.substring(0, hashCharIdx);
     				int funcArity = Integer.valueOf(funcLocalNameRef.substring(hashCharIdx + 1));        		   
-    				ElemTemplate elemTemplate = templateList.getXslFunction(new QName(funcNamespace, funcNameRef2), funcArity);        		   
+    				ElemTemplate elemTemplate = templateList.getXslFunction(new QName(funcNamespace, funcNameRef2), funcArity);
+    				ElemFunction elemFunction = null;
     				if (elemTemplate != null) {
     					elemFunction = (ElemFunction)elemTemplate;
     					int xslFuncDefnParamCount = elemFunction.getParamCount();                      
@@ -671,21 +670,16 @@ public class ElemVariable extends ElemTemplateElement
     					int funcRefParamCount = (Integer.valueOf(str)).intValue();
     					if (funcRefParamCount != xslFuncDefnParamCount) {
     						throw new javax.xml.transform.TransformerException("FORG0006 : An XSL named function reference " + funcLocalNameRef 
-																					    								     + " cannot resolve to a function "
-																					    								     + "definition.", srcLocator); 
+																					    								+ " cannot resolve to a function "
+																					    								+ "definition.", srcLocator); 
     					}
-    				}
-    			}
-    			else {
-    				throw new javax.xml.transform.TransformerException("FORG0006 : An XSL named function reference " + funcLocalNameRef 
-																							    					 + " cannot resolve to a function "
-																							    					 + "definition.", srcLocator);
-    			}
-
-    			if (elemFunction != null) {
-    				ElemFunctionItem elemFunctionObject = new ElemFunctionItem(elemFunction);
+    					
+    					if (elemFunction != null) {
+    	    				ElemFunctionItem elemFunctionObject = new ElemFunctionItem(elemFunction);
 
-    				return elemFunctionObject; 
+    	    				return elemFunctionObject; 
+    	    			}
+    				}
     			}
     		}
     		catch (Exception ex) {
@@ -695,6 +689,14 @@ public class ElemVariable extends ElemTemplateElement
   
         if (var == null) {
            var = m_selectPattern.execute(xctxt, sourceNode, this);
+           if (this instanceof ElemParam) {
+        	   if (var instanceof XSString) {
+        		   var = new XSString((((XSString)var).stringValue()).trim());  
+        	   }
+        	   else if (var instanceof XString) {
+        		   var = new XString((((XString)var).str()).trim());  
+        	   }
+           }
         }
         
         if (var != null) {
@@ -1068,12 +1070,16 @@ public class ElemVariable extends ElemTemplateElement
    * child just added to the child list 
    */
   public ElemTemplateElement appendChild(ElemTemplateElement elem)
-  {
+  {	  
     // cannot have content and select
     if (m_selectPattern != null)
     {
-      error(XSLTErrorResources.ER_CANT_HAVE_CONTENT_AND_SELECT, 
-          new Object[]{"xsl:" + this.getNodeName()});
+      SourceLocator srcLocator = m_selectPattern.getLocator();	
+      Integer lineNo = srcLocator.getLineNumber();
+      Integer colNo = srcLocator.getColumnNumber();
+      
+      error(XSLTErrorResources.ER_CANT_HAVE_CONTENT_AND_SELECT_LOC_AWARE, 
+    		  		new Object[]{lineNo, colNo, "xsl:" + this.getNodeName()});
       return null;
     }
     return super.appendChild(elem);
diff --git a/src/main/java/org/apache/xpath/composite/SequenceTypeSupport.java b/src/main/java/org/apache/xpath/composite/SequenceTypeSupport.java
index 8707fe904..f429f8641 100644
--- a/src/main/java/org/apache/xpath/composite/SequenceTypeSupport.java
+++ b/src/main/java/org/apache/xpath/composite/SequenceTypeSupport.java
@@ -716,7 +716,7 @@ public class SequenceTypeSupport {
                    }
                 }
                 else {
-                   result = castStringValueToAnExpectedType(srcStrVal, expectedType);
+                   result = castStringValueToAnExpectedType(srcStrVal, expectedType, sequenceTypeXPathExprStr);
                 }
             }
             else if (srcValue instanceof XSString) {           
@@ -735,7 +735,7 @@ public class SequenceTypeSupport {
                   }
                }
                else {
-                  result = castStringValueToAnExpectedType(srcStrVal, expectedType);
+                  result = castStringValueToAnExpectedType(srcStrVal, expectedType, sequenceTypeXPathExprStr);
                }
             }
             else if (srcValue instanceof XNumber) {
@@ -1195,12 +1195,18 @@ public class SequenceTypeSupport {
 		return nodeSet;
 	}
     
-    /**
-     * Cast a string value to an expected xdm type.
-     * 
-     * @throws TransformerException
-     */
-    private static XObject castStringValueToAnExpectedType(String srcStrVal, int expectedType) throws TransformerException {
+	/**
+	 * Method definition to cast a string value to an expected XDM type.
+	 * 
+	 * @param srcStrVal									  Source string value
+	 * @param expectedType								  An expected type's integer code	
+	 * @param sequenceTypeXPathExprStr					  An expected type's XPath sequence type string value 
+	 *                                                    as provided within an XSL stylesheet.
+	 * @return											  An XDM value produced after the type cast operation	
+	 * @throws TransformerException
+	 */
+    private static XObject castStringValueToAnExpectedType(String srcStrVal, int expectedType, 
+    		                                               String sequenceTypeXPathExprStr) throws TransformerException {
         
         XObject result = null;
         
@@ -1304,16 +1310,16 @@ public class SequenceTypeSupport {
                result = new XSGMonth(srcStrVal); 
             }
             else {
-               throw new TransformerException("XTTE0570 : The string value '" + srcStrVal + "' cannot be "
-                                                                                                  + "cast to a type " + getDataTypeNameFromIntValue(expectedType) + "."); 
+               String effectiveTypeDefnStr = (sequenceTypeXPathExprStr != null) ? sequenceTypeXPathExprStr : getDataTypeNameFromIntValue(expectedType);  	               
+               throw new TransformerException("XTTE0570 : The supplied value cannot be cast to type " + effectiveTypeDefnStr + "."); 
             }
         }
         catch (TransformerException ex) {
             throw ex;    
         }
         catch (Exception ex) {
-            throw new TransformerException("XTTE0570 : The string value '" + srcStrVal + "' cannot be cast to "
-                                                                                               + "a type " + getDataTypeNameFromIntValue(expectedType) + ".");
+        	String effectiveTypeDefnStr = (sequenceTypeXPathExprStr != null) ? sequenceTypeXPathExprStr : getDataTypeNameFromIntValue(expectedType);        	
+        	throw new TransformerException("XTTE0570 : The supplied value cannot be cast to type " + effectiveTypeDefnStr + ".");
         }
         
         return result;
diff --git a/src/main/java/org/apache/xpath/operations/Equals.java b/src/main/java/org/apache/xpath/operations/Equals.java
index f102c4bef..43bac4898 100644
--- a/src/main/java/org/apache/xpath/operations/Equals.java
+++ b/src/main/java/org/apache/xpath/operations/Equals.java
@@ -21,13 +21,19 @@
 package org.apache.xpath.operations;
 
 import org.apache.xalan.xslt.util.XslTransformEvaluationHelper;
+import org.apache.xml.dtm.DTM;
+import org.apache.xml.dtm.DTMCursorIterator;
+import org.apache.xml.dtm.DTMManager;
 import org.apache.xpath.XPathContext;
 import org.apache.xpath.objects.ResultSequence;
 import org.apache.xpath.objects.XBoolean;
+import org.apache.xpath.objects.XBooleanStatic;
+import org.apache.xpath.objects.XMLNodeCursorImpl;
 import org.apache.xpath.objects.XNumber;
 import org.apache.xpath.objects.XObject;
 import org.apache.xpath.objects.XString;
 
+import xml.xpath31.processor.types.XSBoolean;
 import xml.xpath31.processor.types.XSNumericType;
 import xml.xpath31.processor.types.XSString;
 
@@ -77,6 +83,67 @@ public class Equals extends Operation
 			 result = (bool ? XBoolean.S_TRUE : XBoolean.S_FALSE);
 		 }
 	  }
+	  else if ((left instanceof XMLNodeCursorImpl) && (right instanceof XMLNodeCursorImpl)) {
+		 result = (left.equals(right) ? XBoolean.S_TRUE : XBoolean.S_FALSE);  
+	  }
+	  else if (left instanceof XMLNodeCursorImpl) {
+		 XMLNodeCursorImpl xmlNodeCursorImpl = (XMLNodeCursorImpl)left;
+		 DTMCursorIterator iter1 = xmlNodeCursorImpl.iterRaw();
+		 int nextNode;
+		 DTMManager dtmManager = iter1.getDTMManager();
+		 while ((nextNode = iter1.nextNode()) != DTM.NULL) {
+			XMLNodeCursorImpl xmlNodeCursorImpl1 = new XMLNodeCursorImpl(nextNode, dtmManager);
+			java.lang.String lStrValue = xmlNodeCursorImpl1.str();
+			try {
+				if (right instanceof XNumber) {
+					double lDbl = Double.valueOf(lStrValue);
+					XNumber rXNumber = (XNumber)right;
+					double rDbl = rXNumber.num();
+					if (lDbl == rDbl) {
+						return XBoolean.S_TRUE;
+					}
+				}
+				else if (right instanceof XSNumericType) {
+					double lDbl = Double.valueOf(lStrValue);
+					XSNumericType xsNumericType = (XSNumericType)right;
+					java.lang.String rStrValue = xsNumericType.stringValue();
+					double rDbl = Double.valueOf(rStrValue);
+					if (lDbl == rDbl) {
+					   return XBoolean.S_TRUE;
+					}
+				}
+				else if (right instanceof XSBoolean) {
+					java.lang.String rStrValue = ((XSBoolean)right).stringValue();
+					if (!"".equals(lStrValue) && ("1".equals(rStrValue) || "true".equals(rStrValue))) {
+						return XBoolean.S_TRUE;
+					}
+					else if ("".equals(lStrValue) && ("0".equals(rStrValue) || "false".equals(rStrValue))) {
+						return XBoolean.S_TRUE;
+					}
+				}
+				else if ((right instanceof XBoolean) || (right instanceof XBooleanStatic)) {
+					java.lang.String rStrValue = right.str();
+					if (!"".equals(lStrValue) && ("1".equals(rStrValue) || "true".equals(rStrValue))) {
+						return XBoolean.S_TRUE;
+					}
+					else if ("".equals(lStrValue) && ("0".equals(rStrValue) || "false".equals(rStrValue))) {
+						return XBoolean.S_TRUE;
+					}
+				}
+				else {
+					java.lang.String rStrValue = XslTransformEvaluationHelper.getStrVal(right);
+					if (lStrValue.equals(rStrValue)) {
+					   return XBoolean.S_TRUE;
+					}
+				}
+			}
+			catch (NumberFormatException ex) {
+				// NO OP
+			}
+		 }
+		 
+		 result = XBoolean.S_FALSE;
+	  }
 	  else {
 		 result = (left.equals(right) ? XBoolean.S_TRUE : XBoolean.S_FALSE);
 	  }
diff --git a/src/main/java/org/apache/xpath/operations/InstanceOf.java b/src/main/java/org/apache/xpath/operations/InstanceOf.java
index 059fe3854..0f64e3572 100644
--- a/src/main/java/org/apache/xpath/operations/InstanceOf.java
+++ b/src/main/java/org/apache/xpath/operations/InstanceOf.java
@@ -122,25 +122,33 @@ public class InstanceOf extends Operation
   public XObject operate(XObject left, XObject right) 
                                                  throws javax.xml.transform.TransformerException
   {
-      boolean isInstanceOf = false;
+      boolean result = false;
       
       SequenceTypeData seqTypedData = (SequenceTypeData)right;
       
-      int seqType = seqTypedData.getBuiltInSequenceType();
+      int builtInSeqType = seqTypedData.getBuiltInSequenceType();
+      
       if ((left instanceof ResultSequence) && ((ResultSequence)left).size() == 0) {
-    	 if ((seqType != SequenceTypeSupport.EMPTY_SEQUENCE) && (seqType > 0)) {
-    	    return XBoolean.S_FALSE; 
+    	 if ((seqTypedData.getItemTypeOccurrenceIndicator() == SequenceTypeSupport.OccurrenceIndicator.ZERO_OR_ONE) || 
+    		 (seqTypedData.getItemTypeOccurrenceIndicator() == SequenceTypeSupport.OccurrenceIndicator.ZERO_OR_MANY)) {
+    		 return XBoolean.S_TRUE; 
+    	 }
+    	 else if (builtInSeqType == SequenceTypeSupport.EMPTY_SEQUENCE) {
+    		 return XBoolean.S_TRUE;
+    	 }
+    	 else if (seqTypedData.getItemTypeOccurrenceIndicator() == SequenceTypeSupport.OccurrenceIndicator.ABSENT) {
+    		 return XBoolean.S_FALSE;
     	 }
       }
       
       try {
-         isInstanceOf = isInstanceOf(left, seqTypedData);
+         result = isInstanceOf(left, seqTypedData);
       }
       catch (Exception ex) {    	 
-    	 isInstanceOf = false; 
+    	 result = false; 
       }
       
-      return ((isInstanceOf == true) ? XBoolean.S_TRUE : XBoolean.S_FALSE);
+      return ((result == true) ? XBoolean.S_TRUE : XBoolean.S_FALSE);
   }
 
   /**
diff --git a/src/main/java/org/apache/xpath/operations/Plus.java b/src/main/java/org/apache/xpath/operations/Plus.java
index be7c035f0..8771c7803 100644
--- a/src/main/java/org/apache/xpath/operations/Plus.java
+++ b/src/main/java/org/apache/xpath/operations/Plus.java
@@ -41,8 +41,6 @@ import xml.xpath31.processor.types.XSUntyped;
 import xml.xpath31.processor.types.XSUntypedAtomic;
 import xml.xpath31.processor.types.XSYearMonthDuration;
 
-import java.lang.String;
-
 /**
  * An XPath '+' operation implementation.
  * 
@@ -69,396 +67,344 @@ public class Plus extends ArithmeticOperation
       
 	  XObject result = null;
    
-      if ((left instanceof XSUntyped) && (right instanceof XSUntyped)) {
-          java.lang.String lStrVal = ((XSUntyped)left).stringValue();
-          double lDouble = (Double.valueOf(lStrVal)).doubleValue();
-          
-          java.lang.String rStrVal = ((XSUntyped)right).stringValue();
-          double rDouble = (Double.valueOf(rStrVal)).doubleValue();
-          
-          result = new XSDouble(lDouble + rDouble);
-      }
-      else if ((left instanceof XSUntypedAtomic) && (right instanceof XSUntypedAtomic)) {
-          java.lang.String lStrVal = ((XSUntypedAtomic)left).stringValue();
-          double lDouble = (Double.valueOf(lStrVal)).doubleValue();
-          
-          java.lang.String rStrVal = ((XSUntypedAtomic)right).stringValue();
-          double rDouble = (Double.valueOf(rStrVal)).doubleValue();
-          
-          result = new XSDouble(lDouble + rDouble);
-      }
-      else if ((left instanceof XSUntyped) && (right instanceof XSUntypedAtomic)) {
-          java.lang.String lStrVal = ((XSUntyped)left).stringValue();
-          double lDouble = (Double.valueOf(lStrVal)).doubleValue();
-          
-          java.lang.String rStrVal = ((XSUntypedAtomic)right).stringValue();
-          double rDouble = (Double.valueOf(rStrVal)).doubleValue();
-          
-          result = new XSDouble(lDouble + rDouble);
-      }
-      else if ((left instanceof XSUntypedAtomic) && (right instanceof XSUntyped)) {
-          java.lang.String lStrVal = ((XSUntypedAtomic)left).stringValue();
-          double lDouble = (Double.valueOf(lStrVal)).doubleValue();
-          
-          java.lang.String rStrVal = ((XSUntyped)right).stringValue();
-          double rDouble = (Double.valueOf(rStrVal)).doubleValue();
-          
-          result = new XSDouble(lDouble + rDouble);
-      }
-      else if ((left instanceof XNumber) && (right instanceof XSNumericType)) {
-    	  XNumber rightXNumber = getXNumberFromXSNumericType((XSNumericType)right);
-    	  result = arithmeticOpOnXNumberValues((XNumber)left, rightXNumber, OP_SYMBOL_PLUS);
-      }
-      else if ((left instanceof XSNumericType) && (right instanceof XNumber)) {
-    	  XNumber leftXNumber = getXNumberFromXSNumericType((XSNumericType)left);
-    	  result = arithmeticOpOnXNumberValues(leftXNumber, (XNumber)right, OP_SYMBOL_PLUS);
-      }      
-      else if ((left instanceof XSNumericType) && (right instanceof XSNumericType)) { 
-    	  XNumber leftXNumber = getXNumberFromXSNumericType((XSNumericType)left);
-    	  XNumber rightXNumber = getXNumberFromXSNumericType((XSNumericType)right);
-    	  result = arithmeticOpOnXNumberValues(leftXNumber, rightXNumber, OP_SYMBOL_PLUS);
-      }
-      else if ((left instanceof XNumber) && (right instanceof XNumber)) {          
-    	  XNumber lNumber = (XNumber)left;
-    	  XNumber rNumber = (XNumber)right;
-    	  result = arithmeticOpOnXNumberValues(lNumber, rNumber, OP_SYMBOL_PLUS);
-      }
-      else if ((left instanceof XNumber) && (right instanceof XMLNodeCursorImpl)) {
-          double lDouble = ((XNumber)left).num();
-          
-          XMLNodeCursorImpl rNodeSet = (XMLNodeCursorImpl)right;
-          if (rNodeSet.getLength() > 1) {
-        	  error(CARDINALITY_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS});  
-          }
-          else {
-             java.lang.String rStrVal = rNodeSet.str();
-             double rDouble = (Double.valueOf(rStrVal)).doubleValue();
-             
-             result = new XNumber(lDouble + rDouble);
-          }
-      }
-      else if ((left instanceof XMLNodeCursorImpl) && (right instanceof XNumber)) {
-          double rDouble = ((XNumber)right).num();
-          
-          XMLNodeCursorImpl lNodeSet = (XMLNodeCursorImpl)left;
-          if (lNodeSet.getLength() > 1) {
-        	  error(CARDINALITY_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS});  
-          }
-          else {
-             java.lang.String lStrVal = lNodeSet.str();
-             double lDouble = (Double.valueOf(lStrVal)).doubleValue();
-             
-             result = new XNumber(lDouble + rDouble);
-          }
-      }
-      else if ((left instanceof XSNumericType) && (right instanceof XMLNodeCursorImpl)) {
-    	  XMLNodeCursorImpl rNodeSet = (XMLNodeCursorImpl)right;
-          if (rNodeSet.getLength() > 1) {
-        	  error(CARDINALITY_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS});  
-          }
-          else {
-        	  BigDecimal lBigDecimal = new BigDecimal(((XSNumericType)left).stringValue());
-        	  BigDecimal rBigDecimal = null;
-        	  try {
-        	     rBigDecimal = new BigDecimal(rNodeSet.str());
-        	  }
-        	  catch (NumberFormatException ex) {
-        		 error(OPERAND_NOT_NUMERIC_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS});
-        	  }
-        	  
-        	  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
-        	  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
-          		 result = new XSInteger(resultBigDecimal.toBigInteger()); 
-          	  }
-          	  else {
-                 result = new XSDecimal(resultBigDecimal);
-          	  }
-          }
-      }
-      else if ((left instanceof XMLNodeCursorImpl) && (right instanceof XSNumericType)) {
-    	  XMLNodeCursorImpl lNodeSet = (XMLNodeCursorImpl)left;
-          if (lNodeSet.getLength() > 1) {
-        	  error(CARDINALITY_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS});  
-          }
-          else {        	  
-        	  BigDecimal lBigDecimal = null;
-        	  try {
-        		 lBigDecimal = new BigDecimal(lNodeSet.str());
-        	  }
-        	  catch (NumberFormatException ex) {
-        		 error(OPERAND_NOT_NUMERIC_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS}); 
-        	  }
-        	  BigDecimal rBigDecimal = new BigDecimal(((XSNumericType)right).stringValue());
-        	  
-        	  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
-        	  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
-          		 result = new XSInteger(resultBigDecimal.toBigInteger()); 
-          	  }
-          	  else {
-                 result = new XSDecimal(resultBigDecimal);
-          	  }
-          }
-      }
-      else if ((left instanceof XMLNodeCursorImpl) && (right instanceof XMLNodeCursorImpl)) {
-    	  XMLNodeCursorImpl lNodeSet = (XMLNodeCursorImpl)left;
-          if (lNodeSet.getLength() > 1) {
-        	  error(CARDINALITY_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS});  
-          }
-          
-          XMLNodeCursorImpl rNodeSet = (XMLNodeCursorImpl)right;
-          if (rNodeSet.getLength() > 1) {
-        	  error(CARDINALITY_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS});  
-          }
-          
-          BigDecimal lBigDecimal = null;
-    	  try {
-    		 lBigDecimal = new BigDecimal(lNodeSet.str());
-    	  }
-    	  catch (NumberFormatException ex) {
-    		 error(OPERAND_NOT_NUMERIC_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS}); 
-    	  }
-    	  
-    	  BigDecimal rBigDecimal = null;
-    	  try {
-    	     rBigDecimal = new BigDecimal(rNodeSet.str());
-    	  }
-    	  catch (NumberFormatException ex) {
-    		 error(OPERAND_NOT_NUMERIC_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS}); 
-    	  }
-    	  
-    	  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
-    	  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
-      		 result = new XSInteger(resultBigDecimal.toBigInteger()); 
-      	  }
-      	  else {
-             result = new XSDecimal(resultBigDecimal);
-      	  }
-      }      
-      else if ((left instanceof ResultSequence) && (right instanceof XNumber)) {
-    	  ResultSequence lSeq = (ResultSequence)left;
-          if (lSeq.size() > 1) {
-        	  error(CARDINALITY_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS});  
-          }
-          else {        	  
-        	  BigDecimal lBigDecimal = null;
-        	  try {
-        		 lBigDecimal = new BigDecimal(XslTransformEvaluationHelper.getStrVal(lSeq.item(0)));
-        	  }
-        	  catch (NumberFormatException ex) {
-        		 error(OPERAND_NOT_NUMERIC_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS}); 
-        	  }
-        	  BigDecimal rBigDecimal = BigDecimal.valueOf(((XNumber)right).num());
-        	  
-        	  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
-        	  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
-          		 result = new XSInteger(resultBigDecimal.toBigInteger()); 
-          	  }
-          	  else {
-                 result = new XSDecimal(resultBigDecimal);
-          	  }
-          }
-      }
-      else if ((left instanceof XNumber) && (right instanceof ResultSequence)) {
-    	  ResultSequence rSeq = (ResultSequence)right;
-          if (rSeq.size() > 1) {
-        	  error(CARDINALITY_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS});  
-          }
-          else {
-        	  BigDecimal lBigDecimal = BigDecimal.valueOf(((XNumber)left).num());
-        	  BigDecimal rBigDecimal = null;
-        	  try {
-        	     rBigDecimal = new BigDecimal(XslTransformEvaluationHelper.getStrVal(rSeq.item(0)));
-        	  }
-        	  catch (NumberFormatException ex) {
-        		 error(OPERAND_NOT_NUMERIC_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS}); 
-        	  }
-        	  
-        	  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
-        	  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
-          		 result = new XSInteger(resultBigDecimal.toBigInteger()); 
-          	  }
-          	  else {
-                 result = new XSDecimal(resultBigDecimal);
-          	  }
-          }
-      }
-      else if ((left instanceof ResultSequence) && (right instanceof XSNumericType)) {
-    	  ResultSequence lSeq = (ResultSequence)left;
-          if (lSeq.size() > 1) {
-        	  error(CARDINALITY_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS});  
-          }
-          else {        	  
-        	  BigDecimal lBigDecimal = null;
-        	  try {
-        		 lBigDecimal = new BigDecimal(XslTransformEvaluationHelper.getStrVal(lSeq.item(0)));
-        	  }
-        	  catch (NumberFormatException ex) {
-        		 error(OPERAND_NOT_NUMERIC_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS}); 
-        	  }
-        	  BigDecimal rBigDecimal = new BigDecimal(((XSNumericType)right).stringValue());
-        	  
-        	  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
-        	  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
-          		 result = new XSInteger(resultBigDecimal.toBigInteger()); 
-          	  }
-          	  else {
-                 result = new XSDecimal(resultBigDecimal);
-          	  }
-          }
-      }
-      else if ((left instanceof XSNumericType) && (right instanceof ResultSequence)) {
-    	  ResultSequence rSeq = (ResultSequence)right;
-          if (rSeq.size() > 1) {
-        	  error(CARDINALITY_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS});  
-          }
-          else {
-        	  BigDecimal lBigDecimal = new BigDecimal(((XSNumericType)left).stringValue());
-        	  BigDecimal rBigDecimal = null;
-        	  try {
-        	     rBigDecimal = new BigDecimal(XslTransformEvaluationHelper.getStrVal(rSeq.item(0)));
-        	  }
-        	  catch (NumberFormatException ex) {
-        		 error(OPERAND_NOT_NUMERIC_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS}); 
-        	  }
-        	  
-        	  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
-        	  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
-          		 result = new XSInteger(resultBigDecimal.toBigInteger()); 
-          	  }
-          	  else {
-                 result = new XSDecimal(resultBigDecimal);
-          	  }
-          }
-      }
-      else if ((left instanceof XSYearMonthDuration) && (right instanceof XSYearMonthDuration)) {
-          result = ((XSYearMonthDuration)left).add((XSYearMonthDuration)right);  
-      }
-      else if (left instanceof XSDate) {
-          result = ((XSDate)left).add(right);  
-      }
-      else if (left instanceof XSDateTime) {
-          result = ((XSDateTime)left).add(right);  
-      }
-      else if (left instanceof XSTime) {
-          result = ((XSTime)left).add(right);  
-      }
-      else if ((left instanceof ResultSequence) && (right instanceof ResultSequence)) {
-    	  ResultSequence lSeq = (ResultSequence)left;          
-          if (lSeq.size() > 1) {
-        	  error(CARDINALITY_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS});  
-          }
-          
-          ResultSequence rSeq = (ResultSequence)right;
-          if (rSeq.size() > 1) {
-        	  error(CARDINALITY_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS}); 
-          }
-          
-          XObject lXObj = ((ResultSequence)left).item(0);
-          XObject rXObj = ((ResultSequence)right).item(0);
-          
-          if (lXObj instanceof XSDate) {
-              result = ((XSDate)lXObj).add(rXObj); 
-          }
-          else if (lXObj instanceof XSDateTime) {
-              result = ((XSDateTime)lXObj).add(rXObj); 
-          }
-          else if (lXObj instanceof XSTime) {
-              result = ((XSTime)lXObj).add(rXObj); 
-          }
-          else {
-        	  BigDecimal lBigDecimal = null;
-        	  BigDecimal rBigDecimal = null;        	  
-        	  try {
-	              java.lang.String lStr = XslTransformEvaluationHelper.getStrVal(lXObj);
-	              lBigDecimal = new BigDecimal(lStr);	              
-	              java.lang.String rStr = XslTransformEvaluationHelper.getStrVal(rXObj);
-	              rBigDecimal = new BigDecimal(rStr);
-        	  }
-        	  catch (NumberFormatException ex) {
-        		  error(OPERAND_NOT_NUMERIC_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS});
-        	  }
-        	  
-        	  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
-        	  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
-          		 result = new XSInteger(resultBigDecimal.toBigInteger()); 
-          	  }
-          	  else {
-                 result = new XSDecimal(resultBigDecimal);
-          	  }
-          }
-      }
-      else if (left instanceof ResultSequence) {
-    	  ResultSequence lSeq = (ResultSequence)left;          
-          if (lSeq.size() > 1) {
-        	  error(CARDINALITY_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS});  
-          }
-          
-          XObject lXObj = ((ResultSequence)left).item(0);
-          if (lXObj instanceof XSDate) {
-              result = ((XSDate)lXObj).add(right); 
-          }
-          else if (lXObj instanceof XSDateTime) {
-              result = ((XSDateTime)lXObj).add(right); 
-          }
-          else if (lXObj instanceof XSTime) {
-              result = ((XSTime)lXObj).add(right); 
-          }
-          else {
-        	  BigDecimal lBigDecimal = null;
-        	  BigDecimal rBigDecimal = null;        	  
-        	  try {
-	              java.lang.String lStr = XslTransformEvaluationHelper.getStrVal(lXObj);
-	              lBigDecimal = new BigDecimal(lStr);	              
-	              java.lang.String rStr = XslTransformEvaluationHelper.getStrVal(right);
-	              rBigDecimal = new BigDecimal(rStr);
-        	  }
-        	  catch (NumberFormatException ex) {
-        		  error(OPERAND_NOT_NUMERIC_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS});
-        	  }
-        	  
-        	  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
-        	  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
-          		 result = new XSInteger(resultBigDecimal.toBigInteger()); 
-          	  }
-          	  else {
-                 result = new XSDecimal(resultBigDecimal);
-          	  }
-          }
-      }
-      else if (left instanceof XMLNodeCursorImpl) {
-    	  XMLNodeCursorImpl lNodeSet = (XMLNodeCursorImpl)left;
-          if (lNodeSet.getLength() > 1) {
-        	  error(CARDINALITY_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS}); 
-          }
-          
-          BigDecimal lBigDecimal = null;
-          BigDecimal rBigDecimal = null;
-    	  try {
-    		 lBigDecimal = new BigDecimal(lNodeSet.str());
-             rBigDecimal = new BigDecimal(XslTransformEvaluationHelper.getStrVal(right));
-    	  }
-    	  catch (NumberFormatException ex) {
-    		 error(OPERAND_NOT_NUMERIC_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS}); 
-    	  }
-        	  
-          BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
-          if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
-          	 result = new XSInteger(resultBigDecimal.toBigInteger()); 
-          }
-          else {
-             result = new XSDecimal(resultBigDecimal);
-          }
-      }
-      else {
-    	  try {
-         	 java.lang.String lStrVal = XslTransformEvaluationHelper.getStrVal(left);
-         	 java.lang.String rStrVal = XslTransformEvaluationHelper.getStrVal(right);
-             result = new XNumber(Double.valueOf(lStrVal) + Double.valueOf(rStrVal));
-          }
-          catch (NumberFormatException ex) {
-        	 error(OPERAND_NOT_NUMERIC_ERR_MESG, new String[] {"XPTY0004", OP_SYMBOL_PLUS}); 
-          }
-      }
+	  try {
+		  if ((left instanceof XSUntyped) && (right instanceof XSUntyped)) {
+			  java.lang.String lStrVal = ((XSUntyped)left).stringValue();
+			  double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+
+			  java.lang.String rStrVal = ((XSUntyped)right).stringValue();
+			  double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+
+			  result = new XSDouble(lDouble + rDouble);
+		  }
+		  else if ((left instanceof XSUntypedAtomic) && (right instanceof XSUntypedAtomic)) {
+			  java.lang.String lStrVal = ((XSUntypedAtomic)left).stringValue();
+			  double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+
+			  java.lang.String rStrVal = ((XSUntypedAtomic)right).stringValue();
+			  double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+
+			  result = new XSDouble(lDouble + rDouble);
+		  }
+		  else if ((left instanceof XSUntyped) && (right instanceof XSUntypedAtomic)) {
+			  java.lang.String lStrVal = ((XSUntyped)left).stringValue();
+			  double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+
+			  java.lang.String rStrVal = ((XSUntypedAtomic)right).stringValue();
+			  double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+
+			  result = new XSDouble(lDouble + rDouble);
+		  }
+		  else if ((left instanceof XSUntypedAtomic) && (right instanceof XSUntyped)) {
+			  java.lang.String lStrVal = ((XSUntypedAtomic)left).stringValue();
+			  double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+
+			  java.lang.String rStrVal = ((XSUntyped)right).stringValue();
+			  double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+
+			  result = new XSDouble(lDouble + rDouble);
+		  }
+		  else if ((left instanceof XNumber) && (right instanceof XSNumericType)) {
+			  XNumber rightXNumber = getXNumberFromXSNumericType((XSNumericType)right);
+			  
+			  result = arithmeticOpOnXNumberValues((XNumber)left, rightXNumber, OP_SYMBOL_PLUS);
+		  }
+		  else if ((left instanceof XSNumericType) && (right instanceof XNumber)) {
+			  XNumber leftXNumber = getXNumberFromXSNumericType((XSNumericType)left);
+			  
+			  result = arithmeticOpOnXNumberValues(leftXNumber, (XNumber)right, OP_SYMBOL_PLUS);
+		  }      
+		  else if ((left instanceof XSNumericType) && (right instanceof XSNumericType)) { 
+			  XNumber leftXNumber = getXNumberFromXSNumericType((XSNumericType)left);
+			  XNumber rightXNumber = getXNumberFromXSNumericType((XSNumericType)right);
+			  
+			  result = arithmeticOpOnXNumberValues(leftXNumber, rightXNumber, OP_SYMBOL_PLUS);
+		  }
+		  else if ((left instanceof XNumber) && (right instanceof XNumber)) {          
+			  XNumber lNumber = (XNumber)left;
+			  XNumber rNumber = (XNumber)right;
+			  
+			  result = arithmeticOpOnXNumberValues(lNumber, rNumber, OP_SYMBOL_PLUS);
+		  }
+		  else if ((left instanceof XNumber) && (right instanceof XMLNodeCursorImpl)) {
+			  double lDouble = ((XNumber)left).num();
+
+			  XMLNodeCursorImpl rNodeSet = (XMLNodeCursorImpl)right;
+			  if (rNodeSet.getLength() > 1) {
+				  error(CARDINALITY_ERR_MESG, new java.lang.String[] {"XPTY0004", OP_SYMBOL_PLUS});  
+			  }
+			  else {
+				  java.lang.String rStrVal = rNodeSet.str();
+				  double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+
+				  result = new XNumber(lDouble + rDouble);
+			  }
+		  }
+		  else if ((left instanceof XMLNodeCursorImpl) && (right instanceof XNumber)) {
+			  double rDouble = ((XNumber)right).num();
+
+			  XMLNodeCursorImpl lNodeSet = (XMLNodeCursorImpl)left;
+			  if (lNodeSet.getLength() > 1) {
+				  error(CARDINALITY_ERR_MESG, new java.lang.String[] {"XPTY0004", OP_SYMBOL_PLUS});  
+			  }
+			  else {
+				  java.lang.String lStrVal = lNodeSet.str();
+				  double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+
+				  result = new XNumber(lDouble + rDouble);
+			  }
+		  }
+		  else if ((left instanceof XSNumericType) && (right instanceof XMLNodeCursorImpl)) {
+			  XMLNodeCursorImpl rNodeSet = (XMLNodeCursorImpl)right;
+			  if (rNodeSet.getLength() > 1) {
+				  error(CARDINALITY_ERR_MESG, new java.lang.String[] {"XPTY0004", OP_SYMBOL_PLUS});  
+			  }
+			  else {
+				  BigDecimal lBigDecimal = new BigDecimal(((XSNumericType)left).stringValue());
+				  BigDecimal rBigDecimal = new BigDecimal(rNodeSet.str());				  
+				  
+				  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
+				  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
+					  result = new XSInteger(resultBigDecimal.toBigInteger()); 
+				  }
+				  else {
+					  result = new XSDecimal(resultBigDecimal);
+				  }
+			  }
+		  }
+		  else if ((left instanceof XMLNodeCursorImpl) && (right instanceof XSNumericType)) {
+			  XMLNodeCursorImpl lNodeSet = (XMLNodeCursorImpl)left;
+			  if (lNodeSet.getLength() > 1) {
+				  error(CARDINALITY_ERR_MESG, new java.lang.String[] {"XPTY0004", OP_SYMBOL_PLUS});  
+			  }
+			  else {        	  
+				  BigDecimal lBigDecimal = new BigDecimal(lNodeSet.str());				  
+				  BigDecimal rBigDecimal = new BigDecimal(((XSNumericType)right).stringValue());
+				  
+				  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
+				  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
+					  result = new XSInteger(resultBigDecimal.toBigInteger()); 
+				  }
+				  else {
+					  result = new XSDecimal(resultBigDecimal);
+				  }
+			  }
+		  }
+		  else if ((left instanceof XMLNodeCursorImpl) && (right instanceof XMLNodeCursorImpl)) {
+			  XMLNodeCursorImpl lNodeSet = (XMLNodeCursorImpl)left;
+			  if (lNodeSet.getLength() > 1) {
+				  error(CARDINALITY_ERR_MESG, new java.lang.String[] {"XPTY0004", OP_SYMBOL_PLUS});  
+			  }
+
+			  XMLNodeCursorImpl rNodeSet = (XMLNodeCursorImpl)right;
+			  if (rNodeSet.getLength() > 1) {
+				  error(CARDINALITY_ERR_MESG, new java.lang.String[] {"XPTY0004", OP_SYMBOL_PLUS});  
+			  }
+			  BigDecimal lBigDecimal = new BigDecimal(lNodeSet.str());			  
+			  BigDecimal rBigDecimal = new BigDecimal(rNodeSet.str());
+			  
+			  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
+			  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
+				  result = new XSInteger(resultBigDecimal.toBigInteger()); 
+			  }
+			  else {
+				  result = new XSDecimal(resultBigDecimal);
+			  }
+		  }      
+		  else if ((left instanceof ResultSequence) && (right instanceof XNumber)) {
+			  ResultSequence lSeq = (ResultSequence)left;
+			  if (lSeq.size() > 1) {
+				  error(CARDINALITY_ERR_MESG, new java.lang.String[] {"XPTY0004", OP_SYMBOL_PLUS});  
+			  }
+			  else {        	  
+				  BigDecimal lBigDecimal = new BigDecimal(XslTransformEvaluationHelper.getStrVal(lSeq.item(0)));				  
+				  BigDecimal rBigDecimal = BigDecimal.valueOf(((XNumber)right).num());
+				  
+				  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
+				  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
+					  result = new XSInteger(resultBigDecimal.toBigInteger()); 
+				  }
+				  else {
+					  result = new XSDecimal(resultBigDecimal);
+				  }
+			  }
+		  }
+		  else if ((left instanceof XNumber) && (right instanceof ResultSequence)) {
+			  ResultSequence rSeq = (ResultSequence)right;
+			  if (rSeq.size() > 1) {
+				  error(CARDINALITY_ERR_MESG, new java.lang.String[] {"XPTY0004", OP_SYMBOL_PLUS});  
+			  }
+			  else {
+				  BigDecimal lBigDecimal = BigDecimal.valueOf(((XNumber)left).num());
+				  BigDecimal rBigDecimal = new BigDecimal(XslTransformEvaluationHelper.getStrVal(rSeq.item(0)));				  
+				  
+				  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
+				  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
+					  result = new XSInteger(resultBigDecimal.toBigInteger()); 
+				  }
+				  else {
+					  result = new XSDecimal(resultBigDecimal);
+				  }
+			  }
+		  }
+		  else if ((left instanceof ResultSequence) && (right instanceof XSNumericType)) {
+			  ResultSequence lSeq = (ResultSequence)left;
+			  if (lSeq.size() > 1) {
+				  error(CARDINALITY_ERR_MESG, new java.lang.String[] {"XPTY0004", OP_SYMBOL_PLUS});  
+			  }
+			  else {        	  
+				  BigDecimal lBigDecimal = new BigDecimal(XslTransformEvaluationHelper.getStrVal(lSeq.item(0)));				  
+				  BigDecimal rBigDecimal = new BigDecimal(((XSNumericType)right).stringValue());
+
+				  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
+				  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
+					  result = new XSInteger(resultBigDecimal.toBigInteger()); 
+				  }
+				  else {
+					  result = new XSDecimal(resultBigDecimal);
+				  }
+			  }
+		  }
+		  else if ((left instanceof XSNumericType) && (right instanceof ResultSequence)) {
+			  ResultSequence rSeq = (ResultSequence)right;
+			  if (rSeq.size() > 1) {
+				  error(CARDINALITY_ERR_MESG, new java.lang.String[] {"XPTY0004", OP_SYMBOL_PLUS});  
+			  }
+			  else {
+				  BigDecimal lBigDecimal = new BigDecimal(((XSNumericType)left).stringValue());
+				  BigDecimal rBigDecimal = new BigDecimal(XslTransformEvaluationHelper.getStrVal(rSeq.item(0)));				  
+
+				  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
+				  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
+					  result = new XSInteger(resultBigDecimal.toBigInteger()); 
+				  }
+				  else {
+					  result = new XSDecimal(resultBigDecimal);
+				  }
+			  }
+		  }
+		  else if ((left instanceof XSYearMonthDuration) && (right instanceof XSYearMonthDuration)) {
+			  result = ((XSYearMonthDuration)left).add((XSYearMonthDuration)right);  
+		  }
+		  else if (left instanceof XSDate) {
+			  result = ((XSDate)left).add(right);  
+		  }
+		  else if (left instanceof XSDateTime) {
+			  result = ((XSDateTime)left).add(right);  
+		  }
+		  else if (left instanceof XSTime) {
+			  result = ((XSTime)left).add(right);  
+		  }
+		  else if ((left instanceof ResultSequence) && (right instanceof ResultSequence)) {
+			  ResultSequence lSeq = (ResultSequence)left;          
+			  if (lSeq.size() > 1) {
+				  error(CARDINALITY_ERR_MESG, new java.lang.String[] {"XPTY0004", OP_SYMBOL_PLUS});  
+			  }
+
+			  ResultSequence rSeq = (ResultSequence)right;
+			  if (rSeq.size() > 1) {
+				  error(CARDINALITY_ERR_MESG, new java.lang.String[] {"XPTY0004", OP_SYMBOL_PLUS}); 
+			  }
+
+			  XObject lXObj = ((ResultSequence)left).item(0);
+			  XObject rXObj = ((ResultSequence)right).item(0);
+
+			  if (lXObj instanceof XSDate) {
+				  result = ((XSDate)lXObj).add(rXObj); 
+			  }
+			  else if (lXObj instanceof XSDateTime) {
+				  result = ((XSDateTime)lXObj).add(rXObj); 
+			  }
+			  else if (lXObj instanceof XSTime) {
+				  result = ((XSTime)lXObj).add(rXObj); 
+			  }
+			  else {				  
+				  java.lang.String lStr = XslTransformEvaluationHelper.getStrVal(lXObj);
+				  BigDecimal lBigDecimal = new BigDecimal(lStr);	              
+				  java.lang.String rStr = XslTransformEvaluationHelper.getStrVal(rXObj);
+				  BigDecimal rBigDecimal = new BigDecimal(rStr);
+
+				  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
+				  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
+					  result = new XSInteger(resultBigDecimal.toBigInteger()); 
+				  }
+				  else {
+					  result = new XSDecimal(resultBigDecimal);
+				  }
+			  }
+		  }
+		  else if (left instanceof ResultSequence) {
+			  ResultSequence lSeq = (ResultSequence)left;          
+			  if (lSeq.size() > 1) {
+				  error(CARDINALITY_ERR_MESG, new java.lang.String[] {"XPTY0004", OP_SYMBOL_PLUS});  
+			  }
+
+			  XObject lXObj = ((ResultSequence)left).item(0);
+			  if (lXObj instanceof XSDate) {
+				  result = ((XSDate)lXObj).add(right); 
+			  }
+			  else if (lXObj instanceof XSDateTime) {
+				  result = ((XSDateTime)lXObj).add(right); 
+			  }
+			  else if (lXObj instanceof XSTime) {
+				  result = ((XSTime)lXObj).add(right); 
+			  }
+			  else {        	  
+				  java.lang.String lStr = XslTransformEvaluationHelper.getStrVal(lXObj);
+				  BigDecimal lBigDecimal = new BigDecimal(lStr);	              
+				  java.lang.String rStr = XslTransformEvaluationHelper.getStrVal(right);
+				  BigDecimal rBigDecimal = new BigDecimal(rStr);
+
+				  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
+				  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
+					  result = new XSInteger(resultBigDecimal.toBigInteger()); 
+				  }
+				  else {
+					  result = new XSDecimal(resultBigDecimal);
+				  }
+			  }
+		  }
+		  else if (left instanceof XMLNodeCursorImpl) {
+			  XMLNodeCursorImpl lNodeSet = (XMLNodeCursorImpl)left;
+			  if (lNodeSet.getLength() > 1) {
+				  error(CARDINALITY_ERR_MESG, new java.lang.String[] {"XPTY0004", OP_SYMBOL_PLUS}); 
+			  }
+
+			  BigDecimal lBigDecimal = new BigDecimal(lNodeSet.str());
+			  BigDecimal rBigDecimal = new BigDecimal(XslTransformEvaluationHelper.getStrVal(right));			  
+
+			  BigDecimal resultBigDecimal = lBigDecimal.add(rBigDecimal);
+			  if (resultBigDecimal.compareTo(new BigDecimal(resultBigDecimal.toBigInteger())) == 0) {
+				  result = new XSInteger(resultBigDecimal.toBigInteger()); 
+			  }
+			  else {
+				  result = new XSDecimal(resultBigDecimal);
+			  }
+		  }
+		  else {
+			  java.lang.String lStrVal = XslTransformEvaluationHelper.getStrVal(left);
+			  java.lang.String rStrVal = XslTransformEvaluationHelper.getStrVal(right);
+			  
+			  result = new XNumber(Double.valueOf(lStrVal) + Double.valueOf(rStrVal));			 
+		  }
+	  }
+	  catch (NumberFormatException ex) {
+		  java.lang.String lStrValue = null;
+		  if (left instanceof XMLNodeCursorImpl) {
+			  lStrValue = ((XMLNodeCursorImpl)left).str(); 
+		  }
+		  java.lang.String rStrValue = null;
+		  if (right instanceof XMLNodeCursorImpl) {
+			  rStrValue = ((XMLNodeCursorImpl)right).str(); 
+		  }
+		  
+		  if ("".equals(lStrValue) || "".equals(rStrValue)) {
+		     result = new ResultSequence();
+		  }
+		  else {
+			 throw new javax.xml.transform.TransformerException("XPTY0004 : One or both of the operands of operator + are not numeric."); 
+		  }
+	  }
       
       return result;
   }
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/W3CXSLT3Tests.java b/src/test/java/org/apache/xalan/tests/w3c/xslt3/W3CXSLT3Tests.java
index a03cd58b3..4d5a85c10 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/W3CXSLT3Tests.java
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/W3CXSLT3Tests.java
@@ -71,7 +71,7 @@ import org.junit.runners.Suite.SuiteClasses;
 @SuiteClasses({ XslAsAttrTests.class, XslAvtAttrTests.class, XslMatchAttrTests.class, XslSelectAttrTests.class, XslAnalyzeStringTests.class,
 	            XslApplyTemplatesTests.class, XslForEachGroupTests.class, XslTryTests.class, XslAttributeTests.class, XslCallTemplateTests.class, 
 	            XslChooseTests.class, XslCopyTests.class, XslIterateTests.class, XslSequenceTests.class, XslElementTests.class, 
-	            XslSortTests.class, XslFunctionTests.class, XslVariableTests.class, XslCharacterMapTests.class, XslAttributeSetTests.class, 
+	            XslSortTests.class, XslVariableTests.class, XslFunctionTests.class, XslCharacterMapTests.class, XslAttributeSetTests.class, 
 	            XslAxesTests.class, XslCastableTests.class, XslExpressionTests.class, XslForTests.class, XslMathTests.class, 
 	            XslNodeTestTests.class, XslPathTests.class, XslHigherOrderFunctionTests.class, XslPredicateTests.class, XslBooleanTests.class, 
 	            XslNodeTests.class, XslStringTests.class, XslDateTests.class, XslFnDeepEqualTests.class, XslFnPositionTests.class, 
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_as-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_as-test-set_result.xml
index b7cad9945..d00eaed94 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_as-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_as-test-set_result.xml
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:35Z" fail="97" name="as" pass="11" skipped="0" statusUnknown="1" totalRun="109">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:39Z" fail="96" name="as" pass="12" skipped="0" statusUnknown="1" totalRun="109">
    <testResult status="fail" testName="as-0101"/>
    <testResult status="pass" testName="as-0102"/>
    <testResult status="pass" testName="as-0103"/>
    <testResult status="fail" testName="as-0104">
       <outResult>
-         <errTrace>XTTE0590 : The value to parameter 'par1' cannot be assigned. Either the parameter's input is not available or parameter's value cannot be cast to an expected type.</errTrace>
+         <errTrace>XTDE0700 : No value supplied for the required parameter $par1. A value is required for the parameter because the default value is not a valid instance of the required type.</errTrace>
       </outResult>
    </testResult>
    <testResult status="fail" testName="as-0105"/>
@@ -105,7 +105,7 @@ javax.xml.transform.TransformerException: XPST0051 : An XML Schema type 'xs:base
    </testResult>
    <testResult status="pass" testName="as-0122"/>
    <testResult status="fail" testName="as-0123"/>
-   <testResult status="fail" testName="as-0124"/>
+   <testResult status="pass" testName="as-0124"/>
    <testResult status="fail" testName="as-0125"/>
    <testResult status="pass" testName="as-0126"/>
    <testResult status="fail" testName="as-0127"/>
@@ -261,7 +261,7 @@ javax.xml.transform.TransformerException: XPST0051 : An XML Schema type 'xs:base
    <testResult status="pass" testName="as-1212"/>
    <testResult status="fail" testName="as-1213">
       <outResult>
-         <errTrace>XTTE0590 : The value to parameter 'par2' cannot be assigned. Either the parameter's input is not available or parameter's value cannot be cast to an expected type.</errTrace>
+         <errTrace>XTDE0700 : No value supplied for the required parameter $par2. A value is required for the parameter because the default value is not a valid instance of the required type.</errTrace>
       </outResult>
    </testResult>
    <testResult status="fail" testName="as-1214">
@@ -270,7 +270,7 @@ javax.xml.transform.TransformerException: XPST0051 : An XML Schema type 'xs:base
    <testResult status="fail" testName="as-1215"/>
    <testResult status="fail" testName="as-1216">
       <outResult>
-         <errTrace>XTTE0590 : The value to parameter 'par2' cannot be assigned. Either the parameter's input is not available or parameter's value cannot be cast to an expected type.</errTrace>
+         <errTrace>XTDE0700 : No value supplied for the required parameter $par2. A value is required for the parameter because the default value is not a valid instance of the required type.</errTrace>
       </outResult>
    </testResult>
    <testResult status="fail" testName="as-1217"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_avt-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_avt-test-set_result.xml
index 0bfc5eb3a..3713d7a1f 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_avt-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_avt-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:36Z" fail="14" name="avt" pass="21" skipped="0" statusUnknown="0" totalRun="35">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:40Z" fail="14" name="avt" pass="21" skipped="0" statusUnknown="0" totalRun="35">
    <testResult status="pass" testName="avt-0101"/>
    <testResult status="fail" testName="avt-0201"/>
    <testResult status="pass" testName="avt-0202"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_match-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_match-test-set_result.xml
index 0a9955c31..7ab9412ab 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_match-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_match-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:36Z" fail="67" name="match" pass="57" skipped="8" statusUnknown="5" totalRun="137">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:40Z" fail="67" name="match" pass="57" skipped="8" statusUnknown="5" totalRun="137">
    <testResult status="pass" testName="match-001"/>
    <testResult status="pass" testName="match-002"/>
    <testResult status="pass" testName="match-003"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_select-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_select-test-set_result.xml
index ff9ed5a08..8245c7791 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_select-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_select-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:37Z" fail="7" name="select" pass="16" skipped="0" statusUnknown="2" totalRun="25">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:41Z" fail="7" name="select" pass="16" skipped="0" statusUnknown="2" totalRun="25">
    <testResult status="pass" testName="select-0101"/>
    <testResult status="pass" testName="select-0102"/>
    <testResult status="fail" testName="select-0201"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_attribute-set-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_attribute-set-test-set_result.xml
index 7162ce7f8..6dc667b87 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_attribute-set-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_attribute-set-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:45Z" fail="7" name="attribute-set" pass="41" skipped="1" statusUnknown="1" totalRun="50">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:51Z" fail="7" name="attribute-set" pass="41" skipped="1" statusUnknown="1" totalRun="50">
    <testResult status="pass" testName="attribute-set-0101"/>
    <testResult status="fail" testName="attribute-set-0102">
       <outResult/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_character-map-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_character-map-test-set_result.xml
index 2487e2f3c..8dc152ae6 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_character-map-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_character-map-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:45Z" fail="12" name="character-map" pass="15" skipped="0" statusUnknown="2" totalRun="29">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:51Z" fail="12" name="character-map" pass="15" skipped="0" statusUnknown="2" totalRun="29">
    <testResult status="pass" testName="character-map-001"/>
    <testResult status="pass" testName="character-map-002"/>
    <testResult status="pass" testName="character-map-003"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_function-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_function-test-set_result.xml
index e7996687c..8f4e915be 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_function-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_function-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:45Z" fail="39" name="function" pass="22" skipped="4" statusUnknown="5" totalRun="70">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:51Z" fail="39" name="function" pass="22" skipped="4" statusUnknown="5" totalRun="70">
    <testResult status="fail" testName="function-0001">
       <outResult/>
    </testResult>
@@ -122,7 +122,7 @@
    </testResult>
    <testResult status="fail" testName="function-1026">
       <outResult>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://xxx.com/}test(), doesn't match the declared parameter type xs:integer.</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://xxx.com/}test(), doesn't match the declared parameter type xs:integer.</errTrace>
       </outResult>
    </testResult>
    <testResult status="fail" testName="function-1027">
@@ -130,7 +130,7 @@
    </testResult>
    <testResult status="fail" testName="function-1028">
       <outResult>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://xxx.com/}test(), doesn't match the declared parameter type xs:integer.</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://xxx.com/}test(), doesn't match the declared parameter type xs:integer.</errTrace>
       </outResult>
    </testResult>
    <testResult status="fail" testName="function-1029">
@@ -138,7 +138,7 @@
    </testResult>
    <testResult status="fail" testName="function-1030">
       <outResult>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://xxx.com/}test(), doesn't match the declared parameter type xs:integer.</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://xxx.com/}test(), doesn't match the declared parameter type xs:integer.</errTrace>
       </outResult>
    </testResult>
    <testResult testName="function-1031"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_variable-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_variable-test-set_result.xml
index 7797937f3..84c83a3b0 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_variable-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_variable-test-set_result.xml
@@ -1,13 +1,13 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:45Z" fail="11" name="variable" pass="8" skipped="0" statusUnknown="1" totalRun="20">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:50Z" fail="9" name="variable" pass="10" skipped="0" statusUnknown="1" totalRun="20">
    <testResult status="pass" testName="variable-0101"/>
    <testResult status="pass" testName="variable-0102"/>
    <testResult status="pass" testName="variable-0103"/>
    <testResult status="fail" testName="variable-0104"/>
-   <testResult status="fail" testName="variable-0105"/>
+   <testResult status="pass" testName="variable-0105"/>
    <testResult status="pass" testName="variable-0106"/>
-   <testResult status="fail" testName="variable-0107"/>
+   <testResult status="pass" testName="variable-0107"/>
    <testResult status="fail" testName="variable-0108"/>
-   <testResult status="fail" testName="variable-0109"/>
+   <testResult status="pass" testName="variable-0109"/>
    <testResult status="fail" testName="variable-0110"/>
    <testResult status="fail" testName="variable-0111">
       <outResult>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;out result="3"/&gt;</outResult>
@@ -20,7 +20,11 @@
          <errTrace>Variable $v accessed before it is bound!.</errTrace>
       </outResult>
    </testResult>
-   <testResult status="pass" testName="variable-0114"/>
+   <testResult status="fail" testName="variable-0114">
+      <outResult>
+         <errTrace>XPTY0004 : An XSL template call parameter value at position 2 for template {test:*}, doesn't match the declared parameter type xs:boolean.</errTrace>
+      </outResult>
+   </testResult>
    <testResult status="pass" testName="variable-0115"/>
    <testResult status="pass" testName="variable-0116"/>
    <testResult status="pass" testName="variable-0117"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_axes-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_axes-test-set_result.xml
index 92c4bd4bd..a15f7c473 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_axes-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_axes-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:45Z" fail="29" name="axes" pass="172" skipped="0" statusUnknown="0" totalRun="201">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:51Z" fail="29" name="axes" pass="172" skipped="0" statusUnknown="0" totalRun="201">
    <testResult status="pass" testName="axes-001"/>
    <testResult status="pass" testName="axes-002"/>
    <testResult status="pass" testName="axes-003"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_castable-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_castable-test-set_result.xml
index 91a007686..0c6799a41 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_castable-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_castable-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:46Z" fail="5" name="castable" pass="4" skipped="0" statusUnknown="0" totalRun="9">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:51Z" fail="5" name="castable" pass="4" skipped="0" statusUnknown="0" totalRun="9">
    <testResult status="pass" testName="castable-001"/>
    <testResult status="pass" testName="castable-002"/>
    <testResult status="pass" testName="castable-003"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_expression-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_expression-test-set_result.xml
index 492ef41ec..9f58de2d0 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_expression-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_expression-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:46Z" fail="0" name="expression" pass="9" skipped="0" statusUnknown="1" totalRun="10">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:51Z" fail="0" name="expression" pass="9" skipped="0" statusUnknown="1" totalRun="10">
    <testResult status="pass" testName="expression-0101"/>
    <testResult status="pass" testName="expression-0301"/>
    <testResult status="pass" testName="expression-0302"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_for-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_for-test-set_result.xml
index 0d357eca2..fb22b6762 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_for-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_for-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:46Z" fail="2" name="for" pass="1" skipped="0" statusUnknown="1" totalRun="4">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:52Z" fail="2" name="for" pass="1" skipped="0" statusUnknown="1" totalRun="4">
    <testResult status="fail" testName="for-001"/>
    <testResult status="fail" testName="for-002"/>
    <testResult status="pass" testName="for-003"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_higher-order-functions-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_higher-order-functions-test-set_result.xml
index e1d00b03d..70dbba0f9 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_higher-order-functions-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_higher-order-functions-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:49Z" fail="6" name="higher-order-functions" pass="18" skipped="0" statusUnknown="1" totalRun="25">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:54Z" fail="6" name="higher-order-functions" pass="18" skipped="0" statusUnknown="1" totalRun="25">
    <testResult status="pass" testName="higher-order-functions-001"/>
    <testResult status="pass" testName="higher-order-functions-002"/>
    <testResult status="pass" testName="higher-order-functions-003"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_math-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_math-test-set_result.xml
index 9dad36258..5c13c84bb 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_math-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_math-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:48Z" fail="39" name="math" pass="108" skipped="0" statusUnknown="1" totalRun="148">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:53Z" fail="39" name="math" pass="108" skipped="0" statusUnknown="1" totalRun="148">
    <testResult status="pass" testName="math-0101"/>
    <testResult status="fail" testName="math-0102">
       <outResult/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_nodetest-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_nodetest-test-set_result.xml
index a4694ec8c..36f774692 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_nodetest-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_nodetest-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:49Z" fail="36" name="nodetest" pass="2" skipped="0" statusUnknown="0" totalRun="38">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:54Z" fail="36" name="nodetest" pass="2" skipped="0" statusUnknown="0" totalRun="38">
    <testResult status="pass" testName="nodetest-001"/>
    <testResult status="pass" testName="nodetest-002"/>
    <testResult status="fail" testName="nodetest-003">
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_path-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_path-test-set_result.xml
index ea4ac4dee..f440aea32 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_path-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_path-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:49Z" fail="3" name="path" pass="7" skipped="0" statusUnknown="0" totalRun="10">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:54Z" fail="3" name="path" pass="7" skipped="0" statusUnknown="0" totalRun="10">
    <testResult status="pass" testName="path-001"/>
    <testResult status="pass" testName="path-002"/>
    <testResult status="pass" testName="path-003"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_predicate-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_predicate-test-set_result.xml
index 5e76e26fe..36ea13e1b 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_predicate-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_predicate-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:49Z" fail="7" name="predicate" pass="50" skipped="0" statusUnknown="0" totalRun="57">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:55Z" fail="7" name="predicate" pass="50" skipped="0" statusUnknown="0" totalRun="57">
    <testResult status="fail" testName="predicate-001"/>
    <testResult status="fail" testName="predicate-002"/>
    <testResult status="fail" testName="predicate-003"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_deep-equal-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_deep-equal-test-set_result.xml
index b32e15956..5ace66d74 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_deep-equal-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_deep-equal-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:31:26Z" fail="0" name="deep-equal" pass="2" skipped="0" statusUnknown="0" totalRun="2">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T12:02:16Z" fail="0" name="deep-equal" pass="2" skipped="0" statusUnknown="0" totalRun="2">
    <testResult status="pass" testName="deep-equal-001"/>
    <testResult status="pass" testName="deep-equal-002"/>
 </testrun>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_format-number-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_format-number-test-set_result.xml
index c109601c8..e6456ff61 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_format-number-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_format-number-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:31:28Z" fail="33" name="format-number" pass="37" skipped="4" statusUnknown="0" totalRun="74">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T12:02:18Z" fail="33" name="format-number" pass="37" skipped="4" statusUnknown="0" totalRun="74">
    <testResult status="fail" testName="format-number-001"/>
    <testResult status="fail" testName="format-number-002"/>
    <testResult status="fail" testName="format-number-003"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_key-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_key-test-set_result.xml
index f823d27ac..72e1e3223 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_key-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_key-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:31:27Z" fail="3" name="key" pass="21" skipped="0" statusUnknown="1" totalRun="25">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T12:02:18Z" fail="3" name="key" pass="21" skipped="0" statusUnknown="1" totalRun="25">
    <testResult status="pass" testName="key-001"/>
    <testResult status="fail" testName="key-002"/>
    <testResult status="pass" testName="key-003"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_position-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_position-test-set_result.xml
index 9176653d3..e4fac55e9 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_position-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_position-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:31:26Z" fail="8" name="position" pass="108" skipped="0" statusUnknown="1" totalRun="117">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T12:02:16Z" fail="8" name="position" pass="108" skipped="0" statusUnknown="1" totalRun="117">
    <testResult status="pass" testName="position-0101"/>
    <testResult status="fail" testName="position-0102"/>
    <testResult status="fail" testName="position-0103">
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_root-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_root-test-set_result.xml
index 96837e259..ab27f8eb4 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_root-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/fn/_root-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:31:27Z" fail="4" name="root" pass="6" skipped="0" statusUnknown="0" totalRun="10">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T12:02:18Z" fail="4" name="root" pass="6" skipped="0" statusUnknown="0" totalRun="10">
    <testResult status="fail" testName="root-0101"/>
    <testResult status="fail" testName="root-0102"/>
    <testResult status="pass" testName="root-0103"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_analyze-string-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_analyze-string-test-set_result.xml
index ab4cdcf8c..d7cb08c9b 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_analyze-string-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_analyze-string-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:37Z" fail="17" name="analyze-string" pass="36" skipped="5" statusUnknown="0" totalRun="58">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:41Z" fail="17" name="analyze-string" pass="36" skipped="5" statusUnknown="0" totalRun="58">
    <testResult status="pass" testName="analyze-string-001"/>
    <testResult status="pass" testName="analyze-string-002"/>
    <testResult status="pass" testName="analyze-string-003"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_apply-templates-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_apply-templates-test-set_result.xml
index b80ecd8e6..e206c12b5 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_apply-templates-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_apply-templates-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:37Z" fail="28" name="apply-templates" pass="20" skipped="2" statusUnknown="0" totalRun="50">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:41Z" fail="28" name="apply-templates" pass="20" skipped="2" statusUnknown="0" totalRun="50">
    <testResult status="fail" testName="apply-templates-001">
       <outResult>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&#13;
 &#13;
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_attribute-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_attribute-test-set_result.xml
index 43e47a894..912b8441d 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_attribute-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_attribute-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:38Z" fail="12" name="attribute" pass="7" skipped="0" statusUnknown="2" totalRun="21">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:43Z" fail="12" name="attribute" pass="7" skipped="0" statusUnknown="2" totalRun="21">
    <testResult status="fail" testName="attribute-0001"/>
    <testResult status="fail" testName="attribute-0002">
       <outResult/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_call-template-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_call-template-test-set_result.xml
index a91ceb0a2..8ac3297cc 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_call-template-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_call-template-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:39Z" fail="15" name="call-template" pass="26" skipped="1" statusUnknown="0" totalRun="42">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:44Z" fail="14" name="call-template" pass="27" skipped="1" statusUnknown="0" totalRun="42">
    <testResult status="fail" testName="call-template-0001">
       <outResult>
          <errTrace>XPTY0004 : An error occured while evaluating an XPath expression ancestor-or-self::*.</errTrace>
@@ -63,7 +63,7 @@
    <testResult status="pass" testName="call-template-1801"/>
    <testResult status="pass" testName="call-template-1802"/>
    <testResult status="pass" testName="call-template-1803"/>
-   <testResult status="fail" testName="call-template-1901"/>
+   <testResult status="pass" testName="call-template-1901"/>
    <testResult status="pass" testName="call-template-2001"/>
    <testResult status="fail" testName="call-template-2101">
       <outResult>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;out&gt;test,pvar2 default data&lt;/out&gt;</outResult>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_choose-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_choose-test-set_result.xml
index 0a3f145a0..8e898f1d2 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_choose-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_choose-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:39Z" fail="6" name="choose" pass="17" skipped="0" statusUnknown="1" totalRun="24">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:44Z" fail="6" name="choose" pass="17" skipped="0" statusUnknown="1" totalRun="24">
    <testResult status="pass" testName="choose-0101"/>
    <testResult status="pass" testName="choose-0102"/>
    <testResult status="fail" testName="choose-0103"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_copy-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_copy-test-set_result.xml
index 37a16e5af..135b2ed02 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_copy-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_copy-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:41Z" fail="43" name="copy" pass="16" skipped="0" statusUnknown="1" totalRun="60">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:46Z" fail="43" name="copy" pass="16" skipped="0" statusUnknown="1" totalRun="60">
    <testResult status="fail" testName="copy-0101"/>
    <testResult status="pass" testName="copy-0102"/>
    <testResult status="fail" testName="copy-0103"/>
@@ -49,42 +49,42 @@
    <testResult status="fail" testName="copy-0611"/>
    <testResult status="fail" testName="copy-0612">
       <outResult>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
       </outResult>
    </testResult>
    <testResult status="fail" testName="copy-0613">
       <outResult>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
       </outResult>
    </testResult>
    <testResult status="fail" testName="copy-0614">
       <outResult>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
       </outResult>
    </testResult>
    <testResult status="fail" testName="copy-0615">
       <outResult>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
       </outResult>
    </testResult>
    <testResult status="fail" testName="copy-0616">
@@ -129,33 +129,33 @@
    </testResult>
    <testResult status="fail" testName="copy-0620">
       <outResult>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
          <errTrace>A node test that matches either NCName:* or QName was expected.</errTrace>
       </outResult>
    </testResult>
    <testResult status="fail" testName="copy-0621">
       <outResult>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
          <errTrace>A node test that matches either NCName:* or QName was expected.</errTrace>
       </outResult>
    </testResult>
    <testResult status="fail" testName="copy-0622">
       <outResult>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
          <errTrace>A node test that matches either NCName:* or QName was expected.</errTrace>
       </outResult>
    </testResult>
    <testResult status="fail" testName="copy-0623">
       <outResult>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
-         <errTrace>XPTY0004 : Function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
+         <errTrace>XPTY0004 : An xsl:function call argument at position 1 for function {http://local-functions/}in-scope-namespaces(), doesn't match the declared parameter type element(*).</errTrace>
          <errTrace>A node test that matches either NCName:* or QName was expected.</errTrace>
       </outResult>
    </testResult>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_element-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_element-test-set_result.xml
index 918f3f46f..a6fb02cac 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_element-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_element-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:44Z" fail="14" name="element" pass="8" skipped="0" statusUnknown="1" totalRun="23">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:49Z" fail="14" name="element" pass="8" skipped="0" statusUnknown="1" totalRun="23">
    <testResult status="fail" testName="element-0001">
       <outResult/>
    </testResult>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_for-each-group-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_for-each-group-test-set_result.xml
index a8b24a00e..f0f018e22 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_for-each-group-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_for-each-group-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:37Z" fail="29" name="for-each-group" pass="44" skipped="4" statusUnknown="1" totalRun="78">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:42Z" fail="29" name="for-each-group" pass="44" skipped="4" statusUnknown="1" totalRun="78">
    <testResult status="pass" testName="for-each-group-001"/>
    <testResult status="skipped" xsltVersion="2.0 only"/>
    <testResult status="pass" testName="for-each-group-002"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_iterate-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_iterate-test-set_result.xml
index 4000cecbe..be8df74a9 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_iterate-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_iterate-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:42Z" fail="32" name="iterate" pass="11" skipped="0" statusUnknown="1" totalRun="44">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:47Z" fail="32" name="iterate" pass="11" skipped="0" statusUnknown="1" totalRun="44">
    <testResult status="pass" testName="iterate-001"/>
    <testResult status="pass" testName="iterate-002"/>
    <testResult status="pass" testName="iterate-003"/>
@@ -120,7 +120,7 @@
    <testResult status="fail" testName="iterate-028">
       <outResult>
          <errTrace>ERROR! Unknown op code: 0</errTrace>
-         <errTrace>java.lang.ArrayIndexOutOfBoundsException: -1</errTrace>
+         <errTrace>java.lang.ArrayIndexOutOfBoundsException</errTrace>
       </outResult>
    </testResult>
    <testResult status="pass" testName="iterate-029"/>
@@ -128,7 +128,7 @@
       <outResult>
          <errTrace>XTSE3120 : an xsl:next-iteration instruction is not in a tail position within the sequence constructor of currently active xsl:iterate instruction.</errTrace>
          <errTrace>ERROR! Unknown op code: 0</errTrace>
-         <errTrace>java.lang.ArrayIndexOutOfBoundsException: -1</errTrace>
+         <errTrace>java.lang.ArrayIndexOutOfBoundsException</errTrace>
       </outResult>
    </testResult>
    <testResult status="fail" testName="iterate-031">
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_sequence-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_sequence-test-set_result.xml
index b88bd490a..5623b86a1 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_sequence-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_sequence-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:42Z" fail="19" name="sequence" pass="7" skipped="0" statusUnknown="1" totalRun="27">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:48Z" fail="19" name="sequence" pass="7" skipped="0" statusUnknown="1" totalRun="27">
    <testResult status="fail" testName="sequence-0101"/>
    <testResult status="fail" testName="sequence-0102"/>
    <testResult status="pass" testName="sequence-0103"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_sort-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_sort-test-set_result.xml
index 4ef4cc370..5a4c243fd 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_sort-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_sort-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:45Z" fail="44" name="sort" pass="35" skipped="0" statusUnknown="1" totalRun="80">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:50Z" fail="44" name="sort" pass="35" skipped="0" statusUnknown="1" totalRun="80">
    <testResult status="pass" testName="sort-001"/>
    <testResult status="pass" testName="sort-002"/>
    <testResult status="fail" testName="sort-003">
@@ -64,7 +64,7 @@
    <testResult status="fail" testName="sort-053"/>
    <testResult status="fail" testName="sort-054">
       <outResult>
-         <errTrace>XTTE0590 : The value to parameter 'v' cannot be assigned. Either the parameter's input is not available or parameter's value cannot be cast to an expected type.</errTrace>
+         <errTrace>XTDE0700 : No value supplied for the required parameter $v. A value is required for the parameter because the default value is not a valid instance of the required type.</errTrace>
       </outResult>
    </testResult>
    <testResult status="fail" testName="sort-055">
@@ -78,7 +78,7 @@
    <testResult status="fail" testName="sort-061"/>
    <testResult status="fail" testName="sort-062">
       <outResult>
-         <errTrace>XTTE0590 : The value to parameter 'list1' cannot be assigned. Either the parameter's input is not available or parameter's value cannot be cast to an expected type.</errTrace>
+         <errTrace>XTDE0700 : No value supplied for the required parameter $list1. A value is required for the parameter because the default value is not a valid instance of the required type.</errTrace>
       </outResult>
    </testResult>
    <testResult status="fail" testName="sort-063"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_try-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_try-test-set_result.xml
index ca93e0d89..f37d97936 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_try-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/insn/_try-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:38Z" fail="26" name="try" pass="11" skipped="5" statusUnknown="0" totalRun="42">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:42Z" fail="26" name="try" pass="11" skipped="5" statusUnknown="0" totalRun="42">
    <testResult status="pass" testName="try-001"/>
    <testResult status="fail" testName="try-002">
       <outResult/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/misc/_regex-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/misc/_regex-test-set_result.xml
index abfc11fbc..e196eb8d8 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/misc/_regex-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/misc/_regex-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:31:28Z" fail="12" name="regex" pass="33" skipped="0" statusUnknown="0" totalRun="45">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T12:02:18Z" fail="12" name="regex" pass="33" skipped="0" statusUnknown="0" totalRun="45">
    <testResult status="pass" testName="regex-001"/>
    <testResult status="fail" testName="regex-002"/>
    <testResult status="pass" testName="regex-003"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_boolean-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_boolean-test-set_result.xml
index 2612135f2..e663d43d8 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_boolean-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_boolean-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:49Z" fail="22" name="boolean" pass="90" skipped="0" statusUnknown="0" totalRun="112">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:55Z" fail="23" name="boolean" pass="89" skipped="0" statusUnknown="0" totalRun="112">
    <testResult status="pass" testName="boolean-001"/>
    <testResult status="pass" testName="boolean-002"/>
    <testResult status="pass" testName="boolean-003"/>
@@ -69,7 +69,7 @@
    <testResult status="fail" testName="boolean-068"/>
    <testResult status="fail" testName="boolean-069">
       <outResult>
-         <errTrace>XTTE0590 : The value to parameter 'set1' cannot be assigned. Either the parameter's input is not available or parameter's value cannot be cast to an expected type.</errTrace>
+         <errTrace>XTDE0700 : No value supplied for the required parameter $set1. A value is required for the parameter because the default value is not a valid instance of the required type.</errTrace>
       </outResult>
    </testResult>
    <testResult status="pass" testName="boolean-070"/>
@@ -121,7 +121,7 @@
    <testResult status="pass" testName="boolean-106"/>
    <testResult status="pass" testName="boolean-107"/>
    <testResult status="pass" testName="boolean-108"/>
-   <testResult status="pass" testName="boolean-109"/>
+   <testResult status="fail" testName="boolean-109"/>
    <testResult status="pass" testName="boolean-110"/>
    <testResult status="pass" testName="boolean-111"/>
    <testResult status="pass" testName="boolean-112"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_date-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_date-test-set_result.xml
index d69de8c24..b9469760b 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_date-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_date-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:50Z" fail="49" name="date" pass="35" skipped="0" statusUnknown="1" totalRun="85">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:55Z" fail="49" name="date" pass="35" skipped="0" statusUnknown="1" totalRun="85">
    <testResult status="pass" testName="date-001"/>
    <testResult status="pass" testName="date-002"/>
    <testResult status="pass" testName="date-003"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_node-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_node-test-set_result.xml
index 0fdf901c0..e0a4779da 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_node-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_node-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:50Z" fail="17" name="node" pass="15" skipped="0" statusUnknown="0" totalRun="32">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:55Z" fail="17" name="node" pass="15" skipped="0" statusUnknown="0" totalRun="32">
    <testResult status="pass" testName="node-0101"/>
    <testResult status="pass" testName="node-0201"/>
    <testResult status="fail" testName="node-0301">
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_string-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_string-test-set_result.xml
index 32ff39e29..124e1549f 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_string-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_string-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-07T07:29:50Z" fail="8" name="string" pass="128" skipped="0" statusUnknown="0" totalRun="136">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-06-09T11:59:55Z" fail="8" name="string" pass="128" skipped="0" statusUnknown="0" totalRun="136">
    <testResult status="pass" testName="string-001"/>
    <testResult status="pass" testName="string-002"/>
    <testResult status="pass" testName="string-003"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/w3c_xslt3_testsuite_xalan-j_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/w3c_xslt3_testsuite_xalan-j_result.xml
index 65e43772e..8fed2296a 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/w3c_xslt3_testsuite_xalan-j_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/w3c_xslt3_testsuite_xalan-j_result.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<testResult dateTime="2025-06-07T07:31:56Z" desc="W3C XSLT 3.0 test suite results" fail="822" pass="1275" skipped="34" success="60.49%" totalRun="2164" xslt_processor="Xalan-J XSLT 3.0 development code">
+<testResult dateTime="2025-06-09T12:02:34Z" desc="W3C XSLT 3.0 test suite results" fail="819" pass="1278" skipped="34" success="60.63%" totalRun="2164" xslt_processor="Xalan-J XSLT 3.0 development code">
   <attr>
-    <as fail="97" pass="11" skipped="0" success="10.09%" totalRun="109"/>
+    <as fail="96" pass="12" skipped="0" success="11.01%" totalRun="109"/>
     <avt fail="14" pass="21" skipped="0" success="60.0%" totalRun="35"/>
     <match fail="67" pass="57" skipped="8" success="47.45%" totalRun="137"/>
     <select fail="7" pass="16" skipped="0" success="64.0%" totalRun="25"/>
@@ -10,7 +10,7 @@
     <attribute-set fail="7" pass="41" skipped="1" success="84.0%" totalRun="50"/>
     <character-map fail="12" pass="15" skipped="0" success="51.72%" totalRun="29"/>
     <function fail="39" pass="22" skipped="4" success="37.14%" totalRun="70"/>
-    <variable fail="11" pass="8" skipped="0" success="40.0%" totalRun="20"/>
+    <variable fail="9" pass="10" skipped="0" success="50.0%" totalRun="20"/>
   </decl>
   <expr>
     <axes fail="29" pass="172" skipped="0" success="85.57%" totalRun="201"/>
@@ -34,7 +34,7 @@
     <analyze-string fail="17" pass="36" skipped="5" success="70.69%" totalRun="58"/>
     <apply-templates fail="28" pass="20" skipped="2" success="44.0%" totalRun="50"/>
     <attribute fail="12" pass="7" skipped="0" success="33.33%" totalRun="21"/>
-    <call-template fail="15" pass="26" skipped="1" success="64.29%" totalRun="42"/>
+    <call-template fail="14" pass="27" skipped="1" success="66.67%" totalRun="42"/>
     <choose fail="6" pass="17" skipped="0" success="70.83%" totalRun="24"/>
     <copy fail="43" pass="16" skipped="0" success="26.67%" totalRun="60"/>
     <element fail="14" pass="8" skipped="0" success="34.78%" totalRun="23"/>
@@ -48,7 +48,7 @@
     <regex fail="12" pass="33" skipped="0" success="73.33%" totalRun="45"/>
   </misc>
   <type>
-    <boolean fail="22" pass="90" skipped="0" success="80.36%" totalRun="112"/>
+    <boolean fail="23" pass="89" skipped="0" success="79.46%" totalRun="112"/>
     <date fail="49" pass="35" skipped="0" success="41.18%" totalRun="85"/>
     <node fail="17" pass="15" skipped="0" success="46.88%" totalRun="32"/>
     <string fail="8" pass="128" skipped="0" success="94.12%" totalRun="136"/>
diff --git a/src/test/java/org/apache/xalan/tests/xpath3/XPathInstanceOfExprTests.java b/src/test/java/org/apache/xalan/tests/xpath3/XPathInstanceOfExprTests.java
index 2ec78b72f..5b20ffa60 100644
--- a/src/test/java/org/apache/xalan/tests/xpath3/XPathInstanceOfExprTests.java
+++ b/src/test/java/org/apache/xalan/tests/xpath3/XPathInstanceOfExprTests.java
@@ -136,5 +136,15 @@ public class XPathInstanceOfExprTests extends XslTransformTestsUtil {
         
         runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
     }
+    
+    @Test
+    public void xslInstanceOfExprTest10() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test10.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test10.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test10.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
 
 }
diff --git a/src/test/resources/instanceof_expr/gold/test10.out b/src/test/resources/instanceof_expr/gold/test10.out
new file mode 100644
index 000000000..afa685e08
--- /dev/null
+++ b/src/test/resources/instanceof_expr/gold/test10.out
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>true</one>
+  <two>0</two>
+  <three>false</three>
+  <four/>
+</result>
diff --git a/src/test/resources/instanceof_expr/test10.xsl b/src/test/resources/instanceof_expr/test10.xsl
new file mode 100644
index 000000000..0daa7f459
--- /dev/null
+++ b/src/test/resources/instanceof_expr/test10.xsl
@@ -0,0 +1,41 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:xs="http://www.w3.org/2001/XMLSchema" 
+				exclude-result-prefixes="xs" 
+				version="3.0">	
+
+    <!-- Author: mukulg@apache.org -->
+    
+    <!-- An XSL stylesheet test case, to test XPath "instance of" operator 
+         applied with one of it's operand being an empty sequence. -->
+    
+    <xsl:output method="xml" indent="yes"/>
+	
+    <xsl:template match="/">
+        <result>
+		   <xsl:variable name="p" select="()" as="xs:int*"/>
+           <one><xsl:value-of select="$p instance of xs:int*"/></one>
+		   <two><xsl:value-of select="count($p)"/></two>
+		   <three><xsl:value-of select="$p[1] instance of xs:int"/></three>
+		   <four><xsl:value-of select="$p[1] + 1"/></four>
+        </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/src/test/resources/xsl_try_catch/test8.xsl b/src/test/resources/xsl_try_catch/test8.xsl
index a8bb024b6..69b95b09e 100644
--- a/src/test/resources/xsl_try_catch/test8.xsl
+++ b/src/test/resources/xsl_try_catch/test8.xsl
@@ -15,11 +15,12 @@
        an xsl:try instruction. If an addition fails due to incorrectly typed 
        operands, then xsl:catch instruction produces a recovery result 
        (an XML element "error"), otherwise addition details get available
-       with an XML element "sum". When a particular addition operation fails, the 
-       subsequent xsl:for-each iterations are continued to be processed.
+       with an XML element "sum". When a particular XPath addition operation 
+       fails, the subsequent xsl:for-each iterations are continued to be 
+       processed.
        
        In the absence of xsl:try instruction processing, an XSL stylesheet 
-       processing gets aborted after the first addition operation failure.                     
+       processing will be aborted after the first addition operation failure.                     
   -->				
 
   <xsl:output method="xml" indent="yes"/>


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