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/23 15:45:30 UTC

[xalan-java] branch xalan-j_xslt3.0 updated: committing implementations of the following xpath 3.1 functions : fn:empty, fn:exists, fn:head, fn:tail, fn:insert-before, fn:remove, fn:reverse, fn:subsequence, along with few new working related test cases as well

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 6dbdac53 committing implementations of the following xpath 3.1 functions : fn:empty, fn:exists, fn:head, fn:tail, fn:insert-before, fn:remove, fn:reverse, fn:subsequence, along with few new working related test cases as well
     new dcd1ced4 Merge pull request #58 from mukulga/xalan-j_xslt3.0_mukul
6dbdac53 is described below

commit 6dbdac536b39f33b93e1ab0ac29e8d8a0d03161f
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Wed Aug 23 20:58:42 2023 +0530

    committing implementations of the following xpath 3.1 functions : fn:empty, fn:exists, fn:head, fn:tail, fn:insert-before, fn:remove, fn:reverse, fn:subsequence, along with few new working related test cases as well
---
 .../xslt/util/XslTransformEvaluationHelper.java    |  40 +++-
 src/org/apache/xpath/compiler/FunctionTable.java   |  60 +++++-
 src/org/apache/xpath/compiler/Keywords.java        |  25 +++
 src/org/apache/xpath/functions/FuncEmpty.java      |  76 ++++++++
 src/org/apache/xpath/functions/FuncExists.java     |  76 ++++++++
 src/org/apache/xpath/functions/FuncHead.java       |  72 +++++++
 .../apache/xpath/functions/FuncInsertBefore.java   | 130 +++++++++++++
 src/org/apache/xpath/functions/FuncRemove.java     | 128 ++++++++++++
 src/org/apache/xpath/functions/FuncReverse.java    |  64 ++++++
 .../apache/xpath/functions/FuncSubsequence.java    | 178 +++++++++++++++++
 src/org/apache/xpath/functions/FuncTail.java       |  73 +++++++
 tests/fn_codepoint_equal/test1.xsl                 |   7 +-
 tests/fn_codepoint_equal/test2.xsl                 |   2 +-
 .../apache/xalan/xpath3/SequenceFunctionTests.java | 214 +++++++++++++++++++++
 tests/org/apache/xalan/xslt3/AllXsl3Tests.java     |   4 +-
 tests/sequence_functions/gold/test1.out            |   4 +
 tests/sequence_functions/gold/test10.out           |  32 +++
 tests/sequence_functions/gold/test11.out           |   6 +
 tests/sequence_functions/gold/test12.out           |  16 ++
 tests/sequence_functions/gold/test13.out           |   4 +
 tests/sequence_functions/gold/test14.out           |   5 +
 tests/sequence_functions/gold/test15.out           |   4 +
 tests/sequence_functions/gold/test16.out           |  10 +
 tests/sequence_functions/gold/test2.out            |   7 +
 tests/sequence_functions/gold/test3.out            |   4 +
 tests/sequence_functions/gold/test4.out            |   7 +
 tests/sequence_functions/gold/test5.out            |   5 +
 tests/sequence_functions/gold/test6.out            |   8 +
 tests/sequence_functions/gold/test7.out            |   6 +
 tests/sequence_functions/gold/test8.out            |   9 +
 tests/sequence_functions/gold/test9.out            |   7 +
 .../test1.xsl                                      |  11 +-
 .../test2.xsl => sequence_functions/test10.xsl}    |  22 +--
 .../test1.xsl => sequence_functions/test11.xsl}    |  15 +-
 .../test1.xsl => sequence_functions/test12.xsl}    |  16 +-
 .../test1.xsl => sequence_functions/test13.xsl}    |  13 +-
 .../test1.xsl => sequence_functions/test14.xsl}    |  14 +-
 .../test1.xsl => sequence_functions/test15.xsl}    |  13 +-
 .../test1.xsl => sequence_functions/test16.xsl}    |  15 +-
 tests/sequence_functions/test1_a.xml               |   4 +
 tests/sequence_functions/test1_b.xml               |   4 +
 tests/sequence_functions/test1_c.xml               |   8 +
 tests/sequence_functions/test1_d.xml               |   7 +
 tests/sequence_functions/test1_e.xml               |   5 +
 tests/sequence_functions/test1_f.xml               |   7 +
 .../test2.xsl                                      |  17 +-
 .../test1.xsl => sequence_functions/test3.xsl}     |  11 +-
 .../test1.xsl => sequence_functions/test4.xsl}     |  19 +-
 .../test1.xsl => sequence_functions/test5.xsl}     |  18 +-
 .../test1.xsl => sequence_functions/test6.xsl}     |  17 +-
 .../test1.xsl => sequence_functions/test7.xsl}     |  15 +-
 .../test1.xsl => sequence_functions/test8.xsl}     |  15 +-
 .../test1.xsl => sequence_functions/test9.xsl}     |  16 +-
 53 files changed, 1432 insertions(+), 133 deletions(-)

diff --git a/src/org/apache/xalan/xslt/util/XslTransformEvaluationHelper.java b/src/org/apache/xalan/xslt/util/XslTransformEvaluationHelper.java
index 360896e5..c08f5e71 100644
--- a/src/org/apache/xalan/xslt/util/XslTransformEvaluationHelper.java
+++ b/src/org/apache/xalan/xslt/util/XslTransformEvaluationHelper.java
@@ -19,12 +19,17 @@ package org.apache.xalan.xslt.util;
 import java.util.List;
 
 import org.apache.xalan.templates.XMLNSDecl;
+import org.apache.xml.dtm.DTMIterator;
+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.XSUntyped;
 import org.apache.xpath.xs.types.XSUntypedAtomic;
 
+import com.sun.org.apache.xml.internal.dtm.DTM;
+
 /**
  * This class, has few utility methods, to help with certain 
  * XalanJ XSLT transformation implementation tasks.
@@ -36,10 +41,10 @@ import org.apache.xpath.xs.types.XSUntypedAtomic;
 public class XslTransformEvaluationHelper {
     
     /**
-     * Given an XDM input sequence, expand that sequence to produce a new sequence
+     * Given an xdm input sequence, expand that sequence to produce a new sequence
      * none of whose items are sequence with cardinality greater than one.
      * 
-     * The caller of this method, needs to pass an XDM sequence to be expanded
+     * The caller of this method, needs to pass an xdm sequence to be expanded
      * as an argument, and another argument reference to get the result from this 
      * method.
      */
@@ -111,6 +116,37 @@ public class XslTransformEvaluationHelper {
         }
     }
     
+    /**
+     * Given an XObject object instance, get its contents as a ResultSequence object.  
+     */
+    public static ResultSequence getResultSequenceFromXObject(XObject xObject, XPathContext xctxt) {        
+        
+        ResultSequence resultSeq = new ResultSequence();
+        
+        if (xObject instanceof XNodeSet) {
+           XNodeSet nodeSet = (XNodeSet)xObject;
+            
+           DTMIterator dtmIter = nodeSet.iterRaw();
+           int nextNode;
+           while ((nextNode = dtmIter.nextNode()) != DTM.NULL) {
+              XNodeSet xdmNode = new XNodeSet(nextNode, xctxt);
+              resultSeq.add(xdmNode);
+           }
+        }
+        else if (xObject instanceof ResultSequence) {
+           ResultSequence rSeq = (ResultSequence)xObject;
+           
+           for (int idx = 0; idx < rSeq.size(); idx++) {
+              resultSeq.add(rSeq.item(idx)); 
+           }
+        }
+        else {
+           resultSeq.add(xObject);
+        }
+        
+        return resultSeq;
+    }
+    
     /**
      * Check whether a 'ResultSequence' object, contains a specific xdm item.
      */
diff --git a/src/org/apache/xpath/compiler/FunctionTable.java b/src/org/apache/xpath/compiler/FunctionTable.java
index 304f01df..40a4b113 100644
--- a/src/org/apache/xpath/compiler/FunctionTable.java
+++ b/src/org/apache/xpath/compiler/FunctionTable.java
@@ -275,6 +275,30 @@ public class FunctionTable
   
   /** The 'codepoint-equal()' id. */
   public static final int FUNC_CODEPOINT_EQUAL = 83;
+  
+  /** The 'empty()' id. */
+  public static final int FUNC_EMPTY = 84;
+  
+  /** The 'exists()' id. */
+  public static final int FUNC_EXISTS = 85;
+  
+  /** The 'head()' id. */
+  public static final int FUNC_HEAD = 86;
+  
+  /** The 'tail()' id. */
+  public static final int FUNC_TAIL = 87;
+  
+  /** The 'insert-before()' id. */
+  public static final int FUNC_INSERT_BEFORE = 88;
+  
+  /** The 'remove()' id. */
+  public static final int FUNC_REMOVE = 89;
+  
+  /** The 'reverse()' id. */
+  public static final int FUNC_REVERSE = 90;
+  
+  /** The 'subsequence()' id. */
+  public static final int FUNC_SUBSEQUENCE = 91;
 
   // Proprietary
 
@@ -332,7 +356,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 = 84;
+  private static final int NUM_BUILT_IN_FUNCS = 92;
 
   /**
    * Number of built-in functions that may be added.
@@ -500,6 +524,23 @@ public class FunctionTable
       org.apache.xpath.functions.FuncCompare.class;
     m_functions[FUNC_CODEPOINT_EQUAL] = 
       org.apache.xpath.functions.FuncCodepointEqual.class;
+    
+    m_functions[FUNC_EMPTY] = 
+      org.apache.xpath.functions.FuncEmpty.class;
+    m_functions[FUNC_EXISTS] = 
+      org.apache.xpath.functions.FuncExists.class;
+    m_functions[FUNC_HEAD] = 
+      org.apache.xpath.functions.FuncHead.class;
+    m_functions[FUNC_TAIL] = 
+      org.apache.xpath.functions.FuncTail.class;
+    m_functions[FUNC_INSERT_BEFORE] = 
+      org.apache.xpath.functions.FuncInsertBefore.class;
+    m_functions[FUNC_REMOVE] = 
+      org.apache.xpath.functions.FuncRemove.class;
+    m_functions[FUNC_REVERSE] = 
+      org.apache.xpath.functions.FuncReverse.class;
+    m_functions[FUNC_SUBSEQUENCE] = 
+      org.apache.xpath.functions.FuncSubsequence.class;
   }
 
   static{
@@ -675,6 +716,23 @@ public class FunctionTable
                          new Integer(FunctionTable.FUNC_COMPARE));
          m_functionID.put(Keywords.FUNC_CODEPOINT_EQUAL,
                          new Integer(FunctionTable.FUNC_CODEPOINT_EQUAL));
+         
+         m_functionID.put(Keywords.FUNC_EMPTY,
+                         new Integer(FunctionTable.FUNC_EMPTY));
+         m_functionID.put(Keywords.FUNC_EXISTS,
+                         new Integer(FunctionTable.FUNC_EXISTS));
+         m_functionID.put(Keywords.FUNC_HEAD,
+                         new Integer(FunctionTable.FUNC_HEAD));
+         m_functionID.put(Keywords.FUNC_TAIL,
+                         new Integer(FunctionTable.FUNC_TAIL));
+         m_functionID.put(Keywords.FUNC_INSERT_BEFORE,
+                         new Integer(FunctionTable.FUNC_INSERT_BEFORE));
+         m_functionID.put(Keywords.FUNC_REMOVE,
+                         new Integer(FunctionTable.FUNC_REMOVE));
+         m_functionID.put(Keywords.FUNC_REVERSE,
+                         new Integer(FunctionTable.FUNC_REVERSE));
+         m_functionID.put(Keywords.FUNC_SUBSEQUENCE,
+                         new Integer(FunctionTable.FUNC_SUBSEQUENCE));
   }
   
   public FunctionTable(){
diff --git a/src/org/apache/xpath/compiler/Keywords.java b/src/org/apache/xpath/compiler/Keywords.java
index ed2f516c..9a5ff0a4 100644
--- a/src/org/apache/xpath/compiler/Keywords.java
+++ b/src/org/apache/xpath/compiler/Keywords.java
@@ -385,6 +385,31 @@ public class Keywords
   /** xs:dayTimeDuration data type string. */
   public static final String XS_DAY_TIME_DURATION = "dayTimeDuration";
   
+  
+  /** empty function string. */
+  public static final String FUNC_EMPTY = "empty";
+  
+  /** exists function string. */
+  public static final String FUNC_EXISTS = "exists";
+  
+  /** head function string. */
+  public static final String FUNC_HEAD = "head";
+  
+  /** tail function string. */
+  public static final String FUNC_TAIL = "tail";
+  
+  /** insert-before function string. */
+  public static final String FUNC_INSERT_BEFORE = "insert-before";
+  
+  /** remove function string. */
+  public static final String FUNC_REMOVE = "remove";
+  
+  /** reverse function string. */
+  public static final String FUNC_REVERSE = "reverse";
+  
+  /** subsequence function string. */
+  public static final String FUNC_SUBSEQUENCE = "subsequence";
+  
   // Proprietary, built in functions
 
   /** current function string (Proprietary). */
diff --git a/src/org/apache/xpath/functions/FuncEmpty.java b/src/org/apache/xpath/functions/FuncEmpty.java
new file mode 100644
index 00000000..98408f9a
--- /dev/null
+++ b/src/org/apache/xpath/functions/FuncEmpty.java
@@ -0,0 +1,76 @@
+/*
+ * 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 org.apache.xpath.XPathContext;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XBoolean;
+import org.apache.xpath.objects.XNodeSet;
+import org.apache.xpath.objects.XObject;
+
+/**
+ * Implementation of the empty() function.
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class FuncEmpty extends FunctionOneArg {
+    
+    private static final long serialVersionUID = 8023120626582040786L;
+
+    /**
+     * 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
+    {
+        
+        XObject result = null;
+        
+        XObject xObject0 = m_arg0.execute(xctxt);
+        
+        if (xObject0 instanceof XNodeSet) {
+           XNodeSet nodeSet = (XNodeSet)xObject0;
+           if (nodeSet.getLength() == 0) {
+              result = XBoolean.S_TRUE;  
+           }
+           else {
+              result = XBoolean.S_FALSE; 
+           }
+        }
+        else if (xObject0 instanceof ResultSequence) {
+           ResultSequence resultSeq = (ResultSequence)xObject0;
+           if (resultSeq.size() == 0) {
+              result = XBoolean.S_TRUE; 
+           }
+           else {
+              result = XBoolean.S_FALSE;
+           }
+        }
+        else {
+           result = XBoolean.S_FALSE; 
+        }
+        
+        return result;
+    }
+
+}
diff --git a/src/org/apache/xpath/functions/FuncExists.java b/src/org/apache/xpath/functions/FuncExists.java
new file mode 100644
index 00000000..e573c474
--- /dev/null
+++ b/src/org/apache/xpath/functions/FuncExists.java
@@ -0,0 +1,76 @@
+/*
+ * 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 org.apache.xpath.XPathContext;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XBoolean;
+import org.apache.xpath.objects.XNodeSet;
+import org.apache.xpath.objects.XObject;
+
+/**
+ * Implementation of the exists() function.
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class FuncExists extends FunctionOneArg {
+
+    private static final long serialVersionUID = -3106224966062352967L;
+
+    /**
+     * 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
+    {
+        
+        XObject result = null;
+        
+        XObject xObject0 = m_arg0.execute(xctxt);
+        
+        if (xObject0 instanceof XNodeSet) {
+           XNodeSet nodeSet = (XNodeSet)xObject0;
+           if (nodeSet.getLength() > 0) {
+              result = XBoolean.S_TRUE;  
+           }
+           else {
+              result = XBoolean.S_FALSE; 
+           }
+        }
+        else if (xObject0 instanceof ResultSequence) {
+           ResultSequence resultSeq = (ResultSequence)xObject0;
+           if (resultSeq.size() > 0) {
+              result = XBoolean.S_TRUE;  
+           }
+           else {
+              result = XBoolean.S_FALSE;  
+           }
+        }
+        else {
+           result = XBoolean.S_TRUE; 
+        }
+        
+        return result;
+    }
+
+}
diff --git a/src/org/apache/xpath/functions/FuncHead.java b/src/org/apache/xpath/functions/FuncHead.java
new file mode 100644
index 00000000..b08a68ee
--- /dev/null
+++ b/src/org/apache/xpath/functions/FuncHead.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.xpath.functions;
+
+import org.apache.xml.dtm.DTMIterator;
+import org.apache.xpath.XPathContext;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XNodeSet;
+import org.apache.xpath.objects.XObject;
+
+/**
+ * Implementation of the head() function.
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class FuncHead extends FunctionOneArg {
+
+    private static final long serialVersionUID = -9160853897326799993L;
+
+    /**
+     * 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
+    {
+        
+        XObject result = null;
+        
+        XObject xObject0 = m_arg0.execute(xctxt);
+        
+        if (xObject0 instanceof XNodeSet) {
+           XNodeSet nodeSet = (XNodeSet)xObject0;
+           DTMIterator dtmIter = nodeSet.iterRaw();
+           result = new XNodeSet(dtmIter.nextNode(), xctxt);
+        }
+        else if (xObject0 instanceof ResultSequence) {
+           ResultSequence resultSeq = (ResultSequence)xObject0;
+           if (resultSeq.size() > 0) {
+              result = resultSeq.item(0);
+           }
+           else {
+              result = new ResultSequence();  
+           }
+        }
+        else {
+           result = xObject0; 
+        }
+        
+        return result;
+    }
+
+}
diff --git a/src/org/apache/xpath/functions/FuncInsertBefore.java b/src/org/apache/xpath/functions/FuncInsertBefore.java
new file mode 100644
index 00000000..060b6060
--- /dev/null
+++ b/src/org/apache/xpath/functions/FuncInsertBefore.java
@@ -0,0 +1,130 @@
+/*
+ * 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 javax.xml.transform.TransformerException;
+
+import org.apache.xalan.xslt.util.XslTransformEvaluationHelper;
+import org.apache.xpath.XPathContext;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XNumber;
+import org.apache.xpath.objects.XObject;
+import org.apache.xpath.xs.types.XSNumericType;
+
+/**
+ * Implementation of the insert-before() function.
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class FuncInsertBefore extends Function3Args {
+
+    private static final long serialVersionUID = 4238468031173924757L;
+
+    /**
+     * 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(); 
+        
+        try {
+            XObject xObject0 = m_arg0.execute(xctxt);        
+            XObject xObject1 = m_arg1.execute(xctxt);        
+            XObject xObject2 = m_arg2.execute(xctxt);
+            
+            ResultSequence rsArg0 = XslTransformEvaluationHelper.getResultSequenceFromXObject(
+                                                                                          xObject0, xctxt);
+            
+            int seqInsertPos = getSequenceInsertPosition(xObject1);
+            
+            if (seqInsertPos < 1) {
+               seqInsertPos = 1; 
+            }
+            
+            ResultSequence rsArg2 = XslTransformEvaluationHelper.getResultSequenceFromXObject(
+                                                                                          xObject2, xctxt);
+            
+            for (int idx = 0; idx < (seqInsertPos - 1); idx++) {
+               result.add(rsArg0.item(idx));  
+            }
+            
+            for (int idx = 0; idx < rsArg2.size(); idx++) {
+               result.add(rsArg2.item(idx));   
+            }
+            
+            for (int idx = (seqInsertPos - 1); idx < rsArg0.size(); idx++) {
+               result.add(rsArg0.item(idx));  
+            }
+        }
+        catch (TransformerException ex) {
+            throw new TransformerException(ex.getMessage(), srcLocator);  
+        }
+        
+        return result;
+    }
+    
+    /**
+     * Given an XObject object instance (representing the second argument [the position
+     * argument] of function call fn:insert-before), get its value as an integer.  
+     */
+    private int getSequenceInsertPosition(XObject xObject) throws TransformerException {
+       
+       int seqInsertPos = -1;
+       
+       if (xObject instanceof XNumber) {
+          double dbl = ((XNumber)xObject).num();
+          if (dbl == (int)dbl) {
+             seqInsertPos = (int)dbl;  
+          }
+          else {
+             throw new TransformerException("FORG0006 : Incorrect value " + dbl + " provided to second argument "
+                                                                              + "of function fn:insert-before. This argument value "
+                                                                              + "needs to be an integer."); 
+          }
+       }
+       else if (xObject instanceof XSNumericType) {
+          String argStrVal = ((XSNumericType)xObject).stringValue();
+          double dbl = (Double.valueOf(argStrVal)).doubleValue();
+          if (dbl == (int)dbl) {
+             seqInsertPos = (int)dbl;  
+          }
+          else {
+             throw new TransformerException("FORG0006 : Incorrect value " + dbl + " provided to second argument "
+                                                                              + "of function fn:insert-before. This argument value "
+                                                                              + "needs to be an integer.");  
+          }
+       }
+       else {
+          throw new TransformerException("FORG0006 : The second argument to function fn:insert-before, needs to be "
+                                                                                                         + "an integer value");  
+       }
+       
+       return seqInsertPos; 
+    }
+
+}
diff --git a/src/org/apache/xpath/functions/FuncRemove.java b/src/org/apache/xpath/functions/FuncRemove.java
new file mode 100644
index 00000000..240c3d0f
--- /dev/null
+++ b/src/org/apache/xpath/functions/FuncRemove.java
@@ -0,0 +1,128 @@
+/*
+ * 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 javax.xml.transform.TransformerException;
+
+import org.apache.xalan.xslt.util.XslTransformEvaluationHelper;
+import org.apache.xpath.XPathContext;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XNumber;
+import org.apache.xpath.objects.XObject;
+import org.apache.xpath.xs.types.XSNumericType;
+
+/**
+ * Implementation of the remove() function.
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class FuncRemove extends Function2Args {
+
+    private static final long serialVersionUID = -8240867333953131047L;
+
+    /**
+     * 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();
+        
+        try {
+            XObject xObject0 = m_arg0.execute(xctxt);
+            XObject xObject1 = m_arg1.execute(xctxt);
+            
+            ResultSequence rsArg0 = XslTransformEvaluationHelper.getResultSequenceFromXObject(
+                                                                                          xObject0, xctxt);
+            
+            int seqRemovePos = getSequenceRemovePosition(xObject1);
+            
+            if (seqRemovePos < 1 || (seqRemovePos > rsArg0.size())) {
+               for (int idx = 0; idx < rsArg0.size(); idx++) {
+                  result.add(rsArg0.item(idx));  
+               }
+            }
+            else if (rsArg0.size() == 0) {
+               return result;    
+            }
+            else {
+               for (int idx = 0; idx < (seqRemovePos - 1); idx++) {
+                  result.add(rsArg0.item(idx));    
+               }
+               
+               for (int idx = seqRemovePos; idx < rsArg0.size(); idx++) {
+                  result.add(rsArg0.item(idx));    
+               }
+            }
+        }
+        catch (TransformerException ex) {
+            throw new TransformerException(ex.getMessage(), srcLocator);  
+        }
+        
+        return result;
+    }
+    
+    /**
+     * Given an XObject object instance (representing the second argument [the 'remove'
+     * position argument] of function call fn:remove), get its value as an integer.  
+     */
+    private int getSequenceRemovePosition(XObject xObject) throws TransformerException {
+       
+       int seqRemovePos = -1;
+       
+       if (xObject instanceof XNumber) {
+          double dbl = ((XNumber)xObject).num();
+          if (dbl == (int)dbl) {
+             seqRemovePos = (int)dbl;  
+          }
+          else {
+             throw new TransformerException("FORG0006 : Incorrect value " + dbl + " provided to second argument "
+                                                                              + "of function fn:remove. This argument value "
+                                                                              + "needs to be an integer."); 
+          }
+       }
+       else if (xObject instanceof XSNumericType) {
+          String argStrVal = ((XSNumericType)xObject).stringValue();
+          double dbl = (Double.valueOf(argStrVal)).doubleValue();
+          if (dbl == (int)dbl) {
+             seqRemovePos = (int)dbl;  
+          }
+          else {
+             throw new TransformerException("FORG0006 : Incorrect value " + dbl + " provided to second argument "
+                                                                              + "of function fn:remove. This argument value "
+                                                                              + "needs to be an integer.");  
+          }
+       }
+       else {
+          throw new TransformerException("FORG0006 : The second argument to function fn:remove, needs to be "
+                                                                                                         + "an integer value");  
+       }
+       
+       return seqRemovePos; 
+    }
+
+}
diff --git a/src/org/apache/xpath/functions/FuncReverse.java b/src/org/apache/xpath/functions/FuncReverse.java
new file mode 100644
index 00000000..4bfbf397
--- /dev/null
+++ b/src/org/apache/xpath/functions/FuncReverse.java
@@ -0,0 +1,64 @@
+/*
+ * 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.xalan.xslt.util.XslTransformEvaluationHelper;
+import org.apache.xpath.XPathContext;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XObject;
+
+/**
+ * Implementation of the reverse() function.
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class FuncReverse extends FunctionOneArg {
+
+    private static final long serialVersionUID = -6427731983746707296L;
+
+    /**
+     * 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();
+
+        XObject xObject0 = m_arg0.execute(xctxt);
+            
+        ResultSequence rsArg0 = XslTransformEvaluationHelper.getResultSequenceFromXObject(
+                                                                                      xObject0, xctxt);
+            
+        for (int idx = (rsArg0.size() - 1); idx >= 0; idx--) {
+           result.add(rsArg0.item(idx)); 
+        }
+        
+        return result;
+    }
+
+}
diff --git a/src/org/apache/xpath/functions/FuncSubsequence.java b/src/org/apache/xpath/functions/FuncSubsequence.java
new file mode 100644
index 00000000..6e98c692
--- /dev/null
+++ b/src/org/apache/xpath/functions/FuncSubsequence.java
@@ -0,0 +1,178 @@
+/*
+ * 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.xalan.res.XSLMessages;
+import org.apache.xalan.xslt.util.XslTransformEvaluationHelper;
+import org.apache.xpath.Expression;
+import org.apache.xpath.XPathContext;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XNumber;
+import org.apache.xpath.objects.XObject;
+import org.apache.xpath.res.XPATHErrorResources;
+import org.apache.xpath.xs.types.XSNumericType;
+
+/**
+ * Implementation of the subsequence() function.
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class FuncSubsequence extends FunctionMultiArgs {
+
+    private static final long serialVersionUID = -3680881808988095370L;
+    
+    /**
+     * The number of arguments passed to the fn:sort function 
+     * call.
+     */
+    private int numOfArgs = 0;
+
+    /**
+     * 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();
+        
+        Expression arg0 = m_arg0;        
+        Expression arg1 = m_arg1;        
+        Expression arg2 = null;
+        
+        try {
+            XObject xObject0 = arg0.execute(xctxt);
+            
+            ResultSequence rsArg0 = XslTransformEvaluationHelper.getResultSequenceFromXObject(
+                                                                                          xObject0, xctxt);
+            
+            XObject arg1Obj = arg1.execute(xctxt);
+            int startingLoc = getIntFromXObject(arg1Obj);
+            
+            // This function call requires either two arguments, or three arguments
+            if (numOfArgs == 2) {
+               for (int idx = (startingLoc - 1); idx < rsArg0.size(); idx++) {
+                  result.add(rsArg0.item(idx)); 
+               }
+            }
+            else {
+               // The function call has three arguments
+               arg2 = m_arg2;
+               XObject arg2Obj = arg2.execute(xctxt);           
+               int lengthVal = getIntFromXObject(arg2Obj);
+               if (lengthVal > rsArg0.size()) {
+                   throw new javax.xml.transform.TransformerException("FORG0006 : The third argument value " + 
+                                                                                         lengthVal + " of call to function fn:subsequence, is "
+                                                                                                   + "greater than the size of input sequence."); 
+               }
+               else { 
+                  for (int idx = (startingLoc - 1); idx < ((startingLoc - 1) + lengthVal); idx++) {
+                     result.add(rsArg0.item(idx)); 
+                  }
+               }
+            }
+        }
+        catch (javax.xml.transform.TransformerException ex) {
+           throw new javax.xml.transform.TransformerException(ex.getMessage(), srcLocator);  
+        }
+        
+        return result;
+    }
+    
+    /**
+     * Check that the number of arguments passed to this function is correct.
+     *
+     * @param argNum The number of arguments that is being passed to the function.
+     *
+     * @throws WrongNumberArgsException
+     */
+    public void checkNumberArgs(int argNum) throws WrongNumberArgsException
+    {
+       if (!(argNum > 1 && argNum <= 3)) {
+          reportWrongNumberArgs();
+       }
+       else {
+          numOfArgs = argNum;   
+       }
+    }
+    
+    /**
+     * Constructs and throws a WrongNumberArgException with the appropriate
+     * message for this function object.
+     *
+     * @throws WrongNumberArgsException
+     */
+    protected void reportWrongNumberArgs() throws WrongNumberArgsException {
+        throw new WrongNumberArgsException(XSLMessages.createXPATHMessage(
+                                                                     XPATHErrorResources.ER_TWO_OR_THREE, 
+                                                                     null));
+    }
+    
+    /**
+     * Given an evaluated XPath expression for function fn:subsequence's second or third
+     * argument, get its value as an integer. 
+     */
+    private int getIntFromXObject(XObject xObject) throws javax.xml.transform.TransformerException {
+       int returnVal = -1;
+       
+       double dblVal = 0.0;
+       
+       if (xObject instanceof XNumber) {
+          dblVal = ((XNumber)xObject).num();
+          returnVal = roundDoubleToInt(dblVal); 
+       }
+       else if (xObject instanceof XSNumericType) {
+          String strVal = ((XSNumericType)xObject).stringValue();
+          dblVal = (Double.valueOf(strVal)).doubleValue();
+          returnVal = roundDoubleToInt(dblVal);
+       }
+       else {
+          throw new javax.xml.transform.TransformerException("FORG0006 : The second or third argument's value, to "
+                                                                                 + "function fn:subsequence is not numeric or "
+                                                                                 + "cannot be cast to numeric."); 
+       }
+       
+       return returnVal;
+    }
+    
+    /**
+     * Do a numeric round of a double value, to an integer value.
+     */
+    private int roundDoubleToInt(double dblVal) {
+       int returnVal = -1;
+       
+       if ((dblVal >= -0.5 && dblVal < 0) || (dblVal == 0.0)) {
+          returnVal = 0;  
+       }
+       else {
+          returnVal = (int)(Math.floor(dblVal + 0.5)); 
+       }
+       
+       return returnVal; 
+    }
+
+}
diff --git a/src/org/apache/xpath/functions/FuncTail.java b/src/org/apache/xpath/functions/FuncTail.java
new file mode 100644
index 00000000..d10e293c
--- /dev/null
+++ b/src/org/apache/xpath/functions/FuncTail.java
@@ -0,0 +1,73 @@
+/*
+ * 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 org.apache.xml.dtm.DTMIterator;
+import org.apache.xpath.XPathContext;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XNodeSet;
+import org.apache.xpath.objects.XObject;
+
+import com.sun.org.apache.xml.internal.dtm.DTM;
+
+/**
+ * Implementation of the tail() function.
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class FuncTail extends FunctionOneArg {
+
+    private static final long serialVersionUID = -7505231181568257145L;
+
+    /**
+     * 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();
+        
+        XObject xObject0 = m_arg0.execute(xctxt);
+        
+        if (xObject0 instanceof XNodeSet) {
+           XNodeSet nodeSet = (XNodeSet)xObject0;
+           
+           DTMIterator dtmIter = nodeSet.iterRaw();
+           int nextNode = dtmIter.nextNode();
+           while ((nextNode = dtmIter.nextNode()) != DTM.NULL) {
+              XNodeSet xdmNode = new XNodeSet(nextNode, xctxt);
+              result.add(xdmNode);
+           }
+        }
+        else if (xObject0 instanceof ResultSequence) {
+           ResultSequence resultSeq = (ResultSequence)xObject0;
+           for (int idx = 1; idx < resultSeq.size(); idx++) {
+              result.add(resultSeq.item(idx)); 
+           }
+        }
+        
+        return result;
+    }
+
+}
diff --git a/tests/fn_codepoint_equal/test1.xsl b/tests/fn_codepoint_equal/test1.xsl
index aff4e326..37b8fe60 100644
--- a/tests/fn_codepoint_equal/test1.xsl
+++ b/tests/fn_codepoint_equal/test1.xsl
@@ -4,8 +4,11 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
-        function. -->                             
+   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal 
+        function.
+        
+        The fn:codepoint-equal function examples used within this stylesheet,
+        are borrowed from XPath 3.1 F&O spec. -->                             
 
    <xsl:output method="xml" indent="yes"/>
    
diff --git a/tests/fn_codepoint_equal/test2.xsl b/tests/fn_codepoint_equal/test2.xsl
index 869ff3b9..6a541492 100644
--- a/tests/fn_codepoint_equal/test2.xsl
+++ b/tests/fn_codepoint_equal/test2.xsl
@@ -6,7 +6,7 @@
    
    <!-- use with test1_a.xml -->
    
-   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
+   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal 
         function.
         
         This stylesheet reads input data to be transformed, from an 
diff --git a/tests/org/apache/xalan/xpath3/SequenceFunctionTests.java b/tests/org/apache/xalan/xpath3/SequenceFunctionTests.java
new file mode 100644
index 00000000..41b75dc2
--- /dev/null
+++ b/tests/org/apache/xalan/xpath3/SequenceFunctionTests.java
@@ -0,0 +1,214 @@
+/*
+ * 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 test cases, for the following functions on sequences:
+ * fn:empty, fn:exists, fn:head, fn:tail, fn:insert-before, fn:remove, 
+ * fn:reverse, fn:subsequence.
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class SequenceFunctionTests extends XslTransformTestsUtil {        
+    
+    private static final String XSL_TRANSFORM_INPUT_DIRPATH = XSLConstants.XSL_TRANSFORM_INPUT_DIRPATH_PREFIX + 
+                                                                                                           "sequence_functions/";
+    
+    private static final String XSL_TRANSFORM_GOLD_DIRPATH = XSLConstants.XSL_TRANSFORM_GOLD_DIRPATH_PREFIX + 
+                                                                                                           "sequence_functions/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 xslSequenceFunctionTest1() {
+        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 xslSequenceFunctionTest2() {
+        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);
+    }
+    
+    @Test
+    public void xslSequenceFunctionTest3() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test3.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test3.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test3.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslSequenceFunctionTest4() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_a.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test4.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test4.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslSequenceFunctionTest5() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test5.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test5.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test5.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslSequenceFunctionTest6() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_b.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test6.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test6.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslSequenceFunctionTest7() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test7.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test7.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test7.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslSequenceFunctionTest8() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_c.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test8.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test8.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslSequenceFunctionTest9() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test9.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test9.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test9.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslSequenceFunctionTest10() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_d.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test10.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test10.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslSequenceFunctionTest11() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test11.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test11.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test11.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslSequenceFunctionTest12() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_e.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test12.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test12.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslSequenceFunctionTest13() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test13.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test13.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test13.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslSequenceFunctionTest14() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_e.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test14.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test14.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslSequenceFunctionTest15() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test15.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test15.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test15.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslSequenceFunctionTest16() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_f.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test16.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test16.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+
+}
diff --git a/tests/org/apache/xalan/xslt3/AllXsl3Tests.java b/tests/org/apache/xalan/xslt3/AllXsl3Tests.java
index 6cdea357..9f90c976 100644
--- a/tests/org/apache/xalan/xslt3/AllXsl3Tests.java
+++ b/tests/org/apache/xalan/xslt3/AllXsl3Tests.java
@@ -43,6 +43,7 @@ import org.apache.xalan.xpath3.NodeComparisonTests;
 import org.apache.xalan.xpath3.QuantifiedExprTests;
 import org.apache.xalan.xpath3.RangeExprTests;
 import org.apache.xalan.xpath3.SequenceConstructorTests;
+import org.apache.xalan.xpath3.SequenceFunctionTests;
 import org.apache.xalan.xpath3.SequenceTests;
 import org.apache.xalan.xpath3.SimpleMapOperatorTests;
 import org.apache.xalan.xpath3.StringConcatExprTests;
@@ -82,7 +83,8 @@ 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, FnCodepointEqualTests.class })
+                FnStringToCodepointsTests.class, FnCompareTests.class, FnCodepointEqualTests.class,
+                SequenceFunctionTests.class })
 public class AllXsl3Tests {
 
 }
diff --git a/tests/sequence_functions/gold/test1.out b/tests/sequence_functions/gold/test1.out
new file mode 100644
index 00000000..05e5bb77
--- /dev/null
+++ b/tests/sequence_functions/gold/test1.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>true</one>
+  <two>false</two>
+</result>
diff --git a/tests/sequence_functions/gold/test10.out b/tests/sequence_functions/gold/test10.out
new file mode 100644
index 00000000..d4fe0693
--- /dev/null
+++ b/tests/sequence_functions/gold/test10.out
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>
+    <elem7>test value 7</elem7>
+    <elem1>test value 1</elem1>
+    <elem2>test value 2</elem2>
+    <elem3>test value 3</elem3>
+  </one>
+  <two>
+    <elem7>test value 7</elem7>
+    <elem1>test value 1</elem1>
+    <elem2>test value 2</elem2>
+    <elem3>test value 3</elem3>
+  </two>
+  <three>
+    <elem1>test value 1</elem1>
+    <elem7>test value 7</elem7>
+    <elem2>test value 2</elem2>
+    <elem3>test value 3</elem3>
+  </three>
+  <four>
+    <elem1>test value 1</elem1>
+    <elem2>test value 2</elem2>
+    <elem7>test value 7</elem7>
+    <elem3>test value 3</elem3>
+  </four>
+  <five>
+    <elem1>test value 1</elem1>
+    <elem2>test value 2</elem2>
+    <elem3>test value 3</elem3>
+    <elem7>test value 7</elem7>
+  </five>
+</result>
diff --git a/tests/sequence_functions/gold/test11.out b/tests/sequence_functions/gold/test11.out
new file mode 100644
index 00000000..55d0ce3f
--- /dev/null
+++ b/tests/sequence_functions/gold/test11.out
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>a b c</one>
+  <two>b c</two>
+  <three>a b c</three>
+  <four/>
+</result>
diff --git a/tests/sequence_functions/gold/test12.out b/tests/sequence_functions/gold/test12.out
new file mode 100644
index 00000000..801e2824
--- /dev/null
+++ b/tests/sequence_functions/gold/test12.out
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>
+    <elem1>test value 1</elem1>
+    <elem2>test value 2</elem2>
+    <elem3>test value 3</elem3>
+  </one>
+  <two>
+    <elem2>test value 2</elem2>
+    <elem3>test value 3</elem3>
+  </two>
+  <three>
+    <elem1>test value 1</elem1>
+    <elem2>test value 2</elem2>
+    <elem3>test value 3</elem3>
+  </three>
+</result>
diff --git a/tests/sequence_functions/gold/test13.out b/tests/sequence_functions/gold/test13.out
new file mode 100644
index 00000000..6aed9b19
--- /dev/null
+++ b/tests/sequence_functions/gold/test13.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>c b a</one>
+  <two/>
+</result>
diff --git a/tests/sequence_functions/gold/test14.out b/tests/sequence_functions/gold/test14.out
new file mode 100644
index 00000000..e619e232
--- /dev/null
+++ b/tests/sequence_functions/gold/test14.out
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <elem3>test value 3</elem3>
+  <elem2>test value 2</elem2>
+  <elem1>test value 1</elem1>
+</result>
diff --git a/tests/sequence_functions/gold/test15.out b/tests/sequence_functions/gold/test15.out
new file mode 100644
index 00000000..b461c4a3
--- /dev/null
+++ b/tests/sequence_functions/gold/test15.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>item4 item5</one>
+  <two>item3 item4</two>
+</result>
diff --git a/tests/sequence_functions/gold/test16.out b/tests/sequence_functions/gold/test16.out
new file mode 100644
index 00000000..970e8eb4
--- /dev/null
+++ b/tests/sequence_functions/gold/test16.out
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>
+    <elem4>test value 4</elem4>
+    <elem5>test value 5</elem5>
+  </one>
+  <two>
+    <elem3>test value 3</elem3>
+    <elem4>test value 4</elem4>
+  </two>
+</result>
diff --git a/tests/sequence_functions/gold/test2.out b/tests/sequence_functions/gold/test2.out
new file mode 100644
index 00000000..0df4534d
--- /dev/null
+++ b/tests/sequence_functions/gold/test2.out
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>false</one>
+  <two>false</two>
+  <three>true</three>
+  <four>true</four>
+  <five>true</five>
+</result>
diff --git a/tests/sequence_functions/gold/test3.out b/tests/sequence_functions/gold/test3.out
new file mode 100644
index 00000000..33530963
--- /dev/null
+++ b/tests/sequence_functions/gold/test3.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>false</one>
+  <two>true</two>
+</result>
diff --git a/tests/sequence_functions/gold/test4.out b/tests/sequence_functions/gold/test4.out
new file mode 100644
index 00000000..27ea8f11
--- /dev/null
+++ b/tests/sequence_functions/gold/test4.out
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>true</one>
+  <two>true</two>
+  <three>false</three>
+  <four>false</four>
+  <five>false</five>
+</result>
diff --git a/tests/sequence_functions/gold/test5.out b/tests/sequence_functions/gold/test5.out
new file mode 100644
index 00000000..59e453cd
--- /dev/null
+++ b/tests/sequence_functions/gold/test5.out
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>1</one>
+  <two>a</two>
+  <three/>
+</result>
diff --git a/tests/sequence_functions/gold/test6.out b/tests/sequence_functions/gold/test6.out
new file mode 100644
index 00000000..218152cd
--- /dev/null
+++ b/tests/sequence_functions/gold/test6.out
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>
+    <elem>test value</elem>
+  </one>
+  <two val1="abc"/>
+  <three/>
+  <four/>
+</result>
diff --git a/tests/sequence_functions/gold/test7.out b/tests/sequence_functions/gold/test7.out
new file mode 100644
index 00000000..fdcd0a4a
--- /dev/null
+++ b/tests/sequence_functions/gold/test7.out
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>2 3 4 5</one>
+  <two>b c</two>
+  <three/>
+  <four/>
+</result>
diff --git a/tests/sequence_functions/gold/test8.out b/tests/sequence_functions/gold/test8.out
new file mode 100644
index 00000000..29dadf8d
--- /dev/null
+++ b/tests/sequence_functions/gold/test8.out
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>
+    <elem2>test value 2</elem2>
+    <elem3>test value 3</elem3>
+    <elem4>test value 4</elem4>
+    <elem5>test value 5</elem5>
+  </one>
+  <two val2="pqr" val3="mno" val4="uvw" val5="ijk"/>
+</result>
diff --git a/tests/sequence_functions/gold/test9.out b/tests/sequence_functions/gold/test9.out
new file mode 100644
index 00000000..7d9aaf50
--- /dev/null
+++ b/tests/sequence_functions/gold/test9.out
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>z a b c</one>
+  <two>z a b c</two>
+  <three>a z b c</three>
+  <four>a b z c</four>
+  <five>a b c z</five>
+</result>
diff --git a/tests/fn_codepoint_equal/test1.xsl b/tests/sequence_functions/test1.xsl
similarity index 70%
copy from tests/fn_codepoint_equal/test1.xsl
copy to tests/sequence_functions/test1.xsl
index aff4e326..5de7fa95 100644
--- a/tests/fn_codepoint_equal/test1.xsl
+++ b/tests/sequence_functions/test1.xsl
@@ -4,18 +4,15 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
-        function. -->                             
+   <!-- An XSLT stylesheet test case, to test XPath 3.1 function
+        fn:empty. -->                          
 
    <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>
+         <one><xsl:value-of select="empty(())"/></one>
+         <two><xsl:value-of select="empty('')"/></two>
       </result>
    </xsl:template>
    
diff --git a/tests/fn_codepoint_equal/test2.xsl b/tests/sequence_functions/test10.xsl
similarity index 63%
copy from tests/fn_codepoint_equal/test2.xsl
copy to tests/sequence_functions/test10.xsl
index 869ff3b9..cd344440 100644
--- a/tests/fn_codepoint_equal/test2.xsl
+++ b/tests/sequence_functions/test10.xsl
@@ -4,24 +4,22 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- use with test1_a.xml -->
+   <!-- use with test1_d.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.
-   -->                            
+   <!-- An XSLT stylesheet test, to test XPath 3.1 function 
+        fn:insert-before. -->                            
 
-   <xsl:output method="xml" indent="yes"/>
+   <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>
+         <xsl:variable name="seq1" select="(elem1, elem2, elem3)"/>
          
-         <three><xsl:value-of select="codepoint-equal(data/@str1, data/@str2)"/></three>
-         <four><xsl:value-of select="codepoint-equal(data/@str1, data/@str3)"/></four>
+         <one><xsl:copy-of select="insert-before($seq1, 0, elem7)"/></one>
+         <two><xsl:copy-of select="insert-before($seq1, 1, elem7)"/></two>
+         <three><xsl:copy-of select="insert-before($seq1, 2, elem7)"/></three>
+         <four><xsl:copy-of select="insert-before($seq1, 3, elem7)"/></four>
+         <five><xsl:copy-of select="insert-before($seq1, 4, elem7)"/></five>
       </result>
    </xsl:template>
    
diff --git a/tests/fn_codepoint_equal/test1.xsl b/tests/sequence_functions/test11.xsl
similarity index 70%
copy from tests/fn_codepoint_equal/test1.xsl
copy to tests/sequence_functions/test11.xsl
index aff4e326..7f21de39 100644
--- a/tests/fn_codepoint_equal/test1.xsl
+++ b/tests/sequence_functions/test11.xsl
@@ -4,18 +4,19 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
-        function. -->                             
+   <!-- An XSLT stylesheet test, to test XPath 3.1 function 
+        fn:remove. -->                              
 
    <xsl:output method="xml" indent="yes"/>
    
+   <xsl:variable name="abc" select="('a', 'b', 'c')"/>
+   
    <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>
+         <one><xsl:value-of select="remove($abc, 0)"/></one>
+         <two><xsl:value-of select="remove($abc, 1)"/></two>
+         <three><xsl:value-of select="remove($abc, 6)"/></three>
+         <four><xsl:value-of select="remove((), 3)"/></four>
       </result>
    </xsl:template>
    
diff --git a/tests/fn_codepoint_equal/test1.xsl b/tests/sequence_functions/test12.xsl
similarity index 68%
copy from tests/fn_codepoint_equal/test1.xsl
copy to tests/sequence_functions/test12.xsl
index aff4e326..4a1e2a3e 100644
--- a/tests/fn_codepoint_equal/test1.xsl
+++ b/tests/sequence_functions/test12.xsl
@@ -4,18 +4,18 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
-        function. -->                             
+   <!-- use with test1_e.xml -->
+   
+   <!-- An XSLT stylesheet test, to test XPath 3.1 function 
+        fn:remove. -->                            
 
    <xsl:output method="xml" indent="yes"/>
    
-   <xsl:template match="/">
+   <xsl:template match="/info">
       <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>
+         <one><xsl:copy-of select="remove(*, 0)"/></one>
+         <two><xsl:copy-of select="remove(*, 1)"/></two>
+         <three><xsl:copy-of select="remove(*, 6)"/></three>
       </result>
    </xsl:template>
    
diff --git a/tests/fn_codepoint_equal/test1.xsl b/tests/sequence_functions/test13.xsl
similarity index 70%
copy from tests/fn_codepoint_equal/test1.xsl
copy to tests/sequence_functions/test13.xsl
index aff4e326..3ed9ec1b 100644
--- a/tests/fn_codepoint_equal/test1.xsl
+++ b/tests/sequence_functions/test13.xsl
@@ -4,18 +4,17 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
-        function. -->                             
+   <!-- An XSLT stylesheet test, to test XPath 3.1 function 
+        fn:reverse. -->                              
 
    <xsl:output method="xml" indent="yes"/>
    
+   <xsl:variable name="abc" select="('a', 'b', 'c')"/>
+   
    <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>
+        <one><xsl:value-of select="reverse($abc)"/></one>
+        <two><xsl:value-of select="reverse(())"/></two>
       </result>
    </xsl:template>
    
diff --git a/tests/fn_codepoint_equal/test1.xsl b/tests/sequence_functions/test14.xsl
similarity index 68%
copy from tests/fn_codepoint_equal/test1.xsl
copy to tests/sequence_functions/test14.xsl
index aff4e326..ae6f886b 100644
--- a/tests/fn_codepoint_equal/test1.xsl
+++ b/tests/sequence_functions/test14.xsl
@@ -4,18 +4,16 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
-        function. -->                             
+   <!-- use with test1_e.xml -->
+   
+   <!-- An XSLT stylesheet test, to test XPath 3.1 function 
+        fn:reverse. -->                            
 
    <xsl:output method="xml" indent="yes"/>
    
-   <xsl:template match="/">
+   <xsl:template match="/info">
       <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>
+         <xsl:copy-of select="reverse(*)"/>
       </result>
    </xsl:template>
    
diff --git a/tests/fn_codepoint_equal/test1.xsl b/tests/sequence_functions/test15.xsl
similarity index 70%
copy from tests/fn_codepoint_equal/test1.xsl
copy to tests/sequence_functions/test15.xsl
index aff4e326..42c99a7e 100644
--- a/tests/fn_codepoint_equal/test1.xsl
+++ b/tests/sequence_functions/test15.xsl
@@ -4,18 +4,17 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
-        function. -->                             
+   <!-- An XSLT stylesheet test, to test XPath 3.1 function 
+        fn:subsequence. -->                             
 
    <xsl:output method="xml" indent="yes"/>
    
+   <xsl:variable name="seq" select="('item1', 'item2', 'item3', 'item4', 'item5')"/>
+   
    <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>
+         <one><xsl:value-of select="subsequence($seq, 4)"/></one>
+         <two><xsl:value-of select="subsequence($seq, 3, 2)"/></two>
       </result>
    </xsl:template>
    
diff --git a/tests/fn_codepoint_equal/test1.xsl b/tests/sequence_functions/test16.xsl
similarity index 68%
copy from tests/fn_codepoint_equal/test1.xsl
copy to tests/sequence_functions/test16.xsl
index aff4e326..94beb6b3 100644
--- a/tests/fn_codepoint_equal/test1.xsl
+++ b/tests/sequence_functions/test16.xsl
@@ -4,18 +4,17 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
-        function. -->                             
+   <!-- use with test1_f.xml -->
+   
+   <!-- An XSLT stylesheet test, to test XPath 3.1 function 
+        fn:subsequence. -->                             
 
    <xsl:output method="xml" indent="yes"/>
    
-   <xsl:template match="/">
+   <xsl:template match="/info">
       <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>
+         <one><xsl:copy-of select="subsequence(*, 4)"/></one>
+         <two><xsl:copy-of select="subsequence(*, 3, 2)"/></two>
       </result>
    </xsl:template>
    
diff --git a/tests/sequence_functions/test1_a.xml b/tests/sequence_functions/test1_a.xml
new file mode 100644
index 00000000..29e4c250
--- /dev/null
+++ b/tests/sequence_functions/test1_a.xml
@@ -0,0 +1,4 @@
+<info>
+  <elem/>
+  <data val="abc"/>
+</info>
\ No newline at end of file
diff --git a/tests/sequence_functions/test1_b.xml b/tests/sequence_functions/test1_b.xml
new file mode 100644
index 00000000..25d02e89
--- /dev/null
+++ b/tests/sequence_functions/test1_b.xml
@@ -0,0 +1,4 @@
+<info>
+  <elem>test value</elem>
+  <data val1="abc" val2="pqr"/>
+</info>
\ No newline at end of file
diff --git a/tests/sequence_functions/test1_c.xml b/tests/sequence_functions/test1_c.xml
new file mode 100644
index 00000000..1b574bad
--- /dev/null
+++ b/tests/sequence_functions/test1_c.xml
@@ -0,0 +1,8 @@
+<info>
+  <elem1>test value 1</elem1>
+  <elem2>test value 2</elem2>
+  <elem3>test value 3</elem3>
+  <elem4>test value 4</elem4>
+  <elem5>test value 5</elem5>
+  <data val1="abc" val2="pqr" val3="mno" val4="uvw" val5="ijk"/>
+</info>
\ No newline at end of file
diff --git a/tests/sequence_functions/test1_d.xml b/tests/sequence_functions/test1_d.xml
new file mode 100644
index 00000000..333fe968
--- /dev/null
+++ b/tests/sequence_functions/test1_d.xml
@@ -0,0 +1,7 @@
+<info>
+  <elem1>test value 1</elem1>
+  <elem2>test value 2</elem2>
+  <elem3>test value 3</elem3>
+  
+  <elem7>test value 7</elem7>  
+</info>
\ No newline at end of file
diff --git a/tests/sequence_functions/test1_e.xml b/tests/sequence_functions/test1_e.xml
new file mode 100644
index 00000000..1d8da739
--- /dev/null
+++ b/tests/sequence_functions/test1_e.xml
@@ -0,0 +1,5 @@
+<info>
+  <elem1>test value 1</elem1>
+  <elem2>test value 2</elem2>
+  <elem3>test value 3</elem3>
+</info>
\ No newline at end of file
diff --git a/tests/sequence_functions/test1_f.xml b/tests/sequence_functions/test1_f.xml
new file mode 100644
index 00000000..f291a49b
--- /dev/null
+++ b/tests/sequence_functions/test1_f.xml
@@ -0,0 +1,7 @@
+<info>
+  <elem1>test value 1</elem1>
+  <elem2>test value 2</elem2>
+  <elem3>test value 3</elem3>
+  <elem4>test value 4</elem4>
+  <elem5>test value 5</elem5>
+</info>
\ No newline at end of file
diff --git a/tests/fn_codepoint_equal/test2.xsl b/tests/sequence_functions/test2.xsl
similarity index 68%
copy from tests/fn_codepoint_equal/test2.xsl
copy to tests/sequence_functions/test2.xsl
index 869ff3b9..cc33cb04 100644
--- a/tests/fn_codepoint_equal/test2.xsl
+++ b/tests/sequence_functions/test2.xsl
@@ -6,22 +6,19 @@
    
    <!-- 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.
-   -->                            
+   <!-- An XSLT stylesheet test case, to test XPath 3.1 function
+        fn:empty. -->                             
 
    <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>
+         <one><xsl:value-of select="empty(elem)"/></one>
+         <two><xsl:value-of select="empty(data/@val)"/></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>
+         <three><xsl:value-of select="empty(elem2)"/></three>
+         <four><xsl:value-of select="empty(data/@val2)"/></four>
+         <five><xsl:value-of select="empty(elem3/@val)"/></five>
       </result>
    </xsl:template>
    
diff --git a/tests/fn_codepoint_equal/test1.xsl b/tests/sequence_functions/test3.xsl
similarity index 70%
copy from tests/fn_codepoint_equal/test1.xsl
copy to tests/sequence_functions/test3.xsl
index aff4e326..8c13a5d5 100644
--- a/tests/fn_codepoint_equal/test1.xsl
+++ b/tests/sequence_functions/test3.xsl
@@ -4,18 +4,15 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
-        function. -->                             
+   <!-- An XSLT stylesheet test case, to test XPath 3.1 function
+        fn:exists. -->                         
 
    <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>
+         <one><xsl:value-of select="exists(())"/></one>
+         <two><xsl:value-of select="exists('')"/></two>
       </result>
    </xsl:template>
    
diff --git a/tests/fn_codepoint_equal/test1.xsl b/tests/sequence_functions/test4.xsl
similarity index 68%
copy from tests/fn_codepoint_equal/test1.xsl
copy to tests/sequence_functions/test4.xsl
index aff4e326..bb7b36ae 100644
--- a/tests/fn_codepoint_equal/test1.xsl
+++ b/tests/sequence_functions/test4.xsl
@@ -4,18 +4,21 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
-        function. -->                             
+   <!-- use with test1_a.xml -->
+   
+   <!-- An XSLT stylesheet test, to test XPath 3.1 function 
+        fn:exists. -->                            
 
    <xsl:output method="xml" indent="yes"/>
    
-   <xsl:template match="/">
+   <xsl:template match="/info">
       <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>
+         <one><xsl:value-of select="exists(elem)"/></one>
+         <two><xsl:value-of select="exists(data/@val)"/></two>
+               
+         <three><xsl:value-of select="exists(elem2)"/></three>
+         <four><xsl:value-of select="exists(data/@val2)"/></four>
+         <five><xsl:value-of select="exists(elem3/@val)"/></five>
       </result>
    </xsl:template>
    
diff --git a/tests/fn_codepoint_equal/test1.xsl b/tests/sequence_functions/test5.xsl
similarity index 70%
copy from tests/fn_codepoint_equal/test1.xsl
copy to tests/sequence_functions/test5.xsl
index aff4e326..3424fe19 100644
--- a/tests/fn_codepoint_equal/test1.xsl
+++ b/tests/sequence_functions/test5.xsl
@@ -4,18 +4,22 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
-        function. -->                             
+   <!-- An XSLT stylesheet test case, to test XPath 3.1 function
+        fn:head.
+        
+        The fn:head function examples used within this stylesheet,
+        are borrowed from XPath 3.1 spec.     
+   -->                            
 
    <xsl:output method="xml" indent="yes"/>
    
+   <xsl:variable name="seq1" select="('a', 'b', 'c')"/>
+   
    <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>
+         <one><xsl:value-of select="head(1 to 5)"/></one>
+         <two><xsl:value-of select="head($seq1)"/></two>
+         <three><xsl:value-of select="head(())"/></three>
       </result>
    </xsl:template>
    
diff --git a/tests/fn_codepoint_equal/test1.xsl b/tests/sequence_functions/test6.xsl
similarity index 68%
copy from tests/fn_codepoint_equal/test1.xsl
copy to tests/sequence_functions/test6.xsl
index aff4e326..2d3c539f 100644
--- a/tests/fn_codepoint_equal/test1.xsl
+++ b/tests/sequence_functions/test6.xsl
@@ -4,18 +4,19 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
-        function. -->                             
+   <!-- use with test1_b.xml -->
+   
+   <!-- An XSLT stylesheet test, to test XPath 3.1 function 
+        fn:head. -->                             
 
    <xsl:output method="xml" indent="yes"/>
    
-   <xsl:template match="/">
+   <xsl:template match="/info">
       <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>
+         <one><xsl:copy-of select="head(*)"/></one>
+         <two><xsl:copy-of select="head(data/@*)"/></two>
+         <three><xsl:copy-of select="head(elem1)"/></three>
+         <four><xsl:copy-of select="head(elem1/@*)"/></four>
       </result>
    </xsl:template>
    
diff --git a/tests/fn_codepoint_equal/test1.xsl b/tests/sequence_functions/test7.xsl
similarity index 70%
copy from tests/fn_codepoint_equal/test1.xsl
copy to tests/sequence_functions/test7.xsl
index aff4e326..4588f32e 100644
--- a/tests/fn_codepoint_equal/test1.xsl
+++ b/tests/sequence_functions/test7.xsl
@@ -4,18 +4,19 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
-        function. -->                             
+   <!-- An XSLT stylesheet test, to test XPath 3.1 function 
+        fn:tail. -->                             
 
    <xsl:output method="xml" indent="yes"/>
    
+   <xsl:variable name="seq1" select="('a', 'b', 'c')"/>
+   
    <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>
+         <one><xsl:value-of select="tail(1 to 5)"/></one>
+         <two><xsl:value-of select="tail($seq1)"/></two>
+         <three><xsl:value-of select="tail('a')"/></three>
+         <four><xsl:value-of select="tail(())"/></four>
       </result>
    </xsl:template>
    
diff --git a/tests/fn_codepoint_equal/test1.xsl b/tests/sequence_functions/test8.xsl
similarity index 68%
copy from tests/fn_codepoint_equal/test1.xsl
copy to tests/sequence_functions/test8.xsl
index aff4e326..15ddf884 100644
--- a/tests/fn_codepoint_equal/test1.xsl
+++ b/tests/sequence_functions/test8.xsl
@@ -4,18 +4,17 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
-        function. -->                             
+   <!-- use with test1_c.xml -->
+   
+   <!-- An XSLT stylesheet test, to test XPath 3.1 function 
+        fn:tail. -->                             
 
    <xsl:output method="xml" indent="yes"/>
    
-   <xsl:template match="/">
+   <xsl:template match="/info">
       <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>
+         <one><xsl:copy-of select="tail(*[position() lt last()])"/></one>
+         <two><xsl:copy-of select="tail(data/@*)"/></two>
       </result>
    </xsl:template>
    
diff --git a/tests/fn_codepoint_equal/test1.xsl b/tests/sequence_functions/test9.xsl
similarity index 67%
copy from tests/fn_codepoint_equal/test1.xsl
copy to tests/sequence_functions/test9.xsl
index aff4e326..b262c4c7 100644
--- a/tests/fn_codepoint_equal/test1.xsl
+++ b/tests/sequence_functions/test9.xsl
@@ -4,18 +4,20 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- An XSLT stylesheet test, for the XPath 3.1 fn:codepoint-equal() 
-        function. -->                             
+   <!-- An XSLT stylesheet test, to test XPath 3.1 function 
+        fn:insert-before. -->                               
 
    <xsl:output method="xml" indent="yes"/>
    
+   <xsl:variable name="abc" select="('a', 'b', 'c')"/>
+   
    <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>
+         <one><xsl:value-of select="insert-before($abc, 0, 'z')"/></one>
+         <two><xsl:value-of select="insert-before($abc, 1, 'z')"/></two>
+         <three><xsl:value-of select="insert-before($abc, 2, 'z')"/></three>
+         <four><xsl:value-of select="insert-before($abc, 3, 'z')"/></four>
+         <five><xsl:value-of select="insert-before($abc, 4, 'z')"/></five>
       </result>
    </xsl:template>
    


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