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

[xalan-java] branch xalan-j_xslt3.0 updated: committing implementation of xpath 3.1 fn:codepoint-equal function. doing little bit of codebase refactoring within class ElemCopyOf. completing the implementation of XML Schema data type xs:string for the xpath 3.1 implementation. there are few other minor codebase improvements as well. committing few new related working test cases as well, on this dev repos branch.

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

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


The following commit(s) were added to refs/heads/xalan-j_xslt3.0 by this push:
     new f8714f01 committing implementation of xpath 3.1 fn:codepoint-equal function. doing little bit of codebase refactoring within class ElemCopyOf. completing the implementation of XML Schema data type xs:string for the xpath 3.1 implementation. there are few other minor codebase improvements as well. committing few new related working test cases as well, on this dev repos branch.
     new 6a1df985 Merge pull request #57 from mukulga/xalan-j_xslt3.0_mukul
f8714f01 is described below

commit f8714f016b515b3d5fc297290da5d9d6248bfac2
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Mon Aug 21 21:44:20 2023 +0530

    committing implementation of xpath 3.1 fn:codepoint-equal function. doing little bit of codebase refactoring within class ElemCopyOf. completing the implementation of XML Schema data type xs:string for the xpath 3.1 implementation. there are few other minor codebase improvements as well. committing few new related working test cases as well, on this dev repos branch.
---
 src/org/apache/xalan/templates/ElemCopyOf.java     | 209 ++++++++++-----------
 src/org/apache/xpath/XPathCollationSupport.java    |  35 ++--
 src/org/apache/xpath/compiler/FunctionTable.java   |   9 +-
 src/org/apache/xpath/compiler/Keywords.java        |   3 +
 .../apache/xpath/functions/FuncCodepointEqual.java | 162 ++++++++++++++++
 src/org/apache/xpath/functions/FuncSort.java       |  14 +-
 src/org/apache/xpath/functions/FuncSubstring.java  |  19 +-
 src/org/apache/xpath/objects/XObject.java          | 102 +++++++++-
 src/org/apache/xpath/xs/types/XSString.java        |  43 ++++-
 tests/fn_codepoint_equal/gold/test1.out            |   7 +
 tests/fn_codepoint_equal/gold/test2.out            |   6 +
 tests/fn_codepoint_equal/test1.xsl                 |  40 ++++
 tests/fn_codepoint_equal/test1_a.xml               |   6 +
 tests/fn_codepoint_equal/test2.xsl                 |  46 +++++
 tests/fn_sort/gold/test11.out                      |  22 +++
 tests/fn_sort/gold/test12.out                      |   4 +
 tests/fn_sort/gold/test13.out                      |  54 ++++++
 tests/fn_sort/test14.xsl                           |  43 +++++
 tests/fn_sort/test15.xsl                           |  59 ++++++
 tests/fn_sort/test16.xsl                           |  62 ++++++
 tests/fn_sort/test1_f.xml                          |  22 +++
 tests/fn_sort/test1_g.xml                          |  26 +++
 .../apache/xalan/xpath3/FnCodepointEqualTests.java |  72 +++++++
 tests/org/apache/xalan/xpath3/FnSortTests.java     |  30 +++
 .../xalan/xpath3/XsConstructorFunctionTests.java   |  50 +++++
 tests/org/apache/xalan/xslt3/AllXsl3Tests.java     |   3 +-
 tests/xs_constructor_functions/gold/test11.out     |  10 +
 tests/xs_constructor_functions/gold/test12.out     |   8 +
 tests/xs_constructor_functions/test13.xsl          |  49 +++++
 tests/xs_constructor_functions/test14.xsl          |  51 +++++
 tests/xs_constructor_functions/test15.xsl          |  45 +++++
 tests/xs_constructor_functions/test16.xsl          |  45 +++++
 tests/xs_constructor_functions/test17.xsl          |  45 +++++
 tests/xs_constructor_functions/test1_c.xml         |  22 +++
 34 files changed, 1268 insertions(+), 155 deletions(-)

diff --git a/src/org/apache/xalan/templates/ElemCopyOf.java b/src/org/apache/xalan/templates/ElemCopyOf.java
index 7658ede8..373bbc48 100644
--- a/src/org/apache/xalan/templates/ElemCopyOf.java
+++ b/src/org/apache/xalan/templates/ElemCopyOf.java
@@ -35,11 +35,13 @@ import org.apache.xml.serializer.SerializationHandler;
 import org.apache.xpath.XPath;
 import org.apache.xpath.XPathContext;
 import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XNodeSet;
 import org.apache.xpath.objects.XNumber;
 import org.apache.xpath.objects.XObject;
 import org.apache.xpath.xs.types.XSNumericType;
 import org.apache.xpath.xs.types.XSUntyped;
 import org.apache.xpath.xs.types.XSUntypedAtomic;
+import org.xml.sax.SAXException;
 
 /**
  * Implementation of XSLT xsl:copy-of instruction.
@@ -76,6 +78,8 @@ public class ElemCopyOf extends ElemTemplateElement
   // this class.    
   private Vector fVars;    
   private int fGlobalsSize;
+  
+  private final char SPACE_CHAR = ' ';
 
   /**
    * Set the "select" attribute.
@@ -155,9 +159,7 @@ public class ElemCopyOf extends ElemTemplateElement
    *
    * @throws TransformerException
    */
-  public void execute(
-          TransformerImpl transformer)
-            throws TransformerException
+  public void execute(TransformerImpl transformer) throws TransformerException
   {
     if (transformer.getDebug())
     	transformer.getTraceManager().fireTraceEvent(this);
@@ -186,132 +188,34 @@ public class ElemCopyOf extends ElemTemplateElement
 
       if (value != null) {
         int type = value.getType();
-        String s;
+        String str;
 
         switch (type)
         {
         case XObject.CLASS_BOOLEAN :
         case XObject.CLASS_NUMBER :
         case XObject.CLASS_STRING :
-          s = value.str();
+          str = value.str();
 
-          handler.characters(s.toCharArray(), 0, s.length());
+          handler.characters(str.toCharArray(), 0, str.length());
           break;
-        case XObject.CLASS_NODESET :
-
-          // System.out.println(value);
-          DTMIterator nl = value.iter();
-
-          // Copy the tree.
-          DTMTreeWalker tw = new TreeWalker2Result(transformer, handler);
-          int pos;
-
-          while (DTM.NULL != (pos = nl.nextNode()))
-          {
-            DTM dtm = xctxt.getDTMManager().getDTM(pos);
-            short t = dtm.getNodeType(pos);
-
-            // If we just copy the whole document, a startDoc and endDoc get 
-            // generated, so we need to only walk the child nodes.
-            if (t == DTM.DOCUMENT_NODE)
-            {
-              for (int child = dtm.getFirstChild(pos); child != DTM.NULL;
-                   child = dtm.getNextSibling(child))
-              {
-                tw.traverse(child);
-              }
-            }
-            else if (t == DTM.ATTRIBUTE_NODE)
-            {
-              SerializerUtils.addAttribute(handler, pos);
-            }
-            else
-            {
-              tw.traverse(pos);
-            }
-          }
-          // nl.detach();
+        case XObject.CLASS_NODESET :          
+          copyOfActionOnNodeSet((XNodeSet)value, transformer, handler, xctxt);          
           break;
         case XObject.CLASS_RTREEFRAG :
           SerializerUtils.outputResultTreeFragment(
-            handler, value, transformer.getXPathContext());
+                                                handler, value, transformer.getXPathContext());
           break;
         case XObject.CLASS_RESULT_SEQUENCE :
           // added for XSLT 3.0          
           ResultSequence resultSequence = (ResultSequence)value;
-          char[] spaceCharArr = new char[1];
-          spaceCharArr[0] = ' ';
-          
-          for (int idx = 0; idx < resultSequence.size(); idx++) {             
-             XObject sequenceItem = resultSequence.item(idx);
-             
-             if (sequenceItem.getType() == XObject.CLASS_STRING) {
-                 String str = sequenceItem.str();
-                 handler.characters(str.toCharArray(), 0, str.length());
-                 if (idx < (resultSequence.size() - 1)) {                     
-                    handler.characters(spaceCharArr, 0, 1);
-                 }
-             }
-             else if (sequenceItem.getType() == XObject.CLASS_NUMBER) {
-                 String str = ((XNumber)sequenceItem).str();
-                 handler.characters(str.toCharArray(), 0, str.length());
-                 if (idx < (resultSequence.size() - 1)) {                     
-                    handler.characters(spaceCharArr, 0, 1);
-                 }
-             }
-             else if (sequenceItem instanceof XSNumericType) {
-                 String str = ((XSNumericType)sequenceItem).stringValue();
-                 handler.characters(str.toCharArray(), 0, str.length());
-                 if (idx < (resultSequence.size() - 1)) {                     
-                    handler.characters(spaceCharArr, 0, 1);
-                 }
-             }
-             else if (sequenceItem instanceof XSUntyped) {
-                 String str = ((XSUntyped)sequenceItem).stringValue();
-                 handler.characters(str.toCharArray(), 0, str.length());
-                 if (idx < (resultSequence.size() - 1)) {                     
-                    handler.characters(spaceCharArr, 0, 1);
-                 }
-             }
-             else if (sequenceItem instanceof XSUntypedAtomic) {
-                 String str = ((XSUntypedAtomic)sequenceItem).stringValue();
-                 handler.characters(str.toCharArray(), 0, str.length());
-                 if (idx < (resultSequence.size() - 1)) {                     
-                    handler.characters(spaceCharArr, 0, 1);
-                 } 
-             }
-             else if (sequenceItem.getType() == XObject.CLASS_NODESET) {                 
-                 DTMIterator nl1 = sequenceItem.iter();
-
-                 DTMTreeWalker tw1 = new TreeWalker2Result(transformer, handler);
-                 int pos1;                 
-                 
-                 while (DTM.NULL != (pos1 = nl1.nextNode())) {
-                     DTM dtm = xctxt.getDTMManager().getDTM(pos1);
-                     short t = dtm.getNodeType(pos1);
-                   
-                     if (t == DTM.DOCUMENT_NODE) {
-                        for (int child = dtm.getFirstChild(pos1); child != DTM.NULL; 
-                                                                     child = dtm.getNextSibling(child)) {
-                            tw1.traverse(child);
-                        }
-                     }
-                     else if (t == DTM.ATTRIBUTE_NODE) {
-                         SerializerUtils.addAttribute(handler, pos1);
-                     }
-                     else {
-                         tw1.traverse(pos1);
-                     }
-                 }
-             }
-          }
           
+          copyOfActionOnResultSequence(resultSequence, transformer, handler, xctxt);          
           break;
-        default :
+        default :          
+          str = value.str();
+          handler.characters(str.toCharArray(), 0, str.length());
           
-          s = value.str();
-
-          handler.characters(s.toCharArray(), 0, s.length());
           break;
         }
       }
@@ -357,5 +261,88 @@ public class ElemCopyOf extends ElemTemplateElement
   		m_selectExpression.getExpression().callVisitors(m_selectExpression, visitor);
     super.callChildVisitors(visitor, callAttrs);
   }
+  
+  /**
+   *  Method to perform xsl:copy-of instruction's action, on an XNodeSet object.
+   */
+  private void copyOfActionOnNodeSet(XNodeSet nodeSet, TransformerImpl transformer, 
+                                                               SerializationHandler serializationHandler, XPathContext xctxt) 
+                                                                                          throws TransformerException, SAXException {
+      DTMIterator dtmIter = nodeSet.iter();
+
+      DTMTreeWalker tw = new TreeWalker2Result(transformer, serializationHandler);
+      int pos;                 
+
+      while ((pos = dtmIter.nextNode()) != DTM.NULL) {
+          DTM dtm = xctxt.getDTMManager().getDTM(pos);
+          short t = dtm.getNodeType(pos);
+
+          if (t == DTM.DOCUMENT_NODE) {
+             for (int child = dtm.getFirstChild(pos); child != DTM.NULL; 
+                      child = dtm.getNextSibling(child)) {
+                tw.traverse(child);
+             }
+          }
+          else if (t == DTM.ATTRIBUTE_NODE) {
+             SerializerUtils.addAttribute(serializationHandler, pos);
+          }
+          else {
+             tw.traverse(pos);
+          }
+      } 
+  }
+  
+  /**
+   * Method to perform xsl:copy-of instruction's action, on an ResultSequence object.
+   */
+  private void copyOfActionOnResultSequence(ResultSequence resultSequence, TransformerImpl transformer, 
+                                                                      SerializationHandler serializationHandler, 
+                                                                                       XPathContext xctxt) throws TransformerException, SAXException {
+      char[] spaceCharArr = new char[1];      
+      spaceCharArr[0] = SPACE_CHAR;
+      
+      for (int idx = 0; idx < resultSequence.size(); idx++) {             
+         XObject sequenceItem = resultSequence.item(idx);
+         
+         if (sequenceItem.getType() == XObject.CLASS_STRING) {
+             String str = sequenceItem.str();
+             serializationHandler.characters(str.toCharArray(), 0, str.length());
+             if (idx < (resultSequence.size() - 1)) {                     
+                serializationHandler.characters(spaceCharArr, 0, 1);
+             }
+         }
+         else if (sequenceItem.getType() == XObject.CLASS_NUMBER) {
+             String str = ((XNumber)sequenceItem).str();
+             serializationHandler.characters(str.toCharArray(), 0, str.length());
+             if (idx < (resultSequence.size() - 1)) {                     
+                serializationHandler.characters(spaceCharArr, 0, 1);
+             }
+         }
+         else if (sequenceItem instanceof XSNumericType) {
+             String str = ((XSNumericType)sequenceItem).stringValue();
+             serializationHandler.characters(str.toCharArray(), 0, str.length());
+             if (idx < (resultSequence.size() - 1)) {                     
+                serializationHandler.characters(spaceCharArr, 0, 1);
+             }
+         }
+         else if (sequenceItem instanceof XSUntyped) {
+             String str = ((XSUntyped)sequenceItem).stringValue();
+             serializationHandler.characters(str.toCharArray(), 0, str.length());
+             if (idx < (resultSequence.size() - 1)) {                     
+                serializationHandler.characters(spaceCharArr, 0, 1);
+             }
+         }
+         else if (sequenceItem instanceof XSUntypedAtomic) {
+             String str = ((XSUntypedAtomic)sequenceItem).stringValue();
+             serializationHandler.characters(str.toCharArray(), 0, str.length());
+             if (idx < (resultSequence.size() - 1)) {                     
+                serializationHandler.characters(spaceCharArr, 0, 1);
+             } 
+         }
+         else if (sequenceItem.getType() == XObject.CLASS_NODESET) {                 
+             copyOfActionOnNodeSet((XNodeSet)sequenceItem, transformer, serializationHandler, xctxt);
+         }
+      } 
+  }
 
 }
diff --git a/src/org/apache/xpath/XPathCollationSupport.java b/src/org/apache/xpath/XPathCollationSupport.java
index 958ab957..64569389 100644
--- a/src/org/apache/xpath/XPathCollationSupport.java
+++ b/src/org/apache/xpath/XPathCollationSupport.java
@@ -72,7 +72,6 @@ public class XPathCollationSupport {
     
     private List<UCAParameter> fUcaSupportedParameters = new ArrayList<UCAParameter>();
     
-    // This class field, is needed by unicode collation algorithm
     private String fQueryStrFallbackValue = null;
     
     private String fDefaultCollationUri = null;
@@ -178,8 +177,9 @@ public class XPathCollationSupport {
     }
     
     /**
-     * Compare two int[] arrays comprising unicode codepoints, according to
-     * 'Unicode Codepoint Collation'.
+     * This method compares two int[] arrays comprising unicode codepoints 
+     * (corresponding to the strings to be compared), according to 'Unicode 
+     * Codepoint Collation' as defined by XPath 3.1 F&O spec.
      */
     private int compareCodepointArrays(int[] codePointsArr1, int[] codePointsArr2) {
        
@@ -187,37 +187,38 @@ public class XPathCollationSupport {
        
        if (((codePointsArr1 == null) || (codePointsArr1.length == 0)) && 
            ((codePointsArr2 == null) || (codePointsArr2.length == 0))) {
-          // both strings are considered equal
+          // both strings are equal
           comparisonResult = 0; 
        }
        else if (((codePointsArr1 == null) || (codePointsArr1.length == 0)) &&
                 ((codePointsArr2 != null) && (codePointsArr2.length > 0))) {
-          // the first string is less than the second one
+          // the first string collates before the second one
           comparisonResult = -1; 
        }
        else if (((codePointsArr1 != null) && (codePointsArr1.length > 0)) &&
                 ((codePointsArr2 == null) || (codePointsArr2.length == 0))) {
-          // the second string is less than the first one
+          // the first string collates after the second one
           comparisonResult = 1; 
        }
        else {
-          // both the strings to be compared, have non empty code point arrays
+          // both the strings to be compared, have non empty code point 
+          // arrays.
           int arr1FirstCodepoint = codePointsArr1[0];
           int arr2FirstCodepoint = codePointsArr2[0];
-          if (arr1FirstCodepoint > arr2FirstCodepoint) {
-             comparisonResult = 1;  
+          if (arr1FirstCodepoint < arr2FirstCodepoint) {
+             comparisonResult = -1;  
           }
-          else if (arr2FirstCodepoint > arr1FirstCodepoint) {
-             comparisonResult = -1; 
+          else if (arr1FirstCodepoint > arr2FirstCodepoint) {
+             comparisonResult = 1; 
           }
           else {             
              List<Integer> list1 = getIntegerListFromIntArray(codePointsArr1);
              List<Integer> list2 = getIntegerListFromIntArray(codePointsArr2);
                  
-             // get all, but the first item in the list 'list1'
+             // get all, except the first item in the list 'list1'
              list1 = list1.subList(1, list1.size());
              
-             // get all, but the first item in the list 'list2'
+             // get all, except the first item in the list 'list2'
              list2 = list2.subList(1, list2.size());
              
              // recursive call to this function
@@ -340,8 +341,8 @@ public class XPathCollationSupport {
     }
     
     /**
-     * Get the java.text.Collator object, for XalanJ's
-     * default collation when using 'unicode collation algorithm'.
+     * Get the java.text.Collator object, corresponding to XalanJ's 
+     * default collation when using 'Unicode Collation Algorithm' (UCA).
      */
     private Collator getDefaultUCACollator() {
         
@@ -368,8 +369,8 @@ public class XPathCollationSupport {
     }
     
     /**
-     * From the requested collation uri, build a corresponding java.util.Map object
-     * representation.  
+     * From the requested collation uri, build a corresponding java.util.Map
+     * object representation.  
      */
     private Map<String, String> getUCAQueryStrComponents(String uriQueryStr) throws TransformerException {
        Map<String, String> queryStrMap = new HashMap<String, String>();
diff --git a/src/org/apache/xpath/compiler/FunctionTable.java b/src/org/apache/xpath/compiler/FunctionTable.java
index e3170717..304f01df 100644
--- a/src/org/apache/xpath/compiler/FunctionTable.java
+++ b/src/org/apache/xpath/compiler/FunctionTable.java
@@ -272,6 +272,9 @@ public class FunctionTable
   
   /** The 'compare()' id. */
   public static final int FUNC_COMPARE = 82;
+  
+  /** The 'codepoint-equal()' id. */
+  public static final int FUNC_CODEPOINT_EQUAL = 83;
 
   // Proprietary
 
@@ -329,7 +332,7 @@ public class FunctionTable
    * Number of built in functions. Be sure to update this as
    * built-in functions are added.
    */
-  private static final int NUM_BUILT_IN_FUNCS = 83;
+  private static final int NUM_BUILT_IN_FUNCS = 84;
 
   /**
    * Number of built-in functions that may be added.
@@ -495,6 +498,8 @@ public class FunctionTable
       org.apache.xpath.functions.FuncStringToCodepoints.class;
     m_functions[FUNC_COMPARE] = 
       org.apache.xpath.functions.FuncCompare.class;
+    m_functions[FUNC_CODEPOINT_EQUAL] = 
+      org.apache.xpath.functions.FuncCodepointEqual.class;
   }
 
   static{
@@ -668,6 +673,8 @@ public class FunctionTable
                          new Integer(FunctionTable.FUNC_STRING_TO_CODE_POINTS));
          m_functionID.put(Keywords.FUNC_COMPARE,
                          new Integer(FunctionTable.FUNC_COMPARE));
+         m_functionID.put(Keywords.FUNC_CODEPOINT_EQUAL,
+                         new Integer(FunctionTable.FUNC_CODEPOINT_EQUAL));
   }
   
   public FunctionTable(){
diff --git a/src/org/apache/xpath/compiler/Keywords.java b/src/org/apache/xpath/compiler/Keywords.java
index bc6d2764..ed2f516c 100644
--- a/src/org/apache/xpath/compiler/Keywords.java
+++ b/src/org/apache/xpath/compiler/Keywords.java
@@ -350,6 +350,9 @@ public class Keywords
   /** compare function string. */
   public static final String FUNC_COMPARE = "compare";
   
+  /** codepoint-equal function string. */
+  public static final String FUNC_CODEPOINT_EQUAL = "codepoint-equal";
+  
   // XML Schema built-in data type name keywords
   
   /** xs:string data type string. */
diff --git a/src/org/apache/xpath/functions/FuncCodepointEqual.java b/src/org/apache/xpath/functions/FuncCodepointEqual.java
new file mode 100644
index 00000000..1e0eba54
--- /dev/null
+++ b/src/org/apache/xpath/functions/FuncCodepointEqual.java
@@ -0,0 +1,162 @@
+/*
+ * 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.
+ */
+package org.apache.xpath.functions;
+
+import javax.xml.transform.SourceLocator;
+
+import org.apache.xpath.XPathCollationSupport;
+import org.apache.xpath.XPathContext;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XNodeSet;
+import org.apache.xpath.objects.XObject;
+import org.apache.xpath.xs.types.XSAnyType;
+import org.apache.xpath.xs.types.XSBoolean;
+
+/**
+ * Implementation of the codepoint-equal() function.
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class FuncCodepointEqual extends Function2Args {
+    
+    private static final long serialVersionUID = -2518383964235644671L;
+    
+    /**
+     * Execute the function. The function must return a valid object.
+     * 
+     * @param xctxt The current execution context.
+     * @return A valid XObject.
+     *
+     * @throws javax.xml.transform.TransformerException
+     */
+    public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
+    {
+        
+        ResultSequence result = new ResultSequence();
+        
+        SourceLocator srcLocator = xctxt.getSAXLocator();
+        
+        XPathCollationSupport xPathCollationSupport = xctxt.getXPathCollationSupport();
+
+        XObject xObject0 = m_arg0.execute(xctxt);        
+        XObject xObject1 = m_arg1.execute(xctxt);
+        
+        // If either argument to this function is an empty sequence, the function returns 
+        // an empty sequence (as required by the XPath 3.1 F&O spec).
+        
+        // Get the string value of first argument, to function call fn:codepoint-equal
+        
+        String arg0Str = null;
+        
+        if (xObject0 instanceof XNodeSet) {
+           XNodeSet nodeSet = (XNodeSet)xObject0;
+           if (nodeSet.getLength() == 0) {
+              return result; 
+           }
+           else {
+              arg0Str = nodeSet.str(); 
+           }
+        }
+        else if (xObject0 instanceof ResultSequence) {
+           ResultSequence resultSequence = (ResultSequence)xObject0;
+           if (resultSequence.size() == 0) {
+              return result; 
+           }
+           else {
+              arg0Str = getStringValueOfResultSequence(resultSequence); 
+           }
+        }
+        else if (xObject0 instanceof XSAnyType) {
+           arg0Str = ((XSAnyType)xObject0).stringValue();  
+        }
+        else {
+           arg0Str = xObject0.str();  
+        }
+        
+        // Get the string value of second argument, to function call fn:codepoint-equal
+        
+        String arg1Str = null;
+        
+        if (xObject1 instanceof XNodeSet) {
+           XNodeSet nodeSet = (XNodeSet)xObject1;
+           if (nodeSet.getLength() == 0) {
+              return result; 
+           }
+           else {
+              arg1Str = nodeSet.str();  
+           } 
+        }
+        else if (xObject1 instanceof ResultSequence) {
+           ResultSequence resultSequence = (ResultSequence)xObject1;
+           if (resultSequence.size() == 0) {
+              return result; 
+           }
+           else {
+              arg1Str = getStringValueOfResultSequence(resultSequence);    
+           } 
+        }
+        else if (xObject1 instanceof XSAnyType) {
+           arg1Str = ((XSAnyType)xObject1).stringValue();  
+        }
+        else {
+           arg1Str = xObject1.str();  
+        }
+        
+        // Do the comparison of string arguments of this function, using 'Unicode codepoint collation',
+        // as required by XPath 3.1 F&O spec.
+        int strComparisonResult = xPathCollationSupport.compareStringsUsingCollation(arg0Str, 
+                                                                                          arg1Str, xctxt.getDefaultCollation());        
+        if (strComparisonResult == 0) {
+           // The strings are equal codepoint by codepoint            
+           result.add(new XSBoolean(true));   
+        }
+        else {
+           // The strings are not equal codepoint by codepoint
+           result.add(new XSBoolean(false)); 
+        }
+        
+        return result;
+    }
+    
+    /**
+     * Get the string value of an 'ResultSequence' object. 
+     */
+    private String getStringValueOfResultSequence(ResultSequence resultSeq) {
+        String strValue = null;
+        
+        StringBuffer strBuff = new StringBuffer(); 
+        
+        for (int idx = 0; idx < resultSeq.size(); idx++) {
+           XObject resultSeqItem = resultSeq.item(idx);
+           
+           if (resultSeqItem instanceof XNodeSet) {
+              strBuff.append(((XNodeSet)resultSeqItem).str());
+           }
+           else if (resultSeqItem instanceof XSAnyType) {
+              strBuff.append(((XSAnyType)resultSeqItem).stringValue()); 
+           }
+           else {
+              strBuff.append(resultSeqItem.str()); 
+           }
+        }
+        
+        return strValue; 
+    }
+
+}
diff --git a/src/org/apache/xpath/functions/FuncSort.java b/src/org/apache/xpath/functions/FuncSort.java
index 2e2053af..017fa54b 100644
--- a/src/org/apache/xpath/functions/FuncSort.java
+++ b/src/org/apache/xpath/functions/FuncSort.java
@@ -302,8 +302,8 @@ public class FuncSort extends FunctionMultiArgs
     }
     
     /*
-     * An object of this class, is used to support sorting of an 
-     * xdm input sequence. 
+     * An object of this class, supports sorting of an xdm input 
+     * sequence, when using fn:sort function call. 
      */
     private class FnSortComparator implements Comparator {
         
@@ -322,18 +322,18 @@ public class FuncSort extends FunctionMultiArgs
         }
 
         @Override
-        public int compare(Object obj1, Object obj2) {
+        public int compare(Object obj1, Object obj2) {           
            int comparisonResult = 0;
            
            XObject sortKeyVal1 = ((InpSeqItemWithSortKeyValue)obj1).getInpSeqItemSortKeyVal();
            XObject sortKeyVal2 = ((InpSeqItemWithSortKeyValue)obj2).getInpSeqItemSortKeyVal();
            
            try {
-              if (sortKeyVal1.vcGreaterThan(sortKeyVal2, null, collationUri, true)) {
-                 comparisonResult = 1;  
+              if (sortKeyVal1.vcLessThan(sortKeyVal2, null, collationUri, true)) {
+                 comparisonResult = -1;  
               }
-              else if (sortKeyVal1.vcLessThan(sortKeyVal2, null, collationUri, true)) {
-                 comparisonResult = -1; 
+              else if (sortKeyVal1.vcGreaterThan(sortKeyVal2, null, collationUri, true)) {
+                 comparisonResult = 1; 
               }
            }
            catch (javax.xml.transform.TransformerException ex) {
diff --git a/src/org/apache/xpath/functions/FuncSubstring.java b/src/org/apache/xpath/functions/FuncSubstring.java
index e4367460..2db27c91 100644
--- a/src/org/apache/xpath/functions/FuncSubstring.java
+++ b/src/org/apache/xpath/functions/FuncSubstring.java
@@ -23,9 +23,11 @@ package org.apache.xpath.functions;
 import org.apache.xalan.res.XSLMessages;
 import org.apache.xml.utils.XMLString;
 import org.apache.xpath.XPathContext;
+import org.apache.xpath.objects.XNumber;
 import org.apache.xpath.objects.XObject;
 import org.apache.xpath.objects.XString;
 import org.apache.xpath.res.XPATHErrorResources;
+import org.apache.xpath.xs.types.XSNumericType;
 
 /**
  * Execute the Substring() function.
@@ -47,7 +49,22 @@ public class FuncSubstring extends Function3Args
   {
 
     XMLString s1 = m_arg0.execute(xctxt).xstr();
-    double start = m_arg1.execute(xctxt).num();
+    
+    double start = 0.0;
+    
+    XObject arg1Obj = m_arg1.execute(xctxt);
+    
+    if (arg1Obj instanceof XNumber) {
+       start = arg1Obj.num(); 
+    }
+    else if (arg1Obj instanceof XSNumericType) {
+       String arg1StrVal = ((XSNumericType)arg1Obj).stringValue();
+       start = (Double.valueOf(arg1StrVal)).doubleValue();
+    }
+    else {
+       start = arg1Obj.num(); 
+    }
+    
     int lenOfS1 = s1.length();
     XMLString substr;
 
diff --git a/src/org/apache/xpath/objects/XObject.java b/src/org/apache/xpath/objects/XObject.java
index f191bd84..56218cee 100644
--- a/src/org/apache/xpath/objects/XObject.java
+++ b/src/org/apache/xpath/objects/XObject.java
@@ -43,6 +43,7 @@ import org.apache.xpath.xs.types.XSFloat;
 import org.apache.xpath.xs.types.XSInt;
 import org.apache.xpath.xs.types.XSInteger;
 import org.apache.xpath.xs.types.XSLong;
+import org.apache.xpath.xs.types.XSString;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.NodeList;
 import org.w3c.dom.traversal.NodeIterator;
@@ -622,7 +623,40 @@ public class XObject extends Expression implements Serializable, Cloneable
                                                                                              collationUri);
            
            return (comparisonResult < 0) ? true : false;
-        }
+       }
+       else if ((this instanceof XSString) && (obj2 instanceof XSString)) {
+           String lStr = (((XSString)this)).stringValue();
+           String rStr = (((XSString)obj2)).stringValue();                      
+           
+           XPathCollationSupport xpathCollationSupport = xctxt.getXPathCollationSupport();
+           
+           int comparisonResult = xpathCollationSupport.compareStringsUsingCollation(lStr, rStr, 
+                                                                                             collationUri);
+           
+           return (comparisonResult < 0) ? true : false;
+       }
+       else if ((this instanceof XSString) && (obj2 instanceof XString)) {
+           String lStr = (((XSString)this)).stringValue();
+           String rStr = (((XString)obj2)).str();                      
+           
+           XPathCollationSupport xpathCollationSupport = xctxt.getXPathCollationSupport();
+           
+           int comparisonResult = xpathCollationSupport.compareStringsUsingCollation(lStr, rStr, 
+                                                                                             collationUri);
+           
+           return (comparisonResult < 0) ? true : false;
+       }
+       else if ((this instanceof XString) && (obj2 instanceof XSString)) {
+           String lStr = (((XString)this)).str();
+           String rStr = (((XSString)obj2)).stringValue();                      
+           
+           XPathCollationSupport xpathCollationSupport = xctxt.getXPathCollationSupport();
+           
+           int comparisonResult = xpathCollationSupport.compareStringsUsingCollation(lStr, rStr, 
+                                                                                             collationUri);
+           
+           return (comparisonResult < 0) ? true : false;
+       }
        
        boolean isOperandNodeSet1 = false;
        boolean isOperandNodeSet2 = false;
@@ -643,10 +677,10 @@ public class XObject extends Expression implements Serializable, Cloneable
           }
        }
        
-       if (isOperandNodeSet1 || this instanceof XNumber) {
+       if (isOperandNodeSet1 || (this instanceof XNumber)) {
            return this.num() < obj2.num();    
        }    
-       else if (isOperandNodeSet2 || obj2 instanceof XNumber) {
+       else if (isOperandNodeSet2 || (obj2 instanceof XNumber)) {
            return obj2.num() < this.num();    
        }
        
@@ -710,6 +744,39 @@ public class XObject extends Expression implements Serializable, Cloneable
           
           return (comparisonResult > 0) ? true : false;
        }
+       else if ((this instanceof XSString) && (obj2 instanceof XSString)) {
+           String lStr = (((XSString)this)).stringValue();
+           String rStr = (((XSString)obj2)).stringValue();                      
+           
+           XPathCollationSupport xpathCollationSupport = xctxt.getXPathCollationSupport();
+           
+           int comparisonResult = xpathCollationSupport.compareStringsUsingCollation(lStr, rStr, 
+                                                                                             collationUri);
+           
+           return (comparisonResult > 0) ? true : false;
+       }
+       else if ((this instanceof XSString) && (obj2 instanceof XString)) {
+           String lStr = (((XSString)this)).stringValue();
+           String rStr = (((XString)obj2)).str();                      
+           
+           XPathCollationSupport xpathCollationSupport = xctxt.getXPathCollationSupport();
+           
+           int comparisonResult = xpathCollationSupport.compareStringsUsingCollation(lStr, rStr, 
+                                                                                             collationUri);
+           
+           return (comparisonResult > 0) ? true : false;
+       }
+       else if ((this instanceof XString) && (obj2 instanceof XSString)) {
+           String lStr = (((XString)this)).str();
+           String rStr = (((XSString)obj2)).stringValue();                      
+           
+           XPathCollationSupport xpathCollationSupport = xctxt.getXPathCollationSupport();
+           
+           int comparisonResult = xpathCollationSupport.compareStringsUsingCollation(lStr, rStr, 
+                                                                                             collationUri);
+           
+           return (comparisonResult > 0) ? true : false;
+       }
        
        boolean isOperandNodeSet1 = false;
        boolean isOperandNodeSet2 = false;
@@ -730,10 +797,10 @@ public class XObject extends Expression implements Serializable, Cloneable
           }
        }
        
-       if (isOperandNodeSet1 || this instanceof XNumber) {
+       if (isOperandNodeSet1 || (this instanceof XNumber)) {
           return this.num() > obj2.num();    
        }    
-       else if (isOperandNodeSet2 || obj2 instanceof XNumber) {
+       else if (isOperandNodeSet2 || (obj2 instanceof XNumber)) {
           return obj2.num() > this.num();    
        }
        
@@ -911,6 +978,27 @@ public class XObject extends Expression implements Serializable, Cloneable
     else if ((this instanceof XSDate) && (obj2 instanceof XSDate)) {
         return ((XSDate)this).equals((XSDate)obj2);    
     }
+    else if ((this instanceof XSString) && (obj2 instanceof XSString)) {
+        return ((XSString)this).equals((XSString)obj2);    
+    }
+    else if ((this instanceof XString) && (obj2 instanceof XString)) {
+        String lStr = (((XString)this)).str();
+        String rStr = (((XString)obj2)).str();
+        
+        return (new XSString(lStr)).equals(new XSString(rStr));
+    }
+    else if ((this instanceof XSString) && (obj2 instanceof XString)) {
+        String lStr = ((((XSString)this))).stringValue();
+        String rStr = (((XString)obj2)).str();
+        
+        return (new XSString(lStr)).equals(new XSString(rStr));
+    }
+    else if ((this instanceof XString) && (obj2 instanceof XSString)) {
+        String lStr = (((XString)this)).str();
+        String rStr = ((((XSString)obj2))).stringValue();
+        
+        return (new XSString(lStr)).equals(new XSString(rStr));
+    }
     
     boolean isOperandNodeSet1 = false;
     boolean isOperandNodeSet2 = false;
@@ -931,10 +1019,10 @@ public class XObject extends Expression implements Serializable, Cloneable
        }
     }
     
-    if (isOperandNodeSet1 || this instanceof XNumber) {
+    if (isOperandNodeSet1 || (this instanceof XNumber)) {
         return this.equals(obj2);    
     }    
-    else if (isOperandNodeSet2 || obj2 instanceof XNumber) {
+    else if (isOperandNodeSet2 || (obj2 instanceof XNumber)) {
         return obj2.equals(this);    
     }
 
diff --git a/src/org/apache/xpath/xs/types/XSString.java b/src/org/apache/xpath/xs/types/XSString.java
index c933460b..77b29ce5 100644
--- a/src/org/apache/xpath/xs/types/XSString.java
+++ b/src/org/apache/xpath/xs/types/XSString.java
@@ -16,6 +16,10 @@
  */
 package org.apache.xpath.xs.types;
 
+import javax.xml.transform.TransformerException;
+
+import org.apache.xpath.XPathCollationSupport;
+import org.apache.xpath.XPathContext;
 import org.apache.xpath.objects.ResultSequence;
 
 /**
@@ -33,11 +37,15 @@ public class XSString extends XSCtrType {
     
     private String _value;
     
+    private XPathContext fXctxt = new XPathContext();
+    
+    private XPathCollationSupport fXpathCollationSupport = fXctxt.getXPathCollationSupport();
+    
     /*
      * Class constructor.
     */
     public XSString(String str) {
-       _value = str;
+       _value = str;       
     }
 
     /*
@@ -86,19 +94,34 @@ public class XSString extends XSCtrType {
         return stringValue();
     }
     
-    public boolean equals(XSString xsStr) {
-        // TO DO
-        return false; 
+    /**
+     * This function implements the semantics of XPath 3.1 'eq' operator,
+     * on xs:string values.
+     */
+    public boolean equals(XSString xsStr) throws TransformerException {
+        int comparisonResult = fXpathCollationSupport.compareStringsUsingCollation(_value, xsStr.stringValue(), 
+                                                                                                       fXctxt.getDefaultCollation());
+        return (comparisonResult == 0); 
     }
     
-    public boolean lt(XSString xsStr) {
-        // TO DO
-        return false;  
+    /**
+     * This function implements the semantics of XPath 3.1 'lt' operator,
+     * on xs:string values.
+     */
+    public boolean lt(XSString xsStr) throws TransformerException {
+        int comparisonResult = fXpathCollationSupport.compareStringsUsingCollation(_value, xsStr.stringValue(), 
+                                                                                                       fXctxt.getDefaultCollation());
+        return (comparisonResult < 0);  
     }
     
-    public boolean gt(XSString xsStr) {
-        // TO DO
-        return false;  
+    /**
+     * This function implements the semantics of XPath 3.1 'gt' operator,
+     * on xs:string values.
+     */
+    public boolean gt(XSString xsStr) throws TransformerException {
+        int comparisonResult = fXpathCollationSupport.compareStringsUsingCollation(_value, xsStr.stringValue(), 
+                                                                                                       fXctxt.getDefaultCollation());
+        return (comparisonResult > 0);  
     }
 
 }
diff --git a/tests/fn_codepoint_equal/gold/test1.out b/tests/fn_codepoint_equal/gold/test1.out
new file mode 100644
index 00000000..46b19f52
--- /dev/null
+++ b/tests/fn_codepoint_equal/gold/test1.out
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>true</one>
+  <two>false</two>
+  <three>true</three>
+  <four/>
+  <five/>
+</result>
diff --git a/tests/fn_codepoint_equal/gold/test2.out b/tests/fn_codepoint_equal/gold/test2.out
new file mode 100644
index 00000000..5163ca52
--- /dev/null
+++ b/tests/fn_codepoint_equal/gold/test2.out
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>true</one>
+  <two>false</two>
+  <three>true</three>
+  <four>false</four>
+</result>
diff --git a/tests/fn_codepoint_equal/test1.xsl b/tests/fn_codepoint_equal/test1.xsl
new file mode 100644
index 00000000..aff4e326
--- /dev/null
+++ b/tests/fn_codepoint_equal/test1.xsl
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="3.0">
+                
+   <!-- Author: mukulg@apache.org -->
+   
+   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
+        function. -->                             
+
+   <xsl:output method="xml" indent="yes"/>
+   
+   <xsl:template match="/">
+      <result>
+         <one><xsl:value-of select="codepoint-equal('abcd', 'abcd')"/></one>
+         <two><xsl:value-of select="codepoint-equal('abcd', 'abcd ')"/></two>
+         <three><xsl:value-of select="codepoint-equal('', '')"/></three>
+         <four><xsl:value-of select="codepoint-equal('', ())"/></four>
+         <five><xsl:value-of select="codepoint-equal((), ())"/></five>
+      </result>
+   </xsl:template>
+   
+   <!--
+      * Licensed to the Apache Software Foundation (ASF) under one
+      * or more contributor license agreements. See the NOTICE file
+      * distributed with this work for additional information
+      * regarding copyright ownership. The ASF licenses this file
+      * to you under the Apache License, Version 2.0 (the  "License");
+      * you may not use this file except in compliance with the License.
+      * You may obtain a copy of the License at
+      *
+      *     http://www.apache.org/licenses/LICENSE-2.0
+      *
+      * Unless required by applicable law or agreed to in writing, software
+      * distributed under the License is distributed on an "AS IS" BASIS,
+      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      * See the License for the specific language governing permissions and
+      * limitations under the License.
+   -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/fn_codepoint_equal/test1_a.xml b/tests/fn_codepoint_equal/test1_a.xml
new file mode 100644
index 00000000..f01e2f00
--- /dev/null
+++ b/tests/fn_codepoint_equal/test1_a.xml
@@ -0,0 +1,6 @@
+<info>
+  <str1>abcd</str1>
+  <str2>abcd</str2>
+  <str3>abcd </str3>
+  <data str1="abcd" str2="abcd" str3="abcd "/>
+</info>
\ No newline at end of file
diff --git a/tests/fn_codepoint_equal/test2.xsl b/tests/fn_codepoint_equal/test2.xsl
new file mode 100644
index 00000000..869ff3b9
--- /dev/null
+++ b/tests/fn_codepoint_equal/test2.xsl
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="3.0">
+                
+   <!-- Author: mukulg@apache.org -->
+   
+   <!-- use with test1_a.xml -->
+   
+   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
+        function.
+        
+        This stylesheet reads input data to be transformed, from an 
+        XML external document.
+   -->                            
+
+   <xsl:output method="xml" indent="yes"/>
+   
+   <xsl:template match="/info">
+      <result>
+         <one><xsl:value-of select="codepoint-equal(str1, str2)"/></one>
+         <two><xsl:value-of select="codepoint-equal(str1, str3)"/></two>
+         
+         <three><xsl:value-of select="codepoint-equal(data/@str1, data/@str2)"/></three>
+         <four><xsl:value-of select="codepoint-equal(data/@str1, data/@str3)"/></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>
\ No newline at end of file
diff --git a/tests/fn_sort/gold/test11.out b/tests/fn_sort/gold/test11.out
new file mode 100644
index 00000000..a8014ea7
--- /dev/null
+++ b/tests/fn_sort/gold/test11.out
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?><parts>
+  <part id="2">
+    <name>PQR</name>
+    <manufactureDate>2001-09-06</manufactureDate>
+  </part>
+  <part id="4">
+    <name>LMN</name>
+    <manufactureDate>2003-10-01</manufactureDate>
+  </part>
+  <part id="5">
+    <name>XYZ</name>
+    <manufactureDate>2007-09-05</manufactureDate>
+  </part>
+  <part id="1">
+    <name>ABC</name>
+    <manufactureDate>2022-10-12</manufactureDate>
+  </part>
+  <part id="3">
+    <name>MNO</name>
+    <manufactureDate>2023-01-15</manufactureDate>
+  </part>
+</parts>
diff --git a/tests/fn_sort/gold/test12.out b/tests/fn_sort/gold/test12.out
new file mode 100644
index 00000000..8580a6bc
--- /dev/null
+++ b/tests/fn_sort/gold/test12.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <sorted1 sortOrder="ascending">Dave Gary Michael Mukul Noah</sorted1>
+  <sorted2 sortOrder="descending">Noah Mukul Michael Gary Dave</sorted2>
+</result>
diff --git a/tests/fn_sort/gold/test13.out b/tests/fn_sort/gold/test13.out
new file mode 100644
index 00000000..6155d9ea
--- /dev/null
+++ b/tests/fn_sort/gold/test13.out
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <sorted1 sortOrder="ascending">
+    <person>
+    <fName>Gary</fName>
+    <lName>Gregory</lName>
+  </person>
+    <person>
+    <fName>Gary</fName>
+    <lName>Kasparov</lName>
+  </person>
+    <person>
+    <fName>Joseph</fName>
+    <lName>Kesselman</lName>
+  </person>
+    <person>
+    <fName>Michael</fName>
+    <lName>Glavassevich</lName>
+  </person>
+    <person>
+    <fName>Mukul</fName>
+    <lName>Gandhi</lName>
+  </person>
+    <person>
+    <fName>Neil</fName>
+    <lName>Graham</lName>
+  </person>
+  </sorted1>
+  <sorted2 sortOrder="descending">
+    <person>
+    <fName>Neil</fName>
+    <lName>Graham</lName>
+  </person>
+    <person>
+    <fName>Mukul</fName>
+    <lName>Gandhi</lName>
+  </person>
+    <person>
+    <fName>Michael</fName>
+    <lName>Glavassevich</lName>
+  </person>
+    <person>
+    <fName>Joseph</fName>
+    <lName>Kesselman</lName>
+  </person>
+    <person>
+    <fName>Gary</fName>
+    <lName>Kasparov</lName>
+  </person>
+    <person>
+    <fName>Gary</fName>
+    <lName>Gregory</lName>
+  </person>
+  </sorted2>
+</result>
diff --git a/tests/fn_sort/test14.xsl b/tests/fn_sort/test14.xsl
new file mode 100644
index 00000000..95e8e5d3
--- /dev/null
+++ b/tests/fn_sort/test14.xsl
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<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 -->
+   
+   <!-- use with test1_f.xml -->
+   
+   <!-- An XSLT stylesheet test case, to test XPath 3.1 fn:sort function,
+        by reading input data from an XML external source document.
+        
+        This stylesheet example, use an xs:date aware sort key.
+   -->
+   
+   <xsl:output method="xml" indent="yes"/>
+   
+   <xsl:template match="/parts">
+      <parts>
+         <xsl:copy-of select="sort(part, (), function($part) { xs:date($part/manufactureDate) })"/>
+      </parts>
+   </xsl:template>
+   
+   <!--
+      * Licensed to the Apache Software Foundation (ASF) under one
+      * or more contributor license agreements. See the NOTICE file
+      * distributed with this work for additional information
+      * regarding copyright ownership. The ASF licenses this file
+      * to you under the Apache License, Version 2.0 (the  "License");
+      * you may not use this file except in compliance with the License.
+      * You may obtain a copy of the License at
+      *
+      *     http://www.apache.org/licenses/LICENSE-2.0
+      *
+      * Unless required by applicable law or agreed to in writing, software
+      * distributed under the License is distributed on an "AS IS" BASIS,
+      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      * See the License for the specific language governing permissions and
+      * limitations under the License.
+   -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/fn_sort/test15.xsl b/tests/fn_sort/test15.xsl
new file mode 100644
index 00000000..dd513c48
--- /dev/null
+++ b/tests/fn_sort/test15.xsl
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="3.0">             
+
+   <!-- Author: mukulg@apache.org -->
+   
+   <!-- An XSLT stylesheet to test, XPath 3.1 fn:sort function to sort sequence
+        of text strings, both in ascending and descending orders.
+        
+        For this stylesheet example, the text data to be sorted, is from an 
+        ASCII English alphabet (with characters codepoint values in range 
+        U+003A to U+007A).
+        
+        Ref : https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block).        
+   -->
+   
+   <xsl:output method="xml" indent="yes"/>
+   
+   <!-- a variable, having a sequence of text strings, that we wish to sort -->
+   <xsl:variable name="seq1" select="('Noah','Michael','Gary','Mukul','Dave')"/>
+   
+   <!-- We use this variable declaration, to help create a sort key for function fn:sort,
+        to sort the data in descending order. This is an unicode codepoint integer
+        value, of the last character of the language alphabet we've chosen (the
+        codepoint hex value of this character is U+007A). -->
+   <xsl:variable name="alphabetLastCodepointValue" select="122"/>
+   
+   <xsl:variable name="fnGetcodepointsForReverseSortKey" select="function($str) { for $idx in (1 to string-length($str)) 
+                                                                                        return ($alphabetLastCodepointValue - string-to-codepoints(substring($str, $idx, 1))) }"/>
+   
+   <xsl:template match="/">
+      <result>
+         <sorted1 sortOrder="ascending"><xsl:copy-of select="sort($seq1, (), function($str) { string($str) })"/></sorted1>
+         
+         <sorted2 sortOrder="descending"><xsl:copy-of select="sort($seq1, (), function($str) { 
+                                                                                 codepoints-to-string($fnGetcodepointsForReverseSortKey(string($str))) 
+                                                                              })"/></sorted2>
+      </result>
+   </xsl:template>
+   
+   <!--
+      * Licensed to the Apache Software Foundation (ASF) under one
+      * or more contributor license agreements. See the NOTICE file
+      * distributed with this work for additional information
+      * regarding copyright ownership. The ASF licenses this file
+      * to you under the Apache License, Version 2.0 (the  "License");
+      * you may not use this file except in compliance with the License.
+      * You may obtain a copy of the License at
+      *
+      *     http://www.apache.org/licenses/LICENSE-2.0
+      *
+      * Unless required by applicable law or agreed to in writing, software
+      * distributed under the License is distributed on an "AS IS" BASIS,
+      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      * See the License for the specific language governing permissions and
+      * limitations under the License.
+   -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/fn_sort/test16.xsl b/tests/fn_sort/test16.xsl
new file mode 100644
index 00000000..49f943f2
--- /dev/null
+++ b/tests/fn_sort/test16.xsl
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="3.0">
+                
+   <!-- Author: mukulg@apache.org -->
+   
+   <!-- use with test1_g.xml -->
+   
+   <!-- An XSLT stylesheet to test, XPath 3.1 fn:sort function to sort sequence
+        of XML elements (read from an, XML external document), both in ascending
+        and descending orders. Each XML input node item, represents an XML person
+        element (with sub-element fName as primary sort key, and sub-element lName
+        as secondary sort key).
+        
+        For this stylesheet example, the text data to be sorted, is from an 
+        ASCII English alphabet (with characters codepoint values in range 
+        U+003A to U+007A).
+        
+        Ref : https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block).
+   -->                            
+
+   <xsl:output method="xml" indent="yes"/>
+   
+   <!-- We use this variable declaration, to help create a sort key for function fn:sort,
+        to sort the data in descending order. This is an unicode codepoint integer
+        value, of the last character of the language alphabet we've chosen (the
+        codepoint hex value of this character is U+007A). -->
+   <xsl:variable name="alphabetLastCodepointValue" select="122"/>
+   
+   <xsl:variable name="fnGetcodepointsForReverseSortKey" select="function($str) { for $idx in (1 to string-length($str)) 
+                                                                                        return ($alphabetLastCodepointValue - string-to-codepoints(substring($str, $idx, 1))) }"/>
+   
+   <xsl:template match="/document">
+     <result>
+        <sorted1 sortOrder="ascending"><xsl:copy-of select="sort(person, (), function($person) { string($person/fName) || 
+                                                                                                        ':' || string($person/lName)  })"/></sorted1>
+       
+        <sorted2 sortOrder="descending"><xsl:copy-of select="sort(person, (), function($person) { 
+                                                                                 codepoints-to-string($fnGetcodepointsForReverseSortKey(string($person/fName) || 
+                                                                                                                 ':' || string($person/lName))) })"/></sorted2>
+     </result>
+   </xsl:template>
+   
+   <!--
+      * Licensed to the Apache Software Foundation (ASF) under one
+      * or more contributor license agreements. See the NOTICE file
+      * distributed with this work for additional information
+      * regarding copyright ownership. The ASF licenses this file
+      * to you under the Apache License, Version 2.0 (the  "License");
+      * you may not use this file except in compliance with the License.
+      * You may obtain a copy of the License at
+      *
+      *     http://www.apache.org/licenses/LICENSE-2.0
+      *
+      * Unless required by applicable law or agreed to in writing, software
+      * distributed under the License is distributed on an "AS IS" BASIS,
+      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      * See the License for the specific language governing permissions and
+      * limitations under the License.
+   -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/fn_sort/test1_f.xml b/tests/fn_sort/test1_f.xml
new file mode 100644
index 00000000..00d33965
--- /dev/null
+++ b/tests/fn_sort/test1_f.xml
@@ -0,0 +1,22 @@
+<parts>
+  <part id="1">
+    <name>ABC</name>
+    <manufactureDate>2022-10-12</manufactureDate>
+  </part>
+  <part id="2">
+    <name>PQR</name>
+    <manufactureDate>2001-09-06</manufactureDate>
+  </part>
+  <part id="3">
+    <name>MNO</name>
+    <manufactureDate>2023-01-15</manufactureDate>
+  </part>
+  <part id="4">
+    <name>LMN</name>
+    <manufactureDate>2003-10-01</manufactureDate>
+  </part>
+  <part id="5">
+    <name>XYZ</name>
+    <manufactureDate>2007-09-05</manufactureDate>
+  </part>
+</parts>
\ No newline at end of file
diff --git a/tests/fn_sort/test1_g.xml b/tests/fn_sort/test1_g.xml
new file mode 100644
index 00000000..2ce6ebc5
--- /dev/null
+++ b/tests/fn_sort/test1_g.xml
@@ -0,0 +1,26 @@
+<document>
+  <person>
+    <fName>Gary</fName>
+    <lName>Gregory</lName>
+  </person>
+  <person>
+    <fName>Michael</fName>
+    <lName>Glavassevich</lName>
+  </person>
+  <person>
+    <fName>Gary</fName>
+    <lName>Kasparov</lName>
+  </person>
+  <person>
+    <fName>Joseph</fName>
+    <lName>Kesselman</lName>
+  </person>
+  <person>
+    <fName>Mukul</fName>
+    <lName>Gandhi</lName>
+  </person>
+  <person>
+    <fName>Neil</fName>
+    <lName>Graham</lName>
+  </person>
+</document>
\ No newline at end of file
diff --git a/tests/org/apache/xalan/xpath3/FnCodepointEqualTests.java b/tests/org/apache/xalan/xpath3/FnCodepointEqualTests.java
new file mode 100644
index 00000000..27fb3835
--- /dev/null
+++ b/tests/org/apache/xalan/xpath3/FnCodepointEqualTests.java
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+package org.apache.xalan.xpath3;
+
+import org.apache.xalan.util.XslTransformTestsUtil;
+import org.apache.xalan.xslt3.XSLConstants;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * XPath 3.1 function fn:codepoint-equal test cases.
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class FnCodepointEqualTests extends XslTransformTestsUtil {        
+    
+    private static final String XSL_TRANSFORM_INPUT_DIRPATH = XSLConstants.XSL_TRANSFORM_INPUT_DIRPATH_PREFIX + 
+                                                                                                           "fn_codepoint_equal/";
+    
+    private static final String XSL_TRANSFORM_GOLD_DIRPATH = XSLConstants.XSL_TRANSFORM_GOLD_DIRPATH_PREFIX + 
+                                                                                                           "fn_codepoint_equal/gold/";
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+        // no op
+    }
+
+    @AfterClass
+    public static void tearDownAfterClass() throws Exception {        
+        xmlDocumentBuilderFactory = null;
+        xmlDocumentBuilder = null;
+        xslTransformerFactory = null;
+    }
+
+    @Test
+    public void xslFnCodepointEqualTest1() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test1.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslFnCodepointEqualTest2() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_a.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test2.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test2.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+
+}
diff --git a/tests/org/apache/xalan/xpath3/FnSortTests.java b/tests/org/apache/xalan/xpath3/FnSortTests.java
index e0ad09a6..10aed336 100644
--- a/tests/org/apache/xalan/xpath3/FnSortTests.java
+++ b/tests/org/apache/xalan/xpath3/FnSortTests.java
@@ -178,5 +178,35 @@ public class FnSortTests extends XslTransformTestsUtil {
         
         runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
     }
+    
+    @Test
+    public void xslFnSortTest14() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_f.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test14.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test11.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslFnSortTest15() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test15.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test15.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test12.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslFnSortTest16() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_g.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test16.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test13.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
 
 }
diff --git a/tests/org/apache/xalan/xpath3/XsConstructorFunctionTests.java b/tests/org/apache/xalan/xpath3/XsConstructorFunctionTests.java
index 90ad7258..6da5c203 100644
--- a/tests/org/apache/xalan/xpath3/XsConstructorFunctionTests.java
+++ b/tests/org/apache/xalan/xpath3/XsConstructorFunctionTests.java
@@ -167,5 +167,55 @@ public class XsConstructorFunctionTests extends XslTransformTestsUtil {
         
         runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
     }
+    
+    @Test
+    public void XsConstructorFunctionsTest13() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_c.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test13.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test11.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void XsConstructorFunctionsTest14() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_c.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test14.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test11.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void XsConstructorFunctionsTest15() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test15.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test15.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test12.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void XsConstructorFunctionsTest16() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test16.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test16.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test12.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void XsConstructorFunctionsTest17() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test17.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test17.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test12.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
 
 }
diff --git a/tests/org/apache/xalan/xslt3/AllXsl3Tests.java b/tests/org/apache/xalan/xslt3/AllXsl3Tests.java
index 75169a3e..6cdea357 100644
--- a/tests/org/apache/xalan/xslt3/AllXsl3Tests.java
+++ b/tests/org/apache/xalan/xslt3/AllXsl3Tests.java
@@ -20,6 +20,7 @@ import org.apache.xalan.xpath3.BuiltinFunctionsNamespceTests;
 import org.apache.xalan.xpath3.XsDurationComponentExtractionFunctionTests;
 import org.apache.xalan.xpath3.DynamicFunctionCallTests;
 import org.apache.xalan.xpath3.FnAbsTests;
+import org.apache.xalan.xpath3.FnCodepointEqualTests;
 import org.apache.xalan.xpath3.FnCodepointsToStringTests;
 import org.apache.xalan.xpath3.FnCompareTests;
 import org.apache.xalan.xpath3.FnDistinctValuesTests;
@@ -81,7 +82,7 @@ import org.junit.runners.Suite.SuiteClasses;
                 XsDurationComponentExtractionFunctionTests.class, XPathArithmeticOnDurationValuesTests.class,
                 NodeComparisonTests.class, SimpleMapOperatorTests.class, FnFoldLeftTests.class,
                 FnFoldRightTests.class, FnForEachPairTests.class, FnSortTests.class, FnCodepointsToStringTests.class,
-                FnStringToCodepointsTests.class, FnCompareTests.class })
+                FnStringToCodepointsTests.class, FnCompareTests.class, FnCodepointEqualTests.class })
 public class AllXsl3Tests {
 
 }
diff --git a/tests/xs_constructor_functions/gold/test11.out b/tests/xs_constructor_functions/gold/test11.out
new file mode 100644
index 00000000..9f78f472
--- /dev/null
+++ b/tests/xs_constructor_functions/gold/test11.out
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?><parts>
+  <part id="1">
+    <name>ABC</name>
+    <manufactureDate>2022-10-12</manufactureDate>
+  </part>
+  <part id="3">
+    <name>MNO</name>
+    <manufactureDate>2023-01-15</manufactureDate>
+  </part>
+</parts>
diff --git a/tests/xs_constructor_functions/gold/test12.out b/tests/xs_constructor_functions/gold/test12.out
new file mode 100644
index 00000000..bca30600
--- /dev/null
+++ b/tests/xs_constructor_functions/gold/test12.out
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>true</one>
+  <two>true</two>
+  <three>true</three>
+  <four>false</four>
+  <five>false</five>
+  <six>false</six>
+</result>
diff --git a/tests/xs_constructor_functions/test13.xsl b/tests/xs_constructor_functions/test13.xsl
new file mode 100644
index 00000000..a1fe4d09
--- /dev/null
+++ b/tests/xs_constructor_functions/test13.xsl
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<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 -->
+   
+   <!-- use with test1_c.xml -->
+   
+   <!-- An XSLT stylesheet test case, to test XPath 3.1 xs:date(..)
+        constructor function together with value comparison operators 
+        'ge' and 'le'.
+        
+        This stylesheet, reads input data to be transformed, from an XML 
+        external source document.
+   -->                             
+
+   <xsl:output method="xml" indent="yes"/>
+   
+   <xsl:variable name="dateFrom" select="xs:date('2022-01-01')"/>
+   
+   <xsl:variable name="dateTo" select="xs:date('2023-12-31')"/>
+   
+   <xsl:template match="/parts">
+     <parts>
+        <xsl:copy-of select="part[(xs:date(manufactureDate) ge $dateFrom) and (xs:date(manufactureDate) le $dateTo)]"/>
+     </parts>
+   </xsl:template>
+   
+   <!--
+      * Licensed to the Apache Software Foundation (ASF) under one
+      * or more contributor license agreements. See the NOTICE file
+      * distributed with this work for additional information
+      * regarding copyright ownership. The ASF licenses this file
+      * to you under the Apache License, Version 2.0 (the  "License");
+      * you may not use this file except in compliance with the License.
+      * You may obtain a copy of the License at
+      *
+      *     http://www.apache.org/licenses/LICENSE-2.0
+      *
+      * Unless required by applicable law or agreed to in writing, software
+      * distributed under the License is distributed on an "AS IS" BASIS,
+      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      * See the License for the specific language governing permissions and
+      * limitations under the License.
+   -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xs_constructor_functions/test14.xsl b/tests/xs_constructor_functions/test14.xsl
new file mode 100644
index 00000000..f69a5dc4
--- /dev/null
+++ b/tests/xs_constructor_functions/test14.xsl
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<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 -->
+   
+   <!-- use with test1_c.xml -->
+   
+   <!-- An XSLT stylesheet test case, to test XPath 3.1 xs:date(..)
+        constructor function, together with value comparison operators 
+        'ge' and 'le', and a dynamic function call to a function item.
+        
+        This stylesheet, reads input data to be transformed, from an XML 
+        external source document.
+   -->                              
+
+   <xsl:output method="xml" indent="yes"/>
+   
+   <xsl:variable name="dateFrom" select="xs:date('2022-01-01')"/>
+   
+   <xsl:variable name="dateTo" select="xs:date('2023-12-31')"/>
+   
+   <xsl:variable name="isValueInRange" select="function($val, $from, $to) { ($val ge $from) and ($val le $to) }"/>
+   
+   <xsl:template match="/parts">
+     <parts>
+        <xsl:copy-of select="part[$isValueInRange(xs:date(manufactureDate), $dateFrom, $dateTo)]"/>
+     </parts>
+   </xsl:template>
+   
+   <!--
+      * Licensed to the Apache Software Foundation (ASF) under one
+      * or more contributor license agreements. See the NOTICE file
+      * distributed with this work for additional information
+      * regarding copyright ownership. The ASF licenses this file
+      * to you under the Apache License, Version 2.0 (the  "License");
+      * you may not use this file except in compliance with the License.
+      * You may obtain a copy of the License at
+      *
+      *     http://www.apache.org/licenses/LICENSE-2.0
+      *
+      * Unless required by applicable law or agreed to in writing, software
+      * distributed under the License is distributed on an "AS IS" BASIS,
+      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      * See the License for the specific language governing permissions and
+      * limitations under the License.
+   -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xs_constructor_functions/test15.xsl b/tests/xs_constructor_functions/test15.xsl
new file mode 100644
index 00000000..13707e1c
--- /dev/null
+++ b/tests/xs_constructor_functions/test15.xsl
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<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 XSLT stylesheet test case, to test xs:string(..)
+        constructor function, and an XPath 'eq' operator when 
+        comparing string values. -->                             
+
+   <xsl:output method="xml" indent="yes"/>
+   
+   <xsl:template match="/">
+     <result>
+        <one><xsl:copy-of select="xs:string('abc') eq xs:string('abc')"/></one>
+        <two><xsl:copy-of select="xs:string('abc') eq 'abc'"/></two>
+        <three><xsl:copy-of select="xs:string('abc') eq string('abc')"/></three>
+       
+        <four><xsl:copy-of select="xs:string('abc') eq xs:string('abc1')"/></four>
+        <five><xsl:copy-of select="xs:string('abc') eq 'abc1'"/></five>
+        <six><xsl:copy-of select="xs:string('abc') eq string('abc1')"/></six>
+     </result>
+   </xsl:template>
+   
+   <!--
+      * Licensed to the Apache Software Foundation (ASF) under one
+      * or more contributor license agreements. See the NOTICE file
+      * distributed with this work for additional information
+      * regarding copyright ownership. The ASF licenses this file
+      * to you under the Apache License, Version 2.0 (the  "License");
+      * you may not use this file except in compliance with the License.
+      * You may obtain a copy of the License at
+      *
+      *     http://www.apache.org/licenses/LICENSE-2.0
+      *
+      * Unless required by applicable law or agreed to in writing, software
+      * distributed under the License is distributed on an "AS IS" BASIS,
+      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      * See the License for the specific language governing permissions and
+      * limitations under the License.
+   -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xs_constructor_functions/test16.xsl b/tests/xs_constructor_functions/test16.xsl
new file mode 100644
index 00000000..c4734b0b
--- /dev/null
+++ b/tests/xs_constructor_functions/test16.xsl
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<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 XSLT stylesheet test case, to test xs:string(..)
+        constructor function, and an XPath 'gt' operator when 
+        comparing string values. -->                              
+
+   <xsl:output method="xml" indent="yes"/>
+   
+   <xsl:template match="/">
+     <result>
+        <one><xsl:copy-of select="xs:string('abc') gt xs:string('aaa')"/></one>
+        <two><xsl:copy-of select="xs:string('abc') gt 'aaa'"/></two>
+        <three><xsl:copy-of select="xs:string('abc') gt string('aaa')"/></three>
+       
+        <four><xsl:copy-of select="xs:string('abc') gt xs:string('bbc')"/></four>
+        <five><xsl:copy-of select="xs:string('abc') gt 'bbc'"/></five>
+        <six><xsl:copy-of select="xs:string('abc') gt string('bbc')"/></six>
+     </result>
+   </xsl:template>
+   
+   <!--
+      * Licensed to the Apache Software Foundation (ASF) under one
+      * or more contributor license agreements. See the NOTICE file
+      * distributed with this work for additional information
+      * regarding copyright ownership. The ASF licenses this file
+      * to you under the Apache License, Version 2.0 (the  "License");
+      * you may not use this file except in compliance with the License.
+      * You may obtain a copy of the License at
+      *
+      *     http://www.apache.org/licenses/LICENSE-2.0
+      *
+      * Unless required by applicable law or agreed to in writing, software
+      * distributed under the License is distributed on an "AS IS" BASIS,
+      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      * See the License for the specific language governing permissions and
+      * limitations under the License.
+   -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xs_constructor_functions/test17.xsl b/tests/xs_constructor_functions/test17.xsl
new file mode 100644
index 00000000..de6ea7d3
--- /dev/null
+++ b/tests/xs_constructor_functions/test17.xsl
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<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 XSLT stylesheet test case, to test xs:string(..)
+        constructor function, and an XPath 'lt' operator when 
+        comparing string values. -->                              
+
+   <xsl:output method="xml" indent="yes"/>
+   
+   <xsl:template match="/">
+     <result>
+        <one><xsl:copy-of select="xs:string('aaa') lt xs:string('abc')"/></one>
+        <two><xsl:copy-of select="xs:string('aaa') lt 'abc'"/></two>
+        <three><xsl:copy-of select="xs:string('aaa') lt string('abc')"/></three>
+       
+        <four><xsl:copy-of select="xs:string('abc') lt xs:string('a')"/></four>
+        <five><xsl:copy-of select="xs:string('abc') lt 'a'"/></five>
+        <six><xsl:copy-of select="xs:string('abc') lt string('a')"/></six>
+     </result>
+   </xsl:template>
+   
+   <!--
+      * Licensed to the Apache Software Foundation (ASF) under one
+      * or more contributor license agreements. See the NOTICE file
+      * distributed with this work for additional information
+      * regarding copyright ownership. The ASF licenses this file
+      * to you under the Apache License, Version 2.0 (the  "License");
+      * you may not use this file except in compliance with the License.
+      * You may obtain a copy of the License at
+      *
+      *     http://www.apache.org/licenses/LICENSE-2.0
+      *
+      * Unless required by applicable law or agreed to in writing, software
+      * distributed under the License is distributed on an "AS IS" BASIS,
+      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      * See the License for the specific language governing permissions and
+      * limitations under the License.
+   -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xs_constructor_functions/test1_c.xml b/tests/xs_constructor_functions/test1_c.xml
new file mode 100644
index 00000000..00d33965
--- /dev/null
+++ b/tests/xs_constructor_functions/test1_c.xml
@@ -0,0 +1,22 @@
+<parts>
+  <part id="1">
+    <name>ABC</name>
+    <manufactureDate>2022-10-12</manufactureDate>
+  </part>
+  <part id="2">
+    <name>PQR</name>
+    <manufactureDate>2001-09-06</manufactureDate>
+  </part>
+  <part id="3">
+    <name>MNO</name>
+    <manufactureDate>2023-01-15</manufactureDate>
+  </part>
+  <part id="4">
+    <name>LMN</name>
+    <manufactureDate>2003-10-01</manufactureDate>
+  </part>
+  <part id="5">
+    <name>XYZ</name>
+    <manufactureDate>2007-09-05</manufactureDate>
+  </part>
+</parts>
\ No newline at end of file


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