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/06 10:37:08 UTC

[xalan-java] branch xalan-j_xslt3.0 updated: committing implementation of xpath 3.1 node comparison operators 'is', '<<', '>>', and few new related working test cases as well. also committing, few new working test cases for xpath 3.1 inline function item expressions.

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 fd384676 committing implementation of xpath 3.1 node comparison operators 'is', '<<', '>>', and few new related working test cases as well. also committing, few new working test cases for xpath 3.1 inline function item expressions.
     new 67b121bc Merge pull request #44 from mukulga/xalan-j_xslt3.0_mukul
fd384676 is described below

commit fd384676a9daef0ea6426be3d7c69935013078b5
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Sun Aug 6 16:01:48 2023 +0530

    committing implementation of xpath 3.1 node comparison operators 'is', '<<', '>>', and few new related working test cases as well. also committing, few new working test cases for xpath 3.1 inline function item expressions.
---
 src/org/apache/xpath/compiler/Compiler.java        | 36 ++++++++
 src/org/apache/xpath/compiler/OpCodes.java         | 23 ++++-
 src/org/apache/xpath/compiler/XPathParser.java     | 40 ++++++++-
 src/org/apache/xpath/objects/ResultSequence.java   | 14 +++-
 .../xpath/operations/NodeComparisonFollows.java    | 97 ++++++++++++++++++++++
 .../apache/xpath/operations/NodeComparisonIs.java  | 97 ++++++++++++++++++++++
 .../xpath/operations/NodeComparisonPrecede.java    | 97 ++++++++++++++++++++++
 tests/inline_function_expr/gold/test6.out          |  4 +
 tests/inline_function_expr/gold/test7.out          |  7 ++
 tests/inline_function_expr/test1_b.xml             |  9 ++
 tests/inline_function_expr/test1_c.xml             | 18 ++++
 tests/inline_function_expr/test6.xsl               | 41 +++++++++
 tests/inline_function_expr/test7.xsl               | 41 +++++++++
 tests/node_comparison/gold/test1.out               | 20 +++++
 tests/node_comparison/gold/test2.out               |  4 +
 tests/node_comparison/gold/test3.out               |  7 ++
 tests/node_comparison/test1.xsl                    | 55 ++++++++++++
 tests/node_comparison/test1_a.xml                  |  6 ++
 tests/node_comparison/test2.xsl                    | 40 +++++++++
 tests/node_comparison/test3.xsl                    | 49 +++++++++++
 .../xalan/xpath3/InlineFunctionItemExprTests.java  | 20 +++++
 ...ItemExprTests.java => NodeComparisonTests.java} | 46 +++-------
 tests/org/apache/xalan/xslt3/AllXsl3Tests.java     |  4 +-
 23 files changed, 734 insertions(+), 41 deletions(-)

diff --git a/src/org/apache/xpath/compiler/Compiler.java b/src/org/apache/xpath/compiler/Compiler.java
index 5a2029f6..307361ae 100644
--- a/src/org/apache/xpath/compiler/Compiler.java
+++ b/src/org/apache/xpath/compiler/Compiler.java
@@ -51,6 +51,9 @@ import org.apache.xpath.operations.Minus;
 import org.apache.xpath.operations.Mod;
 import org.apache.xpath.operations.Mult;
 import org.apache.xpath.operations.Neg;
+import org.apache.xpath.operations.NodeComparisonFollows;
+import org.apache.xpath.operations.NodeComparisonIs;
+import org.apache.xpath.operations.NodeComparisonPrecede;
 import org.apache.xpath.operations.NotEquals;
 import org.apache.xpath.operations.Operation;
 import org.apache.xpath.operations.Or;
@@ -160,6 +163,12 @@ public class Compiler extends OpMap
       expr = vcLe(opPos); break;
     case OpCodes.OP_VC_GE :
       expr = vcGe(opPos); break;
+    case OpCodes.OP_IS :
+      expr = nodeComparisonIs(opPos); break;
+    case OpCodes.OP_NC_PRECEDE :
+      expr = nodeComparisonPrecede(opPos); break;
+    case OpCodes.OP_NC_FOLLOWS :
+      expr = nodeComparisonFollows(opPos); break;
     case OpCodes.OP_LTE :
       expr = lte(opPos); break;
     case OpCodes.OP_LT :
@@ -412,6 +421,33 @@ public class Compiler extends OpMap
   {
     return compileOperation(new VcGe(), opPos);
   }
+  
+  /**
+   * Compile an XPath 3.1 node comparison 'is' operation.
+   *  
+   */
+  protected Expression nodeComparisonIs(int opPos) throws TransformerException
+  {
+    return compileOperation(new NodeComparisonIs(), opPos);
+  }
+  
+  /**
+   * Compile an XPath 3.1 node comparison '<<' operation.
+   *  
+   */
+  protected Expression nodeComparisonPrecede(int opPos) throws TransformerException
+  {
+    return compileOperation(new NodeComparisonPrecede(), opPos);
+  }
+  
+  /**
+   * Compile an XPath 3.1 node comparison '>>' operation.
+   *  
+   */
+  protected Expression nodeComparisonFollows(int opPos) throws TransformerException
+  {
+    return compileOperation(new NodeComparisonFollows(), opPos);
+  }
 
   /**
    * Compile a '>=' operation.
diff --git a/src/org/apache/xpath/compiler/OpCodes.java b/src/org/apache/xpath/compiler/OpCodes.java
index e7536927..5f9391d9 100644
--- a/src/org/apache/xpath/compiler/OpCodes.java
+++ b/src/org/apache/xpath/compiler/OpCodes.java
@@ -696,8 +696,29 @@ public class OpCodes
    * @xsl.usage advanced
    */
   public static final int OP_STR_CONCAT = 68;
+  
+  /**
+   * For XPath 3.1 node concatenation operator "is".
+   * 
+   * @xsl.usage advanced
+   */
+  public static final int OP_IS = 69;
+  
+  /**
+   * For XPath 3.1 node concatenation operator "<<".
+   * 
+   * @xsl.usage advanced
+   */
+  public static final int OP_NC_PRECEDE = 70;
+  
+  /**
+   * For XPath 3.1 node concatenation operator ">>".
+   * 
+   * @xsl.usage advanced
+   */
+  public static final int OP_NC_FOLLOWS = 71;
 
   /** The next free ID. Please keep this up to date. */
-  private static final int NEXT_FREE_ID = 69;
+  private static final int NEXT_FREE_ID = 72;
   
 }
diff --git a/src/org/apache/xpath/compiler/XPathParser.java b/src/org/apache/xpath/compiler/XPathParser.java
index f7718b44..9b8c9f5a 100644
--- a/src/org/apache/xpath/compiler/XPathParser.java
+++ b/src/org/apache/xpath/compiler/XPathParser.java
@@ -1082,7 +1082,7 @@ public class XPathParser
       fIsBeginParse = false;
       
       if (tokenIs("for")) {
-         // to check, whether XPath 'for' expression is a sub expression of another 
+         // To check, whether XPath 'for' expression is a sub expression of another 
          // XPath expression (for e.g, a 'for' expression could be a function 
          // argument).
          String prevTokenStr = getTokenRelative(-2);
@@ -1090,7 +1090,7 @@ public class XPathParser
          fForExpr = ForExpr(prevTokenStr);
       }
       else if (tokenIs("let")) {
-         // to check, whether XPath 'let' expression is a sub expression of another 
+         // To check, whether XPath 'let' expression is a sub expression of another 
          // XPath expression (for e.g, a 'let' expression could be a function 
          // argument).
          String prevTokenStr = getTokenRelative(-2);
@@ -1098,7 +1098,7 @@ public class XPathParser
          fLetExpr = LetExpr(prevTokenStr);
       }
       else if (tokenIs("some")) {
-         // to check, whether XPath quantified 'some' expression is a sub expression 
+         // To check, whether XPath quantified 'some' expression is a sub expression 
          // of another XPath expression (for e.g, the 'some' expression could be a 
          // function argument, or may be written within an XPath predicate).
          String prevTokenStr = getTokenRelative(-2);
@@ -1106,7 +1106,7 @@ public class XPathParser
          fQuantifiedExpr = QuantifiedExpr(prevTokenStr, QuantifiedExpr.SOME);
       }
       else if (tokenIs("every")) {
-         // to check, whether XPath quantified 'every' expression is a sub expression 
+         // To check, whether XPath quantified 'every' expression is a sub expression 
          // of another XPath expression (for e.g, an 'every' expression could be a 
          // function argument, or may be written within an XPath predicate).
          String prevTokenStr = getTokenRelative(-2);
@@ -1622,6 +1622,9 @@ public class XPathParser
    * | RelationalExpr 'le' AdditiveExpr
    * | RelationalExpr 'gt' AdditiveExpr
    * | RelationalExpr 'ge' AdditiveExpr
+   * | RelationalExpr 'is' AdditiveExpr
+   * | RelationalExpr '<<' AdditiveExpr
+   * | RelationalExpr '>>' AdditiveExpr
    *
    * @param addPos Position where expression is to be added, or -1 for append.
    *
@@ -1650,6 +1653,13 @@ public class XPathParser
           nextToken();
           insertOp(addPos, 2, OpCodes.OP_LTE);
         }
+        else if (tokenIs('<'))
+        {
+          // support for XPath 3.1 node comparison operator "<<"
+          
+          nextToken();
+          insertOp(addPos, 2, OpCodes.OP_NC_PRECEDE); 
+        }
         else
         {
           insertOp(addPos, 2, OpCodes.OP_LT);
@@ -1671,6 +1681,13 @@ public class XPathParser
           nextToken();
           insertOp(addPos, 2, OpCodes.OP_GTE);
         }
+        else if (tokenIs('>'))
+        {
+          // support for XPath 3.1 node comparison operator ">>"
+          
+          nextToken();
+          insertOp(addPos, 2, OpCodes.OP_NC_FOLLOWS);
+        }
         else
         {
           insertOp(addPos, 2, OpCodes.OP_GT);
@@ -1768,6 +1785,21 @@ public class XPathParser
 
           int op1 = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos;
 
+          addPos = RelationalExpr(addPos);
+          m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH,
+             m_ops.getOp(addPos + op1 + 1) + op1);
+          addPos += 2;
+      }
+      else if (tokenIs("is"))
+      {
+          // support for XPath 3.1 node comparison operator "is"
+          
+          nextToken();
+        
+          insertOp(addPos, 2, OpCodes.OP_IS);
+
+          int op1 = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos;
+
           addPos = RelationalExpr(addPos);
           m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH,
              m_ops.getOp(addPos + op1 + 1) + op1);
diff --git a/src/org/apache/xpath/objects/ResultSequence.java b/src/org/apache/xpath/objects/ResultSequence.java
index 22f22ca5..0e106c18 100644
--- a/src/org/apache/xpath/objects/ResultSequence.java
+++ b/src/org/apache/xpath/objects/ResultSequence.java
@@ -36,7 +36,7 @@ public class ResultSequence extends XObject
     // the underlying list object, to store items of this result sequence 
     private List<XObject> rsList = new ArrayList<XObject>();
     
-    /*
+    /**
      * Class constructor.
      */
     public ResultSequence() {}
@@ -62,7 +62,17 @@ public class ResultSequence extends XObject
         return rsList;   
     }
     
-    /*
+    /**
+     * Cast result object to a boolean.
+     *
+     * @return True if the size of this 'ResultSequence' object
+     * is greater than 0.
+     */
+    public boolean bool() {
+        return (rsList.size() > 0);       
+    }
+    
+    /**
      * Get the string value of this ResultSequence object.
      * 
      * This method, produces a default serialization of this
diff --git a/src/org/apache/xpath/operations/NodeComparisonFollows.java b/src/org/apache/xpath/operations/NodeComparisonFollows.java
new file mode 100644
index 00000000..07d49d56
--- /dev/null
+++ b/src/org/apache/xpath/operations/NodeComparisonFollows.java
@@ -0,0 +1,97 @@
+/*
+ * 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.operations;
+
+import org.apache.xml.dtm.DTM;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XBoolean;
+import org.apache.xpath.objects.XNodeSet;
+import org.apache.xpath.objects.XObject;
+
+/**
+ * The XPath 3.1 node comparison ">>" operation.
+ * 
+ * Ref : https://www.w3.org/TR/xpath-31/#id-node-comparisons
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class NodeComparisonFollows extends Operation
+{
+
+    private static final long serialVersionUID = -4609240318743840419L;
+
+    /**
+    * Apply the operation to two operands, and return the result.
+    *
+    *
+    * @param left non-null reference to the evaluated left operand.
+    * @param right non-null reference to the evaluated right operand.
+    *
+    * @return non-null reference to the XObject that represents the result of the operation.
+    *
+    * @throws javax.xml.transform.TransformerException
+    */
+   public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException
+   {
+       XObject result = null;
+       
+       XNodeSet lNodeSet = null;
+       XNodeSet rNodeSet = null;
+       
+       if (left instanceof XNodeSet) {
+          lNodeSet = (XNodeSet)left;
+          if (lNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : A sequence of more than one item is not "
+                                                                                  + "allowed as the first operand of an operator '>>'.");   
+          }
+       }
+       else {
+          throw new javax.xml.transform.TransformerException("XPTY0004 : The supplied item type of first "
+                                                                                  + "operand of an operator '>>' is not node().");    
+       }
+       
+       if (right instanceof XNodeSet) {
+          rNodeSet = (XNodeSet)right;
+          if (rNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : A sequence of more than one item is not "
+                                                                                  + "allowed as the second operand of an operator '>>'.");   
+          }  
+       }
+       else {
+          throw new javax.xml.transform.TransformerException("XPTY0004 : The supplied item type of second "
+                                                                                   + "operand of an operator '>>' is not node()."); 
+       }
+       
+       int lNodeHandle = lNodeSet.nextNode();
+       int rNodeHandle = rNodeSet.nextNode();
+       
+       if ((lNodeHandle != DTM.NULL) && (rNodeHandle != DTM.NULL)) {
+          result = (lNodeHandle > rNodeHandle) ? XBoolean.S_TRUE : XBoolean.S_FALSE;    
+       }
+       else {
+          // as per XPath 3.1 spec for the node comparison ">>" operator, if either operand 
+          // is an empty sequence the result of the comparison is an empty sequence.
+          result = new ResultSequence();     
+       }
+              
+       return result; 
+   }
+
+}
diff --git a/src/org/apache/xpath/operations/NodeComparisonIs.java b/src/org/apache/xpath/operations/NodeComparisonIs.java
new file mode 100644
index 00000000..f631a847
--- /dev/null
+++ b/src/org/apache/xpath/operations/NodeComparisonIs.java
@@ -0,0 +1,97 @@
+/*
+ * 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.operations;
+
+import org.apache.xml.dtm.DTM;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XBoolean;
+import org.apache.xpath.objects.XNodeSet;
+import org.apache.xpath.objects.XObject;
+
+/**
+ * The XPath 3.1 node comparison "is" operation.
+ * 
+ * Ref : https://www.w3.org/TR/xpath-31/#id-node-comparisons
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class NodeComparisonIs extends Operation
+{
+    
+    private static final long serialVersionUID = 7254558212157001252L;
+   
+    /**
+    * Apply the operation to two operands, and return the result.
+    *
+    *
+    * @param left non-null reference to the evaluated left operand.
+    * @param right non-null reference to the evaluated right operand.
+    *
+    * @return non-null reference to the XObject that represents the result of the operation.
+    *
+    * @throws javax.xml.transform.TransformerException
+    */
+   public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException
+   {
+       XObject result = null;
+       
+       XNodeSet lNodeSet = null;
+       XNodeSet rNodeSet = null;
+       
+       if (left instanceof XNodeSet) {
+          lNodeSet = (XNodeSet)left;
+          if (lNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : A sequence of more than one item is not "
+                                                                                  + "allowed as the first operand of an operator 'is'.");   
+          }
+       }
+       else {
+          throw new javax.xml.transform.TransformerException("XPTY0004 : The supplied item type of first "
+                                                                                  + "operand of an operator 'is' is not node().");    
+       }
+       
+       if (right instanceof XNodeSet) {
+          rNodeSet = (XNodeSet)right;
+          if (rNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : A sequence of more than one item is not "
+                                                                                  + "allowed as the second operand of an operator 'is'.");   
+          }  
+       }
+       else {
+          throw new javax.xml.transform.TransformerException("XPTY0004 : The supplied item type of second "
+                                                                                   + "operand of an operator 'is' is not node()."); 
+       }
+       
+       int lNodeHandle = lNodeSet.nextNode();
+       int rNodeHandle = rNodeSet.nextNode();
+       
+       if ((lNodeHandle != DTM.NULL) && (rNodeHandle != DTM.NULL)) {
+          result = (lNodeHandle == rNodeHandle) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
+       }
+       else {
+          // as per XPath 3.1 spec for the node comparison "is" operator, if either operand 
+          // is an empty sequence the result of the comparison is an empty sequence.
+          result = new ResultSequence();  
+       }
+       
+       return result; 
+   }
+
+}
diff --git a/src/org/apache/xpath/operations/NodeComparisonPrecede.java b/src/org/apache/xpath/operations/NodeComparisonPrecede.java
new file mode 100644
index 00000000..b078c177
--- /dev/null
+++ b/src/org/apache/xpath/operations/NodeComparisonPrecede.java
@@ -0,0 +1,97 @@
+/*
+ * 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.operations;
+
+import org.apache.xml.dtm.DTM;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XBoolean;
+import org.apache.xpath.objects.XNodeSet;
+import org.apache.xpath.objects.XObject;
+
+/**
+ * The XPath 3.1 node comparison "<<" operation.
+ * 
+ * Ref : https://www.w3.org/TR/xpath-31/#id-node-comparisons
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class NodeComparisonPrecede extends Operation
+{
+
+    private static final long serialVersionUID = 4063343086079759199L;
+
+    /**
+    * Apply the operation to two operands, and return the result.
+    *
+    *
+    * @param left non-null reference to the evaluated left operand.
+    * @param right non-null reference to the evaluated right operand.
+    *
+    * @return non-null reference to the XObject that represents the result of the operation.
+    *
+    * @throws javax.xml.transform.TransformerException
+    */
+   public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException
+   {
+       XObject result = null;
+       
+       XNodeSet lNodeSet = null;
+       XNodeSet rNodeSet = null;
+       
+       if (left instanceof XNodeSet) {
+          lNodeSet = (XNodeSet)left;
+          if (lNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : A sequence of more than one item is not "
+                                                                                  + "allowed as the first operand of an operator '<<'.");   
+          }
+       }
+       else {
+          throw new javax.xml.transform.TransformerException("XPTY0004 : The supplied item type of first "
+                                                                                  + "operand of an operator '<<' is not node().");    
+       }
+       
+       if (right instanceof XNodeSet) {
+          rNodeSet = (XNodeSet)right;
+          if (rNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : A sequence of more than one item is not "
+                                                                                  + "allowed as the second operand of an operator '<<'.");   
+          }  
+       }
+       else {
+          throw new javax.xml.transform.TransformerException("XPTY0004 : The supplied item type of second "
+                                                                                   + "operand of an operator '<<' is not node()."); 
+       }
+       
+       int lNodeHandle = lNodeSet.nextNode();
+       int rNodeHandle = rNodeSet.nextNode();
+       
+       if ((lNodeHandle != DTM.NULL) && (rNodeHandle != DTM.NULL)) {
+          result = (lNodeHandle < rNodeHandle) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
+       }
+       else {
+          // as per XPath 3.1 spec for the node comparison "<<" operator, if either operand 
+          // is an empty sequence the result of the comparison is an empty sequence.
+          result = new ResultSequence(); 
+       }
+              
+       return result; 
+   }
+
+}
diff --git a/tests/inline_function_expr/gold/test6.out b/tests/inline_function_expr/gold/test6.out
new file mode 100644
index 00000000..d6b42dbd
--- /dev/null
+++ b/tests/inline_function_expr/gold/test6.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <p>hello</p>
+  <p>there</p>
+</result>
diff --git a/tests/inline_function_expr/gold/test7.out b/tests/inline_function_expr/gold/test7.out
new file mode 100644
index 00000000..4a0b2cf4
--- /dev/null
+++ b/tests/inline_function_expr/gold/test7.out
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <p>hello</p>
+  <p>there</p>
+  <p>how</p>
+  <p>are</p>
+  <p>you</p>
+</result>
diff --git a/tests/inline_function_expr/test1_b.xml b/tests/inline_function_expr/test1_b.xml
new file mode 100644
index 00000000..5729e5c2
--- /dev/null
+++ b/tests/inline_function_expr/test1_b.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<temp>
+  <a>
+    <p>hello</p>
+  </a>
+  <b>
+    <p>there</p>
+  </b>
+</temp>
\ No newline at end of file
diff --git a/tests/inline_function_expr/test1_c.xml b/tests/inline_function_expr/test1_c.xml
new file mode 100644
index 00000000..59155228
--- /dev/null
+++ b/tests/inline_function_expr/test1_c.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<temp>
+  <a>
+    <p>hello</p>
+  </a>
+  <b>
+    <p>there</p>
+  </b>
+  <c>
+    <p>how</p>
+  </c>
+  <d>
+    <p>are</p>
+  </d>
+  <e>
+    <p>you</p>
+  </e>
+</temp>
\ No newline at end of file
diff --git a/tests/inline_function_expr/test6.xsl b/tests/inline_function_expr/test6.xsl
new file mode 100644
index 00000000..0db32d1b
--- /dev/null
+++ b/tests/inline_function_expr/test6.xsl
@@ -0,0 +1,41 @@
+<?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_b.xml -->
+   
+   <!-- An XSLT stylesheet to test, an XPath function item "inline function"
+        expression that does transformation of its argument's value and
+        generates XML complex content. -->                   
+
+   <xsl:output method="xml" indent="yes"/>
+   
+   <xsl:variable name="fnItem1" select="function ($nodeSet) { ($nodeSet[1]/p, $nodeSet[2]/p) }"/>
+      
+   <xsl:template match="/temp">
+      <result>
+        <xsl:copy-of select="$fnItem1(*)"/>
+      </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/inline_function_expr/test7.xsl b/tests/inline_function_expr/test7.xsl
new file mode 100644
index 00000000..3ee4a5d1
--- /dev/null
+++ b/tests/inline_function_expr/test7.xsl
@@ -0,0 +1,41 @@
+<?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_c.xml -->
+   
+   <!-- An XSLT stylesheet to test, an XPath function item "inline function"
+        expression that does transformation of its argument's value and
+        generates XML complex content. -->                 
+
+   <xsl:output method="xml" indent="yes"/>
+   
+   <xsl:variable name="fnItem1" select="function ($nodeSet) { for $a in $nodeSet return $a/p }"/>
+      
+   <xsl:template match="/temp">
+      <result>
+        <xsl:copy-of select="$fnItem1(*)"/>
+      </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/node_comparison/gold/test1.out b/tests/node_comparison/gold/test1.out
new file mode 100644
index 00000000..6235877c
--- /dev/null
+++ b/tests/node_comparison/gold/test1.out
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <val1>true</val1>
+  <val2>true</val2>
+  <val3>false</val3>
+  <val4>false</val4>
+  <snip/>
+  <val5>true</val5>
+  <val6>true</val6>
+  <val7>false</val7>
+  <val8>false</val8>
+  <val9>false</val9>
+  <val10>false</val10>
+  <snip/>
+  <val11>true</val11>
+  <val12>true</val12>
+  <val13>true</val13>
+  <val14>false</val14>
+  <val15>false</val15>
+  <val16>true</val16>
+</result>
diff --git a/tests/node_comparison/gold/test2.out b/tests/node_comparison/gold/test2.out
new file mode 100644
index 00000000..3462f2b7
--- /dev/null
+++ b/tests/node_comparison/gold/test2.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <a attr1="1"/>
+  <c attr1="4"/>
+</result>
diff --git a/tests/node_comparison/gold/test3.out b/tests/node_comparison/gold/test3.out
new file mode 100644
index 00000000..4dcc8506
--- /dev/null
+++ b/tests/node_comparison/gold/test3.out
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <a attr1="1"/>
+  <a attr1="1"/>
+  <a attr1="1"/>
+  <a attr1="1"/>
+  <b p="2" q="3"/>
+</result>
diff --git a/tests/node_comparison/test1.xsl b/tests/node_comparison/test1.xsl
new file mode 100644
index 00000000..9f5af100
--- /dev/null
+++ b/tests/node_comparison/test1.xsl
@@ -0,0 +1,55 @@
+<?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 to test, XPath node comparison
+        operators "is", "<<", ">>". -->                
+
+   <xsl:output method="xml" indent="yes"/>
+      
+   <xsl:template match="/temp">
+      <result>
+        <val1><xsl:value-of select="a is a"/></val1>
+        <val2><xsl:value-of select="b/@p is b/@p"/></val2>
+        <val3><xsl:value-of select="a is b"/></val3>        
+        <val4><xsl:value-of select="b/@p is b/@q"/></val4>
+        <snip/>
+        <val5><xsl:value-of select="a &lt;&lt; b"/></val5>
+        <val6><xsl:value-of select="a &lt;&lt; c"/></val6>
+        <val7><xsl:value-of select="b/@p &lt;&lt; a"/></val7>
+        <val8><xsl:value-of select="b &lt;&lt; a"/></val8>
+	    <val9><xsl:value-of select="c &lt;&lt; a"/></val9>
+        <val10><xsl:value-of select="b/@p &lt;&lt; a"/></val10>
+        <snip/>
+        <val11><xsl:value-of select="b &gt;&gt; a"/></val11>
+        <val12><xsl:value-of select="c &gt;&gt; a"/></val12>
+        <val13><xsl:value-of select="b/@p &gt;&gt; a"/></val13>
+        <val14><xsl:value-of select="a &gt;&gt; b"/></val14>
+	    <val15><xsl:value-of select="a &gt;&gt; c"/></val15>
+        <val16><xsl:value-of select="b/@p &gt;&gt; a"/></val16>
+      </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/node_comparison/test1_a.xml b/tests/node_comparison/test1_a.xml
new file mode 100644
index 00000000..972d49dd
--- /dev/null
+++ b/tests/node_comparison/test1_a.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<temp>
+  <a attr1="1"/>
+  <b p="2" q="3"/>
+  <c attr1="4"/>
+</temp>
diff --git a/tests/node_comparison/test2.xsl b/tests/node_comparison/test2.xsl
new file mode 100644
index 00000000..3b33db77
--- /dev/null
+++ b/tests/node_comparison/test2.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 -->
+   
+   <!-- use with test1_a.xml -->
+   
+   <!-- An XSLT stylesheet to test, XPath node comparison
+        operators "<<", ">>". -->                 
+
+   <xsl:output method="xml" indent="yes"/>
+      
+   <xsl:template match="/temp">
+      <result>
+         <xsl:copy-of select="a[. &lt;&lt; /temp/c]"/>
+         <xsl:copy-of select="c[. &gt;&gt; /temp/b]"/>
+         <xsl:copy-of select="b[. &gt;&gt; /temp/c]"/>
+      </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/node_comparison/test3.xsl b/tests/node_comparison/test3.xsl
new file mode 100644
index 00000000..613e7a8d
--- /dev/null
+++ b/tests/node_comparison/test3.xsl
@@ -0,0 +1,49 @@
+<?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 to test, XPath node comparison
+        operators "<<", ">>". -->                 
+
+   <xsl:output method="xml" indent="yes"/>
+      
+   <xsl:template match="/temp">
+      <result>         
+         <xsl:copy-of select="a[. &lt;&lt; following-sibling::c]"/>
+         <xsl:copy-of select="a[. &lt;&lt; following-sibling::c[1]]"/>
+         
+         <xsl:copy-of select="a[. &lt;&lt; following::c]"/>
+         <xsl:copy-of select="a[. &lt;&lt; following::c[1]]"/>
+         
+         <xsl:copy-of select="a[. &gt;&gt; following-sibling::c]"/>
+         <xsl:copy-of select="a[. &gt;&gt; following-sibling::c[1]]"/>
+         
+         <xsl:copy-of select="a[. &gt;&gt; following-sibling::p]"/>
+         
+         <xsl:copy-of select="b[. &gt;&gt; preceding-sibling::a]"/>
+      </result>
+   </xsl:template>
+   
+   <!--
+      * Licensed to the Apache Software Foundation (ASF) under one
+      * or more contributor license agreements. See the NOTICE file
+      * distributed with this work for additional information
+      * regarding copyright ownership. The ASF licenses this file
+      * to you under the Apache License, Version 2.0 (the  "License");
+      * you may not use this file except in compliance with the License.
+      * You may obtain a copy of the License at
+      *
+      *     http://www.apache.org/licenses/LICENSE-2.0
+      *
+      * Unless required by applicable law or agreed to in writing, software
+      * distributed under the License is distributed on an "AS IS" BASIS,
+      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      * See the License for the specific language governing permissions and
+      * limitations under the License.
+   -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/org/apache/xalan/xpath3/InlineFunctionItemExprTests.java b/tests/org/apache/xalan/xpath3/InlineFunctionItemExprTests.java
index e9b6eb3b..e8aabe90 100644
--- a/tests/org/apache/xalan/xpath3/InlineFunctionItemExprTests.java
+++ b/tests/org/apache/xalan/xpath3/InlineFunctionItemExprTests.java
@@ -97,5 +97,25 @@ public class InlineFunctionItemExprTests extends XslTransformTestsUtil {
         
         runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
     }
+    
+    @Test
+    public void xslInlineFunctionExprTest6() {
+        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 xslInlineFunctionExprTest7() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_c.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test7.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test7.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
 
 }
diff --git a/tests/org/apache/xalan/xpath3/InlineFunctionItemExprTests.java b/tests/org/apache/xalan/xpath3/NodeComparisonTests.java
similarity index 66%
copy from tests/org/apache/xalan/xpath3/InlineFunctionItemExprTests.java
copy to tests/org/apache/xalan/xpath3/NodeComparisonTests.java
index e9b6eb3b..3af0f592 100644
--- a/tests/org/apache/xalan/xpath3/InlineFunctionItemExprTests.java
+++ b/tests/org/apache/xalan/xpath3/NodeComparisonTests.java
@@ -23,18 +23,18 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
- * XPath 3.1 "function item" inline function expression test 
- * cases.
+ * XPath 3.1 tests, to test node comparison operators 
+ * "is", "<<", ">>".
  * 
  * @author Mukul Gandhi <mu...@apache.org>
  * 
  * @xsl.usage advanced
  */
-public class InlineFunctionItemExprTests extends XslTransformTestsUtil {        
+public class NodeComparisonTests extends XslTransformTestsUtil {        
     
-    private static final String XSL_TRANSFORM_INPUT_DIRPATH = XSLConstants.XSL_TRANSFORM_INPUT_DIRPATH_PREFIX + "inline_function_expr/";
+    private static final String XSL_TRANSFORM_INPUT_DIRPATH = XSLConstants.XSL_TRANSFORM_INPUT_DIRPATH_PREFIX + "node_comparison/";
     
-    private static final String XSL_TRANSFORM_GOLD_DIRPATH = XSLConstants.XSL_TRANSFORM_GOLD_DIRPATH_PREFIX + "inline_function_expr/gold/";
+    private static final String XSL_TRANSFORM_GOLD_DIRPATH = XSLConstants.XSL_TRANSFORM_GOLD_DIRPATH_PREFIX + "node_comparison/gold/";
 
     @BeforeClass
     public static void setUpBeforeClass() throws Exception {
@@ -49,8 +49,8 @@ public class InlineFunctionItemExprTests extends XslTransformTestsUtil {
     }
 
     @Test
-    public void xslInlineFunctionExprTest1() {
-        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1.xsl"; 
+    public void xslNodeComparisonTest1() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_a.xml"; 
         String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1.xsl";
         
         String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test1.out";                
@@ -59,41 +59,21 @@ public class InlineFunctionItemExprTests extends XslTransformTestsUtil {
     }
     
     @Test
-    public void xslInlineFunctionExprTest2() {
-        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test2.xsl"; 
+    public void xslNodeComparisonTest2() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_a.xml"; 
         String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test2.xsl";
         
-        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test1.out";                
-        
-        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
-    }
-    
-    @Test
-    public void xslInlineFunctionExprTest3() {
-        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test3.xsl"; 
-        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test3.xsl";
-        
-        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test1.out";                
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test2.out";                
         
         runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
     }
     
     @Test
-    public void xslInlineFunctionExprTest4() {
+    public void xslNodeComparisonTest3() {
         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 xslInlineFunctionExprTest5() {
-        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test5.xsl"; 
-        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test5.xsl";
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test3.xsl";
         
-        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test5.out";                
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test3.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 23f54c7d..423892f7 100644
--- a/tests/org/apache/xalan/xslt3/AllXsl3Tests.java
+++ b/tests/org/apache/xalan/xslt3/AllXsl3Tests.java
@@ -31,6 +31,7 @@ import org.apache.xalan.xpath3.ForExprTests;
 import org.apache.xalan.xpath3.IfExprTests;
 import org.apache.xalan.xpath3.InlineFunctionItemExprTests;
 import org.apache.xalan.xpath3.LetExprTests;
+import org.apache.xalan.xpath3.NodeComparisonTests;
 import org.apache.xalan.xpath3.QuantifiedExprTests;
 import org.apache.xalan.xpath3.RangeExprTests;
 import org.apache.xalan.xpath3.SequenceConstructorTests;
@@ -69,7 +70,8 @@ import org.junit.runners.Suite.SuiteClasses;
                 ForExprTests.class, LetExprTests.class, FnDistinctValuesTests.class,
                 TrignometricAndExponentialFunctionTests.class, BuiltinFunctionsNamespceTests.class,
                 SequenceConstructorTests.class, StringConcatExprTests.class, 
-                XsDurationComponentExtractionFunctionTests.class, XPathArithmeticOnDurationValuesTests.class })
+                XsDurationComponentExtractionFunctionTests.class, XPathArithmeticOnDurationValuesTests.class,
+                NodeComparisonTests.class })
 public class AllXsl3Tests {
 
 }


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