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/07/14 17:20:53 UTC

[xalan-java] branch xalan-j_xslt3.0 updated: committing implementation of xpath 3.1 quantified expressions 'some', 'every', with few new related working test cases as well. doing few minor refactoring as well within other parts of xalanj xslt 3.0 codebase.

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 3cdc9392 committing implementation of xpath 3.1 quantified expressions 'some', 'every', with few new related working test cases as well. doing few minor refactoring as well within other parts of xalanj xslt 3.0 codebase.
     new b092d392 Merge pull request #28 from mukulga/xalan-j_xslt3.0_mukul
3cdc9392 is described below

commit 3cdc939270ef0e60125cc6f38faaa8c88a39ce74
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Fri Jul 14 22:44:32 2023 +0530

    committing implementation of xpath 3.1 quantified expressions 'some', 'every', with few new related working test cases as well. doing few minor refactoring as well within other parts of xalanj xslt 3.0 codebase.
---
 src/org/apache/xpath/compiler/Compiler.java        |   7 +
 src/org/apache/xpath/compiler/OpCodes.java         |   6 +-
 src/org/apache/xpath/compiler/XPathParser.java     | 161 +++++++++++++++++----
 src/org/apache/xpath/composite/ForExpr.java        |  20 +--
 ...nding.java => ForQuantifiedExprVarBinding.java} |  11 +-
 src/org/apache/xpath/composite/IfExpr.java         |   4 +-
 .../{ForExpr.java => QuantifiedExpr.java}          | 157 +++++++++++++-------
 .../xpath/functions/DynamicFunctionCall.java       |   5 +-
 src/org/apache/xpath/objects/InlineFunction.java   |  26 ++--
 src/org/apache/xpath/objects/XObject.java          |  10 ++
 .../{xslt3 => xpath3}/QuantifiedExprTests.java     |  61 +++++++-
 tests/org/apache/xalan/xslt3/AllXsl3Tests.java     |   1 +
 tests/quantified_expr/gold/test10.out              |   4 +
 tests/quantified_expr/gold/test6.out               |   1 +
 tests/quantified_expr/gold/test7.out               |   1 +
 tests/quantified_expr/gold/test8.out               |   1 +
 tests/quantified_expr/gold/test9.out               |   1 +
 tests/quantified_expr/test1.xsl                    |   4 +-
 tests/quantified_expr/test1_d.xml                  |   9 ++
 tests/quantified_expr/test1_e.xml                  |   9 ++
 tests/quantified_expr/test1_f.xml                  |  33 +++++
 tests/quantified_expr/test2.xsl                    |   4 +-
 tests/quantified_expr/test3.xsl                    |   4 +-
 tests/quantified_expr/test4.xsl                    |   4 +-
 tests/quantified_expr/test5.xsl                    |   7 +-
 tests/quantified_expr/{test2.xsl => test6.xsl}     |  28 +---
 tests/quantified_expr/{test2.xsl => test7.xsl}     |  28 +---
 tests/quantified_expr/{test2.xsl => test8.xsl}     |  28 +---
 tests/quantified_expr/{test2.xsl => test9.xsl}     |  37 ++---
 29 files changed, 459 insertions(+), 213 deletions(-)

diff --git a/src/org/apache/xpath/compiler/Compiler.java b/src/org/apache/xpath/compiler/Compiler.java
index f45b6a1c..b3c2a2c8 100644
--- a/src/org/apache/xpath/compiler/Compiler.java
+++ b/src/org/apache/xpath/compiler/Compiler.java
@@ -131,6 +131,8 @@ public class Compiler extends OpMap
       expr = compile(opPos + 2); break;
     case OpCodes.OP_FOR_EXPR :
       expr = forExpr(opPos); break;
+    case OpCodes.OP_QUANTIFIED_EXPR :
+      expr = quantifiedExpr(opPos); break;
     case OpCodes.OP_IF_EXPR :
       expr = ifExpr(opPos); break;
     case OpCodes.OP_OR :
@@ -1180,6 +1182,11 @@ private static final boolean DEBUG = false;
       return XPathParser.fForExpr;
   }
   
+  Expression quantifiedExpr(int opPos) throws TransformerException
+  {
+      return XPathParser.fQuantifiedExpr;
+  }
+  
   Expression ifExpr(int opPos) throws TransformerException
   {
       return XPathParser.fIfExpr;
diff --git a/src/org/apache/xpath/compiler/OpCodes.java b/src/org/apache/xpath/compiler/OpCodes.java
index 81e096f2..4377cc37 100644
--- a/src/org/apache/xpath/compiler/OpCodes.java
+++ b/src/org/apache/xpath/compiler/OpCodes.java
@@ -682,9 +682,11 @@ public class OpCodes
   
   public static final int OP_FOR_EXPR = 63;
   
-  public static final int OP_IF_EXPR = 64;
+  public static final int OP_QUANTIFIED_EXPR = 64;
+  
+  public static final int OP_IF_EXPR = 65;
 
   /** The next free ID. Please keep this up to date. */
-  private static final int NEXT_FREE_ID = 65;
+  private static final int NEXT_FREE_ID = 66;
   
 }
diff --git a/src/org/apache/xpath/compiler/XPathParser.java b/src/org/apache/xpath/compiler/XPathParser.java
index e657f779..5b127c06 100644
--- a/src/org/apache/xpath/compiler/XPathParser.java
+++ b/src/org/apache/xpath/compiler/XPathParser.java
@@ -31,8 +31,9 @@ import org.apache.xalan.res.XSLMessages;
 import org.apache.xml.utils.PrefixResolver;
 import org.apache.xpath.XPathProcessorException;
 import org.apache.xpath.composite.ForExpr;
-import org.apache.xpath.composite.ForExprVarBinding;
+import org.apache.xpath.composite.ForQuantifiedExprVarBinding;
 import org.apache.xpath.composite.IfExpr;
+import org.apache.xpath.composite.QuantifiedExpr;
 import org.apache.xpath.domapi.XPathStylesheetDOM3Exception;
 import org.apache.xpath.functions.DynamicFunctionCall;
 import org.apache.xpath.objects.InlineFunction;
@@ -84,12 +85,13 @@ public class XPathParser
   /*
    * While parsing certain XPath 3.1 expressions, we use this constant string 
    * array to make parse decisions. The elements of this array are certain 
-   * XPath 'operator names', 'key words' and symbols that need this support.
+   * XPath language key words and symbols that need this support.
    */
-  private static final String[] XPATH_OP_ARR = new String[] {"div", "or", "and", "mod", "to", 
-                                                              "eq", "ne", "lt", "gt", "le", "ge", 
-                                                              "for", "in", "return", "if", "then", 
-                                                              "else", "-"};
+  private static final String[] XPATH_OP_ARR = new String[] 
+                                                     {"div", "or", "and", "mod", "to", 
+                                                      "eq", "ne", "lt", "gt", "le", "ge", 
+                                                      "for", "in", "return", "if", "then", 
+                                                      "else", "some", "every", "satisfies", "-"};
   
   private static final List<String> fXpathOpArrTokensList = Arrays.asList(XPATH_OP_ARR);
   
@@ -105,6 +107,8 @@ public class XPathParser
   
   static IfExpr fIfExpr = null;
   
+  static QuantifiedExpr fQuantifiedExpr = null;
+  
   /**
    * The parser constructor.
    */
@@ -159,7 +163,7 @@ public class XPathParser
 	try {
 
       nextToken();
-      Expr();
+      ExprSingle();
 
       if (null != m_token)
       {
@@ -888,23 +892,41 @@ public class XPathParser
 
   /**
    *
-   *
-   * Expr  ::=  ForExpr
-   *   | IfExpr 
-   *   | OrExpr
+   * Expr   ::=  ExprSingle ("," ExprSingle)*
+   * 
+   * ExprSingle  ::=  ForExpr
+   *       | QuantifiedExpr
+   *       | IfExpr 
+   *       | OrExpr
    *
    * @throws javax.xml.transform.TransformerException
    */
-  protected void Expr() throws javax.xml.transform.TransformerException
+  protected void ExprSingle() throws javax.xml.transform.TransformerException
   {
       if (tokenIs("for")) {
-         // to check, whether xpath 'for' expression is a sub expression of another 
-         // xpath expression (for e.g, a 'for' expression could be a function 
+         // 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);
          
          fForExpr = ForExpr(prevTokenStr);
       }
+      else if (tokenIs("some")) {
+         // 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);
+         
+         fQuantifiedExpr = QuantifiedExpr(prevTokenStr, QuantifiedExpr.SOME);
+      }
+      else if (tokenIs("every")) {
+         // 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);
+         
+         fQuantifiedExpr = QuantifiedExpr(prevTokenStr, QuantifiedExpr.EVERY);
+      }
       else if (tokenIs("if")) {         
          fIfExpr = IfExpr();
       }
@@ -923,7 +945,8 @@ public class XPathParser
       
       ForExpr forExpr = new ForExpr();
       
-      List<ForExprVarBinding> forExprVarBindingList = new  ArrayList<ForExprVarBinding>();
+      List<ForQuantifiedExprVarBinding> forExprVarBindingList = new  
+                                                           ArrayList<ForQuantifiedExprVarBinding>();
       
       while (!tokenIs("return") && m_token != null)
       {
@@ -950,7 +973,7 @@ public class XPathParser
           String varBindingXpathStr = getXPathStrFromComponentParts(
                                                                 bindingXPathExprStrPartsList);
           
-          ForExprVarBinding forExprVarBinding = new ForExprVarBinding();
+          ForQuantifiedExprVarBinding forExprVarBinding = new ForQuantifiedExprVarBinding();
           forExprVarBinding.setVarName(bindingVarName);
           forExprVarBinding.setXpathExprStr(varBindingXpathStr);
           
@@ -992,6 +1015,91 @@ public class XPathParser
       return forExpr;
   }
   
+  protected QuantifiedExpr QuantifiedExpr(String prevTokenStrBeforeQuantifier, int quantifierExprType) 
+                                                              throws javax.xml.transform.TransformerException
+  {
+      int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH);
+      
+      nextToken();
+      
+      insertOp(opPos, 2, OpCodes.OP_QUANTIFIED_EXPR);
+      
+      QuantifiedExpr quantifiedExpr = new QuantifiedExpr();
+      quantifiedExpr.setCurrentXPathQuantifier(quantifierExprType);
+      
+      List<ForQuantifiedExprVarBinding> quantifiedExprVarBindingList = new 
+                                                           ArrayList<ForQuantifiedExprVarBinding>();
+      
+      while (!tokenIs("satisfies") && m_token != null)
+      {
+          String bindingVarName = null;
+          
+          if (quantifiedExprVarBindingList.size() > 0 && tokenIs(',')) {
+             nextToken();    
+          }
+          
+          if (tokenIs('$')) {
+              nextToken();              
+              bindingVarName = m_token;              
+              nextToken();              
+              consumeExpected("in");                            
+          }
+          
+          List<String> bindingXPathExprStrPartsList = new ArrayList<String>();
+          
+          while (!(tokenIs(',') || tokenIs("satisfies")) && m_token != null) {
+             bindingXPathExprStrPartsList.add(m_token);
+             nextToken();
+          }
+          
+          String varBindingXpathStr = getXPathStrFromComponentParts(
+                                                                bindingXPathExprStrPartsList);
+          
+          ForQuantifiedExprVarBinding quantifiedExprVarBinding = new ForQuantifiedExprVarBinding();
+          quantifiedExprVarBinding.setVarName(bindingVarName);
+          quantifiedExprVarBinding.setXpathExprStr(varBindingXpathStr);
+          
+          quantifiedExprVarBindingList.add(quantifiedExprVarBinding);
+          
+          if (tokenIs("satisfies")) {
+             break; 
+          }
+      }      
+      
+      consumeExpected("satisfies");
+      
+      List<String> xPathTestExprStrPartsList = new ArrayList<String>();
+      
+      while (m_token != null) {
+         if (tokenIs(')')) {            
+            if ((getTokenRelative(0) == null) && "(".equals(prevTokenStrBeforeQuantifier)) {
+               break;    
+            }
+            else {
+               xPathTestExprStrPartsList.add(m_token);
+               nextToken();
+            }
+         }
+         else if (fIsXpathPredicateParsingActive && tokenIs(']')) {
+            break;    
+         }
+         else {
+            xPathTestExprStrPartsList.add(m_token);
+            nextToken();
+         }
+      }
+      
+      String xPathTestExprStr = getXPathStrFromComponentParts(xPathTestExprStrPartsList);
+      
+      quantifiedExpr.setQuantifiedExprVarBindingList(quantifiedExprVarBindingList);
+      quantifiedExpr.setQuantifierTestXPathStr(xPathTestExprStr);
+      
+      m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH,
+                                            m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos);
+      
+      return quantifiedExpr;
+  }
+  
   protected IfExpr IfExpr() throws javax.xml.transform.TransformerException
   {
       int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH);
@@ -1537,7 +1645,7 @@ public class XPathParser
     int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH);
 
     appendOp(2, OpCodes.OP_STRING);
-    Expr();
+    ExprSingle();
 
     m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH,
       m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos);
@@ -1557,7 +1665,7 @@ public class XPathParser
     int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH);
 
     appendOp(2, OpCodes.OP_BOOL);
-    Expr();
+    ExprSingle();
 
     int opLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos;
 
@@ -1583,7 +1691,7 @@ public class XPathParser
     int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH);
 
     appendOp(2, OpCodes.OP_NUMBER);
-    Expr();
+    ExprSingle();
 
     m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH,
       m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos);
@@ -1871,7 +1979,7 @@ public class XPathParser
     {
       nextToken();
       appendOp(2, OpCodes.OP_GROUP);
-      Expr();
+      ExprSingle();
       consumeExpected(')');
 
       m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH,
@@ -1999,7 +2107,7 @@ public class XPathParser
     int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH);
 
     appendOp(2, OpCodes.OP_ARGUMENT);
-    Expr();
+    ExprSingle();
 
     m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH,
       m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos);
@@ -2465,12 +2573,11 @@ public class XPathParser
 
     if (tokenIs('['))
     {
-      fIsXpathPredicateParsingActive = true;
-      
+      fIsXpathPredicateParsingActive = true;      
       nextToken();
-      PredicateExpr();      
-      fIsXpathPredicateParsingActive = false;      
-      consumeExpected(']');                  
+      PredicateExpr();
+      consumeExpected(']');      
+      fIsXpathPredicateParsingActive = false;
     }
   }
 
@@ -2487,7 +2594,7 @@ public class XPathParser
     int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH);
 
     appendOp(2, OpCodes.OP_PREDICATE);
-    Expr();
+    ExprSingle();
 
     // Terminate for safety.
     m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.ENDOP);
diff --git a/src/org/apache/xpath/composite/ForExpr.java b/src/org/apache/xpath/composite/ForExpr.java
index 23f07c49..a5d581e2 100644
--- a/src/org/apache/xpath/composite/ForExpr.java
+++ b/src/org/apache/xpath/composite/ForExpr.java
@@ -38,14 +38,14 @@ import org.apache.xpath.objects.XNodeSet;
 import org.apache.xpath.objects.XObject;
 
 /*
- * The XalanJ xpath parser, creates and populates an object of this class, 
+ * The XalanJ XPath parser, creates and populates an object of this class, 
  * as a representation of XPath 3.1 "for" expression.
  * 
  * The XPath 3.1 spec, defines "for" expression with following grammar,
  * 
- *  ForExpr               ::=      SimpleForClause "return" ExprSingle 
- *  SimpleForClause       ::=      "for" SimpleForBinding ("," SimpleForBinding)*  
- *  SimpleForBinding      ::=      "$" VarName "in" ExprSingle
+ *   ForExpr               ::=      SimpleForClause "return" ExprSingle 
+ *   SimpleForClause       ::=      "for" SimpleForBinding ("," SimpleForBinding)*  
+ *   SimpleForBinding      ::=      "$" VarName "in" ExprSingle
  *    
  *  Ref : https://www.w3.org/TR/xpath-31/#id-for-expressions
  * 
@@ -57,8 +57,8 @@ public class ForExpr extends Expression {
     
     private static final long serialVersionUID = -7289739978026057248L;
 
-    private List<ForExprVarBinding> fForExprVarBindingList = new 
-                                                    ArrayList<ForExprVarBinding>();
+    private List<ForQuantifiedExprVarBinding> fForExprVarBindingList = new 
+                                                    ArrayList<ForQuantifiedExprVarBinding>();
     
     private String fReturnExprXPathStr = null;
     
@@ -99,11 +99,11 @@ public class ForExpr extends Expression {
        return false;
     }
 
-    public List<ForExprVarBinding> getForExprVarBindingList() {
+    public List<ForQuantifiedExprVarBinding> getForExprVarBindingList() {
         return fForExprVarBindingList;
     }
 
-    public void setForExprVarBindingList(List<ForExprVarBinding> forExprVarBindingList) {
+    public void setForExprVarBindingList(List<ForQuantifiedExprVarBinding> forExprVarBindingList) {
         this.fForExprVarBindingList = forExprVarBindingList;
     }
 
@@ -131,7 +131,7 @@ public class ForExpr extends Expression {
         Map<QName, XObject> forExprVarBindingMap = xctxt.getXPathVarMap();
         
         if (listIter.hasNext()) {           
-           ForExprVarBinding forExprVarBinding = (ForExprVarBinding)listIter.next();            
+           ForQuantifiedExprVarBinding forExprVarBinding = (ForQuantifiedExprVarBinding)listIter.next();            
             
            // evaluate the current, variable binding xpath expression
            
@@ -197,7 +197,7 @@ public class ForExpr extends Expression {
         }
         else {
             // this else clause, actually evaluates the current XPath 'for' expression's 
-            // 'return' expression.
+            // 'return' expression clause.
             
             if (fVars != null) {              
                returnExprXpath.fixupVariables(fVars, fGlobalsSize);
diff --git a/src/org/apache/xpath/composite/ForExprVarBinding.java b/src/org/apache/xpath/composite/ForQuantifiedExprVarBinding.java
similarity index 80%
rename from src/org/apache/xpath/composite/ForExprVarBinding.java
rename to src/org/apache/xpath/composite/ForQuantifiedExprVarBinding.java
index 5b83c297..fd4d40ab 100644
--- a/src/org/apache/xpath/composite/ForExprVarBinding.java
+++ b/src/org/apache/xpath/composite/ForQuantifiedExprVarBinding.java
@@ -18,16 +18,17 @@ package org.apache.xpath.composite;
 
 /*
  * An object of this class, is used to store information about
- * XPath 3.1 "for" expression's single variable binding (i.e, run-time
- * information details related to the grammar fragment 
- * "$" VarName "in" ExprSingle for a particular XPath "for" expression
- * that's currently being evaluated). 
+ * XPath 3.1 "for" expression or "quantified expression" 
+ * (i.e, 'some', 'every')'s single variable binding (i.e, 
+ * run-time information details related to the grammar fragment 
+ * "$" VarName "in" ExprSingle for a particular XPath "for" or 
+ * "quantified expression" that's currently been evaluated). 
  *  
  * @author Mukul Gandhi <mu...@apache.org>
  * 
  * @xsl.usage advanced
  */
-public class ForExprVarBinding {
+public class ForQuantifiedExprVarBinding {
     
     private String fVarName = null;
     
diff --git a/src/org/apache/xpath/composite/IfExpr.java b/src/org/apache/xpath/composite/IfExpr.java
index e096d490..3dabbc47 100644
--- a/src/org/apache/xpath/composite/IfExpr.java
+++ b/src/org/apache/xpath/composite/IfExpr.java
@@ -29,12 +29,12 @@ import org.apache.xpath.XPathVisitor;
 import org.apache.xpath.objects.XObject;
 
 /*
- * The XalanJ xpath parser, creates and populates an object of this class, 
+ * The XalanJ XPath parser, creates and populates an object of this class, 
  * as a representation of XPath 3.1 "if" conditional expression.
  * 
  * The XPath 3.1 spec, defines "if" expression with following grammar,
  * 
- * IfExpr   ::=   "if" "(" Expr ")" "then" ExprSingle "else" ExprSingle
+ *   IfExpr   ::=   "if" "(" Expr ")" "then" ExprSingle "else" ExprSingle
  * 
  * Ref : https://www.w3.org/TR/xpath-31/#id-conditionals
  * 
diff --git a/src/org/apache/xpath/composite/ForExpr.java b/src/org/apache/xpath/composite/QuantifiedExpr.java
similarity index 51%
copy from src/org/apache/xpath/composite/ForExpr.java
copy to src/org/apache/xpath/composite/QuantifiedExpr.java
index 23f07c49..b644979c 100644
--- a/src/org/apache/xpath/composite/ForExpr.java
+++ b/src/org/apache/xpath/composite/QuantifiedExpr.java
@@ -34,33 +34,42 @@ import org.apache.xpath.XPath;
 import org.apache.xpath.XPathContext;
 import org.apache.xpath.XPathVisitor;
 import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XBoolean;
 import org.apache.xpath.objects.XNodeSet;
 import org.apache.xpath.objects.XObject;
+import org.apache.xpath.xs.types.XSBoolean;
 
 /*
- * The XalanJ xpath parser, creates and populates an object of this class, 
- * as a representation of XPath 3.1 "for" expression.
+ * The XalanJ XPath parser, creates and populates an object of this class, 
+ * as a representation of XPath 3.1 quantified expression.
  * 
- * The XPath 3.1 spec, defines "for" expression with following grammar,
+ * The XPath 3.1 spec, defines quantified expressions with following grammar,
  * 
- *  ForExpr               ::=      SimpleForClause "return" ExprSingle 
- *  SimpleForClause       ::=      "for" SimpleForBinding ("," SimpleForBinding)*  
- *  SimpleForBinding      ::=      "$" VarName "in" ExprSingle
+ *   QuantifiedExpr   ::=   ("some" | "every") "$" VarName "in" ExprSingle ("," "$" VarName "in" 
+ *                                                   ExprSingle)* "satisfies" ExprSingle
  *    
- *  Ref : https://www.w3.org/TR/xpath-31/#id-for-expressions
+ *  Ref : https://www.w3.org/TR/xpath-31/#id-quantified-expressions
  * 
  * @author Mukul Gandhi <mu...@apache.org>
  * 
  * @xsl.usage advanced
  */
-public class ForExpr extends Expression {
-    
-    private static final long serialVersionUID = -7289739978026057248L;
+public class QuantifiedExpr extends Expression {
 
-    private List<ForExprVarBinding> fForExprVarBindingList = new 
-                                                    ArrayList<ForExprVarBinding>();
+    private static final long serialVersionUID = -3073535420126040669L;
+    
+    // constant value, denoting XPath quantified expression "some" 
+    public static final int SOME = 0;
+    
+    // constant value, denoting XPath quantified expression "every"
+    public static final int EVERY = 1;
+    
+    private int fCurrentXPathQuantifier;
     
-    private String fReturnExprXPathStr = null;
+    private List<ForQuantifiedExprVarBinding> fQuantifiedExprVarBindingList = new 
+                                                        ArrayList<ForQuantifiedExprVarBinding>();
+
+    private String fQuantifierTestXPathStr = null;
     
     // the following two fields of this class, are used during 
     // XPath.fixupVariables(..) action as performed within object of 
@@ -72,55 +81,96 @@ public class ForExpr extends Expression {
     public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) {
        // no op
     }
-    
+
     @Override
     public XObject execute(XPathContext xctxt) throws TransformerException {
-       ResultSequence resultSeq = new ResultSequence();
-       
-       SourceLocator srcLocator = xctxt.getSAXLocator();
-       
-       XPath returnExprXpath = new XPath(fReturnExprXPathStr, srcLocator, null, XPath.SELECT, null);
-       
-       resultSeq = getForExpressionEvalResult(fForExprVarBindingList.listIterator(), 
-                                                                            returnExprXpath, xctxt);
-       m_xpathVarList.clear();
-       
-       return resultSeq;
+        XObject quantifiedExprResult = null;
+        
+        SourceLocator srcLocator = xctxt.getSAXLocator();
+        
+        XPath quantifiedExprXpath = new XPath(fQuantifierTestXPathStr, srcLocator, null, XPath.SELECT, null);
+        
+        ResultSequence resultSequence = getQuantifiedExpressionEvalResult(fQuantifiedExprVarBindingList.listIterator(), 
+                                                                                                 quantifiedExprXpath, xctxt);
+        m_xpathVarList.clear();
+        
+        boolean isEvalResultDecided = false;
+        
+        for (int idx = 0; idx < resultSequence.size(); idx++) {
+           XObject xsObject = resultSequence.item(idx);
+           XSBoolean xsBoolean = (XSBoolean)xsObject;
+           
+           if (fCurrentXPathQuantifier == SOME) {
+              if (xsBoolean.value()) {
+                 quantifiedExprResult = XBoolean.S_TRUE;
+                 isEvalResultDecided = true;
+                 break;      
+              }
+           }
+           else {
+              if (!xsBoolean.value()) {
+                 quantifiedExprResult = XBoolean.S_FALSE;
+                 isEvalResultDecided = true;
+                 break;     
+              }   
+           }
+        }
+        
+        if (!isEvalResultDecided) {
+           if (fCurrentXPathQuantifier == SOME) {
+              quantifiedExprResult = XBoolean.S_FALSE;    
+           }
+           else {
+              quantifiedExprResult = XBoolean.S_TRUE;    
+           }
+        }
+        
+        return quantifiedExprResult;
     }
 
     @Override
     public void fixupVariables(Vector vars, int globalsSize) {
        fVars = (Vector)(vars.clone());
-       fGlobalsSize = globalsSize; 
+       fGlobalsSize = globalsSize;
     }
 
     @Override
-    public boolean deepEquals(Expression expr) {        
+    public boolean deepEquals(Expression expr) {
        return false;
     }
 
-    public List<ForExprVarBinding> getForExprVarBindingList() {
-        return fForExprVarBindingList;
+    public int getCurrentXPathQuantifier() {
+        return fCurrentXPathQuantifier;
+    }
+
+    public void setCurrentXPathQuantifier(int fCurrentXPathQuantifier) {
+        this.fCurrentXPathQuantifier = fCurrentXPathQuantifier;
     }
 
-    public void setForExprVarBindingList(List<ForExprVarBinding> forExprVarBindingList) {
-        this.fForExprVarBindingList = forExprVarBindingList;
+    public List<ForQuantifiedExprVarBinding> getQuantifiedExprVarBindingList() {
+        return fQuantifiedExprVarBindingList;
     }
 
-    public String getReturnExprXPathStr() {
-        return fReturnExprXPathStr;
+    public void setQuantifiedExprVarBindingList(List<ForQuantifiedExprVarBinding> 
+                                                                      fQuantifiedExprVarBindingList) {
+        this.fQuantifiedExprVarBindingList = fQuantifiedExprVarBindingList;
     }
 
-    public void setReturnExprXPathStr(String returnExprXPathStr) {
-        this.fReturnExprXPathStr = returnExprXPathStr;
+    public String getQuantifierTestXPathStr() {
+        return fQuantifierTestXPathStr;
+    }
+
+    public void setQuantifierTestXPathStr(String fQuantifierTestXPathStr) {
+        this.fQuantifierTestXPathStr = fQuantifierTestXPathStr;
     }
     
     /*
-     * This method, does all the evaluations needed to determine the final evaluation result 
-     * of the XPath 'for' expression, returned as a 'ResultSequence' object.
+     * This method, does the evaluations needed to determine the evaluation result 
+     * of the XPath quantified expression, returned as an 'ResultSequence' object 
+     * instance.
      */
-    private ResultSequence getForExpressionEvalResult(ListIterator listIter, 
-                                                                     XPath returnExprXpath, 
+    private ResultSequence getQuantifiedExpressionEvalResult(ListIterator listIter, 
+                                                                     XPath quantifiedExprXpath, 
                                                                      XPathContext xctxt) throws TransformerException {
         ResultSequence resultSeq = new ResultSequence();
         
@@ -128,15 +178,15 @@ public class ForExpr extends Expression {
         
         int contextNode = xctxt.getContextNode();
         
-        Map<QName, XObject> forExprVarBindingMap = xctxt.getXPathVarMap();
+        Map<QName, XObject> quantifiedExprVarBindingMap = xctxt.getXPathVarMap();
         
         if (listIter.hasNext()) {           
-           ForExprVarBinding forExprVarBinding = (ForExprVarBinding)listIter.next();            
+           ForQuantifiedExprVarBinding quantifiedExprVarBinding = (ForQuantifiedExprVarBinding)listIter.next();            
             
            // evaluate the current, variable binding xpath expression
            
-           String varName = forExprVarBinding.getVarName();
-           String varBindingXPathStr = forExprVarBinding.getXpathExprStr();
+           String varName = quantifiedExprVarBinding.getVarName();
+           String varBindingXPathStr = quantifiedExprVarBinding.getXpathExprStr();
            
            XPath varBindingXpath = new XPath(varBindingXPathStr, srcLocator, null, XPath.SELECT, null);
            if (fVars != null) {
@@ -165,7 +215,7 @@ public class ForExpr extends Expression {
                xsObjResultSeq = (ResultSequence)xsObj;
            }
            else {
-              // assuming here that, 'for' expression's variable binding XPath expression 
+              // assuming here that, quantified expression's variable binding XPath expression 
               // evaluation, returned a singleton value.
               xsObjResultSeq.add(xsObj);
            }
@@ -177,14 +227,14 @@ public class ForExpr extends Expression {
            }
            
            // for each xdm item within sequence object 'xsObjResultSeq' (which is the 
-           // result of variable binding xpath expression's evaluation), bind the 'for' 
-           // expression range variable in turn to that item.
+           // result of variable binding xpath expression's evaluation), bind the 
+           // quantifier expression's binding variable in turn to that item.
            for (int idx = 0; idx < xsObjResultSeq.size(); idx++) {
                XObject xdmItem = xsObjResultSeq.item(idx);
                              
-               forExprVarBindingMap.put(new QName(varName), xdmItem);
+               quantifiedExprVarBindingMap.put(new QName(varName), xdmItem);
                
-               ResultSequence res = getForExpressionEvalResult(listIter, returnExprXpath, xctxt);
+               ResultSequence res = getQuantifiedExpressionEvalResult(listIter, quantifiedExprXpath, xctxt);
                // append xdm items of sequence 'res', to the final sequence object 'resultSeq'   
                for (int idx1 = 0; idx1 < res.size(); idx1++) {
                   resultSeq.add(res.item(idx1));    
@@ -196,15 +246,16 @@ public class ForExpr extends Expression {
            return resultSeq;
         }
         else {
-            // this else clause, actually evaluates the current XPath 'for' expression's 
-            // 'return' expression.
+            // this else clause, actually evaluates the current XPath quantified expression's 
+            // 'satisfies' expression clause.
             
             if (fVars != null) {              
-               returnExprXpath.fixupVariables(fVars, fGlobalsSize);
+               quantifiedExprXpath.fixupVariables(fVars, fGlobalsSize);
             }
             
-            XObject retExprValue = returnExprXpath.execute(xctxt, contextNode, null);
-            resultSeq.add(retExprValue);
+            XObject quantifiedTestExprValue = quantifiedExprXpath.execute(xctxt, contextNode, null);            
+            
+            resultSeq.add(new XSBoolean(quantifiedTestExprValue.bool()));
             
             return resultSeq; 
         }
diff --git a/src/org/apache/xpath/functions/DynamicFunctionCall.java b/src/org/apache/xpath/functions/DynamicFunctionCall.java
index 208204a3..c0b974f8 100644
--- a/src/org/apache/xpath/functions/DynamicFunctionCall.java
+++ b/src/org/apache/xpath/functions/DynamicFunctionCall.java
@@ -34,9 +34,8 @@ import org.apache.xpath.objects.InlineFunction;
 import org.apache.xpath.objects.XObject;
 
 /*
- * The XalanJ xpath parser, creates and populates an object of 
- * this class, as a representation of XPath 3.1 dynamic 
- * function call.
+ * The XalanJ XPath parser, creates and populates an object of this class, 
+ * as a representation of XPath 3.1 dynamic function call.
  * 
  * Ref : https://www.w3.org/TR/xpath-31/#id-dynamic-function-invocation
  * 
diff --git a/src/org/apache/xpath/objects/InlineFunction.java b/src/org/apache/xpath/objects/InlineFunction.java
index 766d5071..9ed61fbc 100644
--- a/src/org/apache/xpath/objects/InlineFunction.java
+++ b/src/org/apache/xpath/objects/InlineFunction.java
@@ -23,24 +23,24 @@ import org.apache.xpath.ExpressionOwner;
 import org.apache.xpath.XPathVisitor;
 
 /*
- * The XalanJ xpath parser, creates and populates an object of this 
- * class, as a representation of XPath 3.1 function item "inline 
- * function" definition within XPath expressions.
+ * The XalanJ XPath parser, creates and populates an object of this class, 
+ * as a representation of XPath 3.1 function item "inline function" definition 
+ * within XPath expressions.
  * 
- * The XPath 3.1 spec, defines function item "inline function" XPath 
- * expressions with following grammar,
+ * The XPath 3.1 spec, defines function item "inline function" XPath expressions 
+ * with following grammar,
+ *
+ *   InlineFunctionExpr        ::=  "function" "(" ParamList? ")" ("as" SequenceType)? 
+ *                                                                             FunctionBody
 
-   InlineFunctionExpr        ::=  "function" "(" ParamList? ")" ("as" SequenceType)? FunctionBody
+ *   ParamList                 ::=   Param ("," Param)*
 
-   ParamList                 ::=   Param ("," Param)*
+ *   Param                     ::=   "$" EQName TypeDeclaration?
 
-   Param                     ::=   "$" EQName TypeDeclaration?
+ *   FunctionBody              ::=   EnclosedExpr
 
-   FunctionBody              ::=   EnclosedExpr
-
-   EnclosedExpr              ::=   "{" Expr? "}"
-   
- * 
+ *   EnclosedExpr              ::=   "{" Expr? "}"
+    
  * @author Mukul Gandhi <mu...@apache.org>
  *   
  * @xsl.usage advanced 
diff --git a/src/org/apache/xpath/objects/XObject.java b/src/org/apache/xpath/objects/XObject.java
index 1fc75f6f..86d6de40 100644
--- a/src/org/apache/xpath/objects/XObject.java
+++ b/src/org/apache/xpath/objects/XObject.java
@@ -828,6 +828,16 @@ public class XObject extends Expression implements Serializable, Cloneable
     else if ((this instanceof XSDate) && (obj2 instanceof XSDate)) {
        return ((XSDate)this).equals((XSDate)obj2);    
     }
+    else if ((this instanceof XSInteger) && (obj2 instanceof XNumber)) {
+       double lDouble = ((XSInteger)this).doubleValue();
+       double rDouble = ((XNumber)obj2).num();
+       return (lDouble == rDouble); 
+    }
+    else if ((this instanceof XNumber) && (obj2 instanceof XSInteger)) {
+       double lDouble = ((XNumber)this).num();
+       double rDouble = ((XSInteger)obj2).doubleValue();
+       return (lDouble == rDouble);      
+    }
         
     if (obj2.getType() == XObject.CLASS_NODESET) {
        return obj2.equals(this);
diff --git a/tests/org/apache/xalan/xslt3/QuantifiedExprTests.java b/tests/org/apache/xalan/xpath3/QuantifiedExprTests.java
similarity index 61%
rename from tests/org/apache/xalan/xslt3/QuantifiedExprTests.java
rename to tests/org/apache/xalan/xpath3/QuantifiedExprTests.java
index 41a98101..9ccecf55 100644
--- a/tests/org/apache/xalan/xslt3/QuantifiedExprTests.java
+++ b/tests/org/apache/xalan/xpath3/QuantifiedExprTests.java
@@ -14,16 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.xalan.xslt3;
+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;
 
 /**
- * XSLT 3.0 test cases, illustrating simulating the XPath 3.1 quantified 
- * expressions.
+ * XPath 3.1 test cases, for quantified expressions 'some' 
+ * and 'every'.
+ * 
+ * This class also includes XSLT 3.0 test cases that simulate
+ * quantified expressions with XSLT code, instead of using XPath 3.1
+ * quantified expressions 'some' and 'every'.
  * 
  * @author Mukul Gandhi <mu...@apache.org>
  * 
@@ -96,5 +101,55 @@ public class QuantifiedExprTests extends XslTransformTestsUtil {
         
         runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
     }
+    
+    @Test
+    public void xslQuantifiedExprTest6() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_d.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 xslQuantifiedExprTest7() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_e.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test6.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test7.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslQuantifiedExprTest8() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test7.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test7.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test8.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslQuantifiedExprTest9() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test8.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test8.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test9.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslQuantifiedExprTest10() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_f.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test9.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test10.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 4681d382..b6196a2a 100644
--- a/tests/org/apache/xalan/xslt3/AllXsl3Tests.java
+++ b/tests/org/apache/xalan/xslt3/AllXsl3Tests.java
@@ -27,6 +27,7 @@ import org.apache.xalan.xpath3.FnUnparsedTextTests;
 import org.apache.xalan.xpath3.ForExprTests;
 import org.apache.xalan.xpath3.IfExprTests;
 import org.apache.xalan.xpath3.InlineFunctionItemExprTests;
+import org.apache.xalan.xpath3.QuantifiedExprTests;
 import org.apache.xalan.xpath3.RangeExprTests;
 import org.apache.xalan.xpath3.SequenceTests;
 import org.apache.xalan.xpath3.StringTests;
diff --git a/tests/quantified_expr/gold/test10.out b/tests/quantified_expr/gold/test10.out
new file mode 100644
index 00000000..05e5bb77
--- /dev/null
+++ b/tests/quantified_expr/gold/test10.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>true</one>
+  <two>false</two>
+</result>
diff --git a/tests/quantified_expr/gold/test6.out b/tests/quantified_expr/gold/test6.out
new file mode 100644
index 00000000..f32a5804
--- /dev/null
+++ b/tests/quantified_expr/gold/test6.out
@@ -0,0 +1 @@
+true
\ No newline at end of file
diff --git a/tests/quantified_expr/gold/test7.out b/tests/quantified_expr/gold/test7.out
new file mode 100644
index 00000000..02e4a84d
--- /dev/null
+++ b/tests/quantified_expr/gold/test7.out
@@ -0,0 +1 @@
+false
\ No newline at end of file
diff --git a/tests/quantified_expr/gold/test8.out b/tests/quantified_expr/gold/test8.out
new file mode 100644
index 00000000..f32a5804
--- /dev/null
+++ b/tests/quantified_expr/gold/test8.out
@@ -0,0 +1 @@
+true
\ No newline at end of file
diff --git a/tests/quantified_expr/gold/test9.out b/tests/quantified_expr/gold/test9.out
new file mode 100644
index 00000000..02e4a84d
--- /dev/null
+++ b/tests/quantified_expr/gold/test9.out
@@ -0,0 +1 @@
+false
\ No newline at end of file
diff --git a/tests/quantified_expr/test1.xsl b/tests/quantified_expr/test1.xsl
index 72edabe2..bcb72e7d 100644
--- a/tests/quantified_expr/test1.xsl
+++ b/tests/quantified_expr/test1.xsl
@@ -6,8 +6,8 @@
    
    <!-- use with test1_a.xml -->
    
-   <!-- this XSLT stylesheet does the work, what XPath 3.1 quantified expressions 
-        (i.e, as per the following XPath 3.1 grammar fragment. these XPath expressions 
+   <!-- This XSLT stylesheet does the work, what XPath 3.1 quantified expressions 
+        (i.e, as per the following XPath 3.1 grammar fragment. These XPath expressions 
         evaluate to a boolean result) could do.
    
         QuantifiedExpr ::= ("some" | "every") "$" VarName "in" ExprSingle ("," "$" 
diff --git a/tests/quantified_expr/test1_d.xml b/tests/quantified_expr/test1_d.xml
new file mode 100644
index 00000000..15273a67
--- /dev/null
+++ b/tests/quantified_expr/test1_d.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<parts>
+   <part discounted="yes" price="5"/>
+   <part discounted="no" price="2"/>
+   <part discounted="yes" price="5"/>
+   <part discounted="yes" price="10"/>
+   <part discounted="no" price="3"/>
+   <part discounted="yes" price="10"/>
+</parts>
\ No newline at end of file
diff --git a/tests/quantified_expr/test1_e.xml b/tests/quantified_expr/test1_e.xml
new file mode 100644
index 00000000..d4287ffb
--- /dev/null
+++ b/tests/quantified_expr/test1_e.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<parts>
+   <part discounted="yes" price="5"/>
+   <part discounted="no" price="2"/>
+   <part discounted="yes" price="5"/>
+   <part discounted="yes" price="10"/>
+   <part price="3"/>
+   <part discounted="yes" price="10"/>
+</parts>
\ No newline at end of file
diff --git a/tests/quantified_expr/test1_f.xml b/tests/quantified_expr/test1_f.xml
new file mode 100644
index 00000000..a5b5bc92
--- /dev/null
+++ b/tests/quantified_expr/test1_f.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<company>
+  <office location="Boston">
+    <employee>
+      <first_name>John</first_name>
+      <last_name>Smith</last_name>
+      <age>25</age>
+    </employee>
+    <employee>
+      <first_name>John</first_name>
+      <last_name>Jones</last_name>
+      <age>30</age>
+    </employee>
+  </office>
+  <office location="Vienna">
+    <employee>
+      <first_name>Mary</first_name>
+      <last_name>Brown</last_name>
+      <age>30</age>
+    </employee>
+    <employee>
+      <first_name>Peter</first_name>
+      <last_name>Davis</last_name>
+      <age>34</age>
+    </employee>
+    <employee>
+      <first_name>Mark</first_name>
+      <last_name>Mason</last_name>
+      <age>44</age>
+    </employee>
+  </office>
+</company>
+
diff --git a/tests/quantified_expr/test2.xsl b/tests/quantified_expr/test2.xsl
index dfff9bbb..2ba71282 100644
--- a/tests/quantified_expr/test2.xsl
+++ b/tests/quantified_expr/test2.xsl
@@ -6,8 +6,8 @@
    
    <!-- use with test1_b.xml -->
    
-   <!-- this XSLT stylesheet does the work, what XPath 3.1 quantified expressions 
-        (i.e, as per the following XPath 3.1 grammar fragment. these XPath expressions 
+   <!-- This XSLT stylesheet does the work, what XPath 3.1 quantified expressions 
+        (i.e, as per the following XPath 3.1 grammar fragment. These XPath expressions 
         evaluate to a boolean result) could do.
    
         QuantifiedExpr ::= ("some" | "every") "$" VarName "in" ExprSingle ("," "$" 
diff --git a/tests/quantified_expr/test3.xsl b/tests/quantified_expr/test3.xsl
index 484a944e..62a49380 100644
--- a/tests/quantified_expr/test3.xsl
+++ b/tests/quantified_expr/test3.xsl
@@ -6,8 +6,8 @@
    
    <!-- use with test1_c.xml -->
    
-   <!-- this XSLT stylesheet does the work, what XPath 3.1 quantified expressions 
-        (i.e, as per the following XPath 3.1 grammar fragment. these XPath expressions 
+   <!-- This XSLT stylesheet does the work, what XPath 3.1 quantified expressions 
+        (i.e, as per the following XPath 3.1 grammar fragment. These XPath expressions 
         evaluate to a boolean result) could do.
    
         QuantifiedExpr ::= ("some" | "every") "$" VarName "in" ExprSingle ("," "$" 
diff --git a/tests/quantified_expr/test4.xsl b/tests/quantified_expr/test4.xsl
index 9dbf97ed..5195456d 100644
--- a/tests/quantified_expr/test4.xsl
+++ b/tests/quantified_expr/test4.xsl
@@ -6,8 +6,8 @@
    
    <!-- use with test1_c.xml -->
    
-   <!-- this XSLT stylesheet does the work, what XPath 3.1 quantified expressions 
-        (i.e, as per the following XPath 3.1 grammar fragment. these XPath expressions 
+   <!-- This XSLT stylesheet does the work, what XPath 3.1 quantified expressions 
+        (i.e, as per the following XPath 3.1 grammar fragment. These XPath expressions 
         evaluate to a boolean result) could do.
    
         QuantifiedExpr ::= ("some" | "every") "$" VarName "in" ExprSingle ("," "$" 
diff --git a/tests/quantified_expr/test5.xsl b/tests/quantified_expr/test5.xsl
index 6cf0eb1b..271aaa10 100644
--- a/tests/quantified_expr/test5.xsl
+++ b/tests/quantified_expr/test5.xsl
@@ -7,15 +7,14 @@
    <!-- use with test1_c.xml -->
    
    <!-- This XSLT stylesheet does the work, what XPath 3.1 quantified expressions 
-        (i.e, as per the following XPath 3.1 grammar fragment. these XPath expressions 
+        (i.e, as per the following XPath 3.1 grammar fragment. These XPath expressions 
         evaluate to a boolean result) could do.
    
         QuantifiedExpr ::= ("some" | "every") "$" VarName "in" ExprSingle ("," "$" 
                                         VarName "in" ExprSingle)* "satisfies" ExprSingle
                                         
-        This stylesheet example, illustrates the ability of XSLT named template 
-        ("isXmlElementE1eXistsWithinAllElementsA" within this example) to function as a 
-        re-usable fragment of XSLT code.
+        This stylesheet example, uses an XSLT named template ("isXmlElementE1eXistsWithinAllElementsA" 
+        within this example) as a re-usable fragment of XSLT code.
    -->
 
    <xsl:output method="text"/>
diff --git a/tests/quantified_expr/test2.xsl b/tests/quantified_expr/test6.xsl
similarity index 56%
copy from tests/quantified_expr/test2.xsl
copy to tests/quantified_expr/test6.xsl
index dfff9bbb..0f39c767 100644
--- a/tests/quantified_expr/test2.xsl
+++ b/tests/quantified_expr/test6.xsl
@@ -4,30 +4,18 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- use with test1_b.xml -->
+   <!-- use with test1_d.xml -->
    
-   <!-- this XSLT stylesheet does the work, what XPath 3.1 quantified expressions 
-        (i.e, as per the following XPath 3.1 grammar fragment. these XPath expressions 
-        evaluate to a boolean result) could do.
-   
-        QuantifiedExpr ::= ("some" | "every") "$" VarName "in" ExprSingle ("," "$" 
-                                        VarName "in" ExprSingle)* "satisfies" ExprSingle
-   -->
+   <!-- An XSLT stylesheet test case, to test the XPath 3.1 quantified 
+        expression 'every'.
+        
+        This XSLT stylesheet example, borrows an XPath quantified
+        expression example from XPath 3.1 spec. -->
 
    <xsl:output method="text"/>
 
-   <xsl:template match="/elem">      
-      <xsl:variable name="result">
-         <xsl:for-each select="(test1 | test2)/a">
-           <xsl:if test="e1">
-             <yes/>
-           </xsl:if>
-         </xsl:for-each>
-      </xsl:variable>
-      
-      <xsl:if test="count($result/yes) &gt; 0">
-         <xsl:text>at-least one xml element '(test1 | test2)/a' contains an xml element 'e1'</xsl:text>
-      </xsl:if>
+   <xsl:template match="/">      
+     <xsl:value-of select="every $part in /parts/part satisfies $part/@discounted"/>  
    </xsl:template>
    
    <!--
diff --git a/tests/quantified_expr/test2.xsl b/tests/quantified_expr/test7.xsl
similarity index 56%
copy from tests/quantified_expr/test2.xsl
copy to tests/quantified_expr/test7.xsl
index dfff9bbb..77a50cac 100644
--- a/tests/quantified_expr/test2.xsl
+++ b/tests/quantified_expr/test7.xsl
@@ -4,30 +4,16 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- use with test1_b.xml -->
-   
-   <!-- this XSLT stylesheet does the work, what XPath 3.1 quantified expressions 
-        (i.e, as per the following XPath 3.1 grammar fragment. these XPath expressions 
-        evaluate to a boolean result) could do.
-   
-        QuantifiedExpr ::= ("some" | "every") "$" VarName "in" ExprSingle ("," "$" 
-                                        VarName "in" ExprSingle)* "satisfies" ExprSingle
-   -->
+   <!-- An XSLT stylesheet test case, to test the XPath 3.1 quantified 
+        expression 'some'.
+        
+        This XSLT stylesheet example, borrows an XPath quantified
+        expression example from XPath 3.1 spec, with slight modification. -->
 
    <xsl:output method="text"/>
 
-   <xsl:template match="/elem">      
-      <xsl:variable name="result">
-         <xsl:for-each select="(test1 | test2)/a">
-           <xsl:if test="e1">
-             <yes/>
-           </xsl:if>
-         </xsl:for-each>
-      </xsl:variable>
-      
-      <xsl:if test="count($result/yes) &gt; 0">
-         <xsl:text>at-least one xml element '(test1 | test2)/a' contains an xml element 'e1'</xsl:text>
-      </xsl:if>
+   <xsl:template match="/">      
+     <xsl:value-of select="some $x in (1 to 3), $y in (2 to 4) satisfies $x + $y = 4"/>  
    </xsl:template>
    
    <!--
diff --git a/tests/quantified_expr/test2.xsl b/tests/quantified_expr/test8.xsl
similarity index 56%
copy from tests/quantified_expr/test2.xsl
copy to tests/quantified_expr/test8.xsl
index dfff9bbb..56a0db81 100644
--- a/tests/quantified_expr/test2.xsl
+++ b/tests/quantified_expr/test8.xsl
@@ -4,30 +4,16 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- use with test1_b.xml -->
-   
-   <!-- this XSLT stylesheet does the work, what XPath 3.1 quantified expressions 
-        (i.e, as per the following XPath 3.1 grammar fragment. these XPath expressions 
-        evaluate to a boolean result) could do.
-   
-        QuantifiedExpr ::= ("some" | "every") "$" VarName "in" ExprSingle ("," "$" 
-                                        VarName "in" ExprSingle)* "satisfies" ExprSingle
-   -->
+   <!-- An XSLT stylesheet test case, to test the XPath 3.1 quantified 
+        expression 'every'.
+        
+        This XSLT stylesheet example, borrows an XPath quantified
+        expression example from XPath 3.1 spec, with slight modification. -->
 
    <xsl:output method="text"/>
 
-   <xsl:template match="/elem">      
-      <xsl:variable name="result">
-         <xsl:for-each select="(test1 | test2)/a">
-           <xsl:if test="e1">
-             <yes/>
-           </xsl:if>
-         </xsl:for-each>
-      </xsl:variable>
-      
-      <xsl:if test="count($result/yes) &gt; 0">
-         <xsl:text>at-least one xml element '(test1 | test2)/a' contains an xml element 'e1'</xsl:text>
-      </xsl:if>
+   <xsl:template match="/">      
+     <xsl:value-of select="every $x in (1 to 3), $y in (2 to 4) satisfies $x + $y = 4"/>  
    </xsl:template>
    
    <!--
diff --git a/tests/quantified_expr/test2.xsl b/tests/quantified_expr/test9.xsl
similarity index 54%
copy from tests/quantified_expr/test2.xsl
copy to tests/quantified_expr/test9.xsl
index dfff9bbb..859b9d91 100644
--- a/tests/quantified_expr/test2.xsl
+++ b/tests/quantified_expr/test9.xsl
@@ -4,30 +4,25 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- use with test1_b.xml -->
+   <!-- use with test1_f.xml -->
    
-   <!-- this XSLT stylesheet does the work, what XPath 3.1 quantified expressions 
-        (i.e, as per the following XPath 3.1 grammar fragment. these XPath expressions 
-        evaluate to a boolean result) could do.
-   
-        QuantifiedExpr ::= ("some" | "every") "$" VarName "in" ExprSingle ("," "$" 
-                                        VarName "in" ExprSingle)* "satisfies" ExprSingle
-   -->
+   <!-- An XSLT stylesheet test case, to test the XPath 3.1 quantified 
+        expressions 'some' and 'every'.
+        
+        This XSLT stylesheet example, borrows XPath quantified
+        expression examples from https://www.altova.com/. -->
 
-   <xsl:output method="text"/>
+   <xsl:output method="xml" indent="yes"/>
 
-   <xsl:template match="/elem">      
-      <xsl:variable name="result">
-         <xsl:for-each select="(test1 | test2)/a">
-           <xsl:if test="e1">
-             <yes/>
-           </xsl:if>
-         </xsl:for-each>
-      </xsl:variable>
-      
-      <xsl:if test="count($result/yes) &gt; 0">
-         <xsl:text>at-least one xml element '(test1 | test2)/a' contains an xml element 'e1'</xsl:text>
-      </xsl:if>
+   <xsl:template match="/">
+     <result>
+        <one>      
+           <xsl:value-of select="some $i in /company/office/employee satisfies $i/age lt 30"/>
+        </one>
+        <two>      
+           <xsl:value-of select="every $i in /company/office/employee satisfies $i/age gt 30"/>
+        </two>
+     </result>  
    </xsl:template>
    
    <!--


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