You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mu...@apache.org on 2025/09/29 12:16:57 UTC

(xalan-java) branch xalan-j_xslt3.0_mvn updated: committing few xalan-j xslt 3.0 implementation improvements

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

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


The following commit(s) were added to refs/heads/xalan-j_xslt3.0_mvn by this push:
     new ca71806a1 committing few xalan-j xslt 3.0 implementation improvements
ca71806a1 is described below

commit ca71806a160555e68244fff80d981bdefa0ad491
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Mon Sep 29 17:46:18 2025 +0530

    committing few xalan-j xslt 3.0 implementation improvements
---
 README                                             |   8 +-
 .../org/apache/xalan/templates/ElemVariable.java   |   6 +-
 src/main/java/org/apache/xpath/Expression.java     |  11 +-
 .../org/apache/xpath/compiler/XPathParser.java     |  43 +++++---
 .../xpath/composite/XPathTextAndNodeExpr.java      |  47 ++++++--
 src/main/java/org/apache/xpath/operations/Gt.java  | 122 +++++++++++++++++++++
 src/main/java/org/apache/xpath/operations/Lt.java  | 122 +++++++++++++++++++++
 .../xalan/tests/main/XalanXsl3TestSuite2.java      |   4 +-
 .../xslt3/result/expr/_axes-test-set_result.xml    |   4 +-
 .../xslt3/result/type/_boolean-test-set_result.xml |   4 +-
 .../result/w3c_xslt3_testsuite_xalan-j_result.xml  |   6 +-
 .../tests/xpath3/XPathTextAndNodePattern.java      |  91 +++++++++++++++
 src/test/resources/xpath_node_tests/gold/test1.out |  22 ++++
 src/test/resources/xpath_node_tests/gold/test2.out |  17 +++
 src/test/resources/xpath_node_tests/gold/test3.out |  22 ++++
 src/test/resources/xpath_node_tests/gold/test4.out |   9 ++
 src/test/resources/xpath_node_tests/test1.xml      |   2 +
 src/test/resources/xpath_node_tests/test1.xsl      |  54 +++++++++
 src/test/resources/xpath_node_tests/test2.xsl      |  51 +++++++++
 src/test/resources/xpath_node_tests/test3.xsl      |  54 +++++++++
 src/test/resources/xpath_node_tests/test4.xsl      |  49 +++++++++
 21 files changed, 711 insertions(+), 37 deletions(-)

diff --git a/README b/README
index 68284bd04..1b8ee2bf8 100644
--- a/README
+++ b/README
@@ -17,7 +17,7 @@
 
 Copyright 1999-2025 The Apache Software Foundation
 
-Document last modified : 2025-09-18
+Document last modified : 2025-09-29
 
 Authors:
    Gary Gregory <gg...@apache.org>
@@ -49,11 +49,11 @@ The Maven build results like following shall be produced:
 [INFO]  T E S T S
 [INFO] -------------------------------------------------------
 [INFO] Running org.apache.xalan.tests.main.AllXalanXSLT3Tests
-[INFO] Tests run: 1309, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 99.315 s - in org.apache.xalan.tests.main.AllXalanXSLT3Tests
+[INFO] Tests run: 1313, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 62.342 s - in org.apache.xalan.tests.main.AllXalanXSLT3Tests
 [INFO]
 [INFO] Results:
 [INFO]
-[INFO] Tests run: 1309, Failures: 0, Errors: 0, Skipped: 0
+[INFO] Tests run: 1313, Failures: 0, Errors: 0, Skipped: 0
 [INFO]
 [INFO]
 [INFO] --- jar:3.3.0:jar (default-jar) @ xalan-java ---
@@ -62,7 +62,7 @@ The Maven build results like following shall be produced:
 [INFO] ------------------------------------------------------------------------
 [INFO] BUILD SUCCESS
 [INFO] ------------------------------------------------------------------------
-[INFO] Total time:  03:16 min
+[INFO] Total time:  03:10 min
 
 
 If the user needs to run Xalan-J's XSLT 3.0 implementation via Java application code, the value of JVM's system property 
diff --git a/src/main/java/org/apache/xalan/templates/ElemVariable.java b/src/main/java/org/apache/xalan/templates/ElemVariable.java
index b03bc8d3e..051f44b97 100644
--- a/src/main/java/org/apache/xalan/templates/ElemVariable.java
+++ b/src/main/java/org/apache/xalan/templates/ElemVariable.java
@@ -44,6 +44,7 @@ import org.apache.xpath.composite.SequenceTypeKindTest;
 import org.apache.xpath.composite.SequenceTypeSupport;
 import org.apache.xpath.composite.XPathArrayConstructor;
 import org.apache.xpath.composite.XPathNamedFunctionReference;
+import org.apache.xpath.composite.XPathTextAndNodeExpr;
 import org.apache.xpath.functions.Function;
 import org.apache.xpath.functions.XPathDynamicFunctionCall;
 import org.apache.xpath.functions.XSL3ConstructorOrExtensionFunction;
@@ -436,7 +437,7 @@ public class ElemVariable extends ElemTemplateElement
     try {        
       if (m_selectPattern != null) {          
         selectExpression = m_selectPattern.getExpression();
-        
+                
         if (selectExpression instanceof XSL3ConstructorOrExtensionFunction) {        	
         	XSL3ConstructorOrExtensionFunction xpathFunc = (XSL3ConstructorOrExtensionFunction)selectExpression;
         	XSL3FunctionService xslFunctionService = xctxt.getXSLFunctionService();
@@ -773,6 +774,9 @@ public class ElemVariable extends ElemTemplateElement
         	   ((XString)var).setXrTreeFragSelectWrapperResult(true);
         	}
         }
+        else if (selectExpression instanceof XPathTextAndNodeExpr) {
+        	var = ((XPathTextAndNodeExpr)selectExpression).execute(xctxt);
+        }
   
         if (var == null) {        	        	
            var = m_selectPattern.execute(xctxt, sourceNode, this);
diff --git a/src/main/java/org/apache/xpath/Expression.java b/src/main/java/org/apache/xpath/Expression.java
index 00aea9ebe..47244ec51 100644
--- a/src/main/java/org/apache/xpath/Expression.java
+++ b/src/main/java/org/apache/xpath/Expression.java
@@ -28,6 +28,7 @@ import javax.xml.transform.SourceLocator;
 import javax.xml.transform.TransformerException;
 
 import org.apache.xalan.res.XSLMessages;
+import org.apache.xalan.xslt.util.XslTransformEvaluationHelper;
 import org.apache.xml.dtm.DTM;
 import org.apache.xml.dtm.DTMCursorIterator;
 import org.apache.xml.utils.QName;
@@ -261,7 +262,15 @@ public abstract class Expression implements java.io.Serializable, ExpressionNode
       
       XObject xObj = execute(xctxt);
       
-      DTMCursorIterator dtmIter = xObj.iter(); 
+      DTMCursorIterator dtmIter = null;
+      if (xObj instanceof ResultSequence) {
+    	  XMLNodeCursorImpl xmlNodeCursorImpl = XslTransformEvaluationHelper.getXNodeSetFromResultSequence(
+    			                                                                                       (ResultSequence)xObj, xctxt);    	  
+    	  dtmIter = xmlNodeCursorImpl.iter();
+      }
+      else {
+          dtmIter = xObj.iter();
+      }
 
       return dtmIter;
     }
diff --git a/src/main/java/org/apache/xpath/compiler/XPathParser.java b/src/main/java/org/apache/xpath/compiler/XPathParser.java
index b4ac4ae6b..67b97f628 100644
--- a/src/main/java/org/apache/xpath/compiler/XPathParser.java
+++ b/src/main/java/org/apache/xpath/compiler/XPathParser.java
@@ -4860,7 +4860,7 @@ public class XPathParser
     	// XPath parse of named function reference, for XPath built-in functions    	
     	handleXPathParseNamedFuncRefWithoutNSQual(opPos);
     }
-    else if (tokenIs("for")) {
+    else if (tokenIs("for") || tokenIs("let") || tokenIs("some") || tokenIs("every")) {
        ExprSingle();
     }
     else if (isTextAndNodeExpr(m_queueMark)) {
@@ -4947,7 +4947,7 @@ public class XPathParser
        TokenQueueScanPosition prevTokQueueScanPosition = new TokenQueueScanPosition(m_queueMark, m_tokenChar, m_token);
        StringBuffer strBuff = new StringBuffer();
        while (!tokenIs(',') && !(tokenIs(')') && lookahead(null, 1)) && (m_token != null)) {
-    	  strBuff.append(m_token);
+    	  strBuff.append(m_token);    	  
     	  nextToken();
        }
        
@@ -4960,9 +4960,19 @@ public class XPathParser
 								    			  		xpathLhsStr.endsWith(FunctionTable.XPATH_BUILT_IN_MATH_FUNCS_NS_URI) ||
 								    			  		xpathLhsStr.endsWith(FunctionTable.XPATH_BUILT_IN_MAP_FUNCS_NS_URI) ||
 								    			  		xpathLhsStr.endsWith(FunctionTable.XPATH_BUILT_IN_ARRAY_FUNCS_NS_URI)) {
-              restoreTokenQueueScanPosition(prevTokQueueScanPosition);    		  
+              restoreTokenQueueScanPosition(prevTokQueueScanPosition);
+              
     		  Expr();  
-    	  }    	  
+    	  }
+    	  else if ("text()".equals(xpathRhsStr) || "node()".equals(xpathRhsStr)) {
+    		  appendOp(2, OpCodes.OP_TEXT_AND_NODE_EXPR);
+
+    		  m_xpathTextAndNodeExpr = new XPathTextAndNodeExpr();    		      		  
+    		  m_xpathTextAndNodeExpr.setNodeStr(xpathRhsStr);    		  
+    		  if (xpathLhsStr.length() > 0) {
+    			  m_xpathTextAndNodeExpr.setXpathPrefixStr(xpathLhsStr);
+    		  } 
+    	  }
     	  else {    		  
     		  if (!isStrHasXPathAxisNamePrefix(xpathRhsStr) && (xpathRhsStr.endsWith("()") || xpathRhsStr.endsWith("(.)"))) {    		  
     			  insertOp(opPos, 2, OpCodes.OP_XPATH_EXPR_WITH_FUNC_CALL_SUFFIX);    		  
@@ -4971,24 +4981,29 @@ public class XPathParser
     			  m_xpathExprWithFuncCallSuffix.setXPathExprStr(xpathExprStr);
     		  }
     		  else {
-    			  restoreTokenQueueScanPosition(prevTokQueueScanPosition);    		  
+    			  restoreTokenQueueScanPosition(prevTokQueueScanPosition);
+    			  
     			  Expr(); 
     		  }
     	  }
        }
        else {
     	   restoreTokenQueueScanPosition(prevTokQueueScanPosition);
-    	  
-    	   // An XPath function argument is text(). Modify contents of XPath 
-    	   // parse token queue by replacing token string text() with ".".
-    	   if (tokenIs("text") && lookahead('(', 1) && lookahead(')', 2)) {    		   
-    		   mutateTokenQueue(new String[] { "." }, 0, m_queueMark + 2, 1);
+    	   
+    	   if ((tokenIs("text") || tokenIs("node")) && lookahead('(', 1) && 
+    			                                                      lookahead(')', 2) && lookahead(')', 3)) {
+    		   appendOp(2, OpCodes.OP_TEXT_AND_NODE_EXPR);    		       		   
     		   
-    		   m_token = ".";
-    		   m_tokenChar = '.';
+    		   m_xpathTextAndNodeExpr = new XPathTextAndNodeExpr();    		      		  
+    		   m_xpathTextAndNodeExpr.setNodeStr(m_token + "(" + ")");
+    		   
+    		   nextToken();
+    		   consumeExpected('(');
+    		   consumeExpected(')');
+    	   }
+    	   else {
+    	      Expr();
     	   }
-
-    	   Expr();
         }                     
     }
     
diff --git a/src/main/java/org/apache/xpath/composite/XPathTextAndNodeExpr.java b/src/main/java/org/apache/xpath/composite/XPathTextAndNodeExpr.java
index f25a6fcd6..75243214e 100644
--- a/src/main/java/org/apache/xpath/composite/XPathTextAndNodeExpr.java
+++ b/src/main/java/org/apache/xpath/composite/XPathTextAndNodeExpr.java
@@ -99,6 +99,18 @@ public class XPathTextAndNodeExpr extends Expression {
 		XPath xpathObj = null;
 		XObject xObjResult = null;
 		
+		if ((m_xpathPrefixStr == null) && (m_xpathPredicateValStr == null) 
+				                                                 && (m_xpathSuffixValStr == null)) {
+			xpathObj = new XPath(m_nodeStr, srcLocator, xctxt.getNamespaceContext(), XPath.SELECT, null);
+		    if (m_vars != null) {
+				xpathObj.fixupVariables(m_vars, m_globals_size);
+			}
+		    
+		    result = xpathObj.execute(xctxt, sourceNode, xctxt.getNamespaceContext());
+		    
+		    return result;
+		}
+		
 		List<Integer> nodeHandleSeq = new ArrayList<Integer>();
 		if (m_xpathPrefixStr != null) {
 		    xpathObj = new XPath(m_xpathPrefixStr, srcLocator, xctxt.getNamespaceContext(), XPath.SELECT, null);
@@ -109,10 +121,15 @@ public class XPathTextAndNodeExpr extends Expression {
 		    xObjResult = xpathObj.execute(xctxt, sourceNode, xctxt.getNamespaceContext());
 		    
 		    XMLNodeCursorImpl xmlNodeCursorImpl = (XMLNodeCursorImpl)xObjResult;
-		    DTMCursorIterator nodeIter1 = xmlNodeCursorImpl.iterRaw();
-		    int nextNode;	    
-		    while ((nextNode = nodeIter1.nextNode()) != DTM.NULL) {
-		    	nodeHandleSeq.add(Integer.valueOf(nextNode));
+		    if (xmlNodeCursorImpl.getLength() == 1) {		    	
+		    	nodeHandleSeq.add(Integer.valueOf(xmlNodeCursorImpl.asNode(xctxt)));
+		    }
+		    else {
+		    	DTMCursorIterator nodeIter1 = xmlNodeCursorImpl.iterRaw();
+		    	int nextNode;	    
+		    	while ((nextNode = nodeIter1.nextNode()) != DTM.NULL) {
+		    		nodeHandleSeq.add(Integer.valueOf(nextNode));
+		    	}
 		    }
 		}
 		else {
@@ -189,13 +206,25 @@ public class XPathTextAndNodeExpr extends Expression {
 				   if (m_vars != null) {
 					   xpathObj.fixupVariables(m_vars, m_globals_size);
 				   }
-				   
+
 				   xObjResult = xpathObj.execute(xctxt, contextNode1, xctxt.getNamespaceContext());
 				   if (xObjResult instanceof XMLNodeCursorImpl) {
-					  int length1 = ((XMLNodeCursorImpl)xObjResult).getLength();
-					  if (length1 > 0) {
-						  rSeq3.add(xObjResult); 
-					  }
+					   XMLNodeCursorImpl xmlNodeCursorImpl = (XMLNodeCursorImpl)xObjResult;					   
+					   int length1 = xmlNodeCursorImpl.getLength();
+					   DTMCursorIterator nodeIter1 = null;
+					   if (length1 > 0) {
+						   nodeIter1 = xmlNodeCursorImpl.iter();						  
+					   }
+					   else {
+						   nodeIter1 = xmlNodeCursorImpl.iterRaw();
+					   }
+					   
+					   int nextNode;
+					   DTMManager dtmManager = xctxt.getDTMManager();			 
+					   while ((nextNode = nodeIter1.nextNode()) != DTM.NULL) {
+						   XMLNodeCursorImpl nodeRef2 = new XMLNodeCursorImpl(nextNode, dtmManager);
+						   rSeq3.add(nodeRef2);
+					   }
 				   }
 			   }
 			   
diff --git a/src/main/java/org/apache/xpath/operations/Gt.java b/src/main/java/org/apache/xpath/operations/Gt.java
index 1491fa396..27d494e83 100644
--- a/src/main/java/org/apache/xpath/operations/Gt.java
+++ b/src/main/java/org/apache/xpath/operations/Gt.java
@@ -23,6 +23,7 @@ package org.apache.xpath.operations;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.xalan.xslt.util.XslTransformEvaluationHelper;
 import org.apache.xml.dtm.DTM;
 import org.apache.xml.dtm.DTMCursorIterator;
 import org.apache.xml.dtm.DTMManager;
@@ -172,6 +173,127 @@ public class Gt extends Operation
 		  
 		  return XBoolean.S_FALSE;
 	  }
+	  else if ((left instanceof ResultSequence) && (right instanceof XMLNodeCursorImpl)) {
+		  right = right.getFresh();		  		  
+			  
+		  XMLNodeCursorImpl nodeRef = (XMLNodeCursorImpl)right;		  
+		  List<java.lang.String> strListR = new ArrayList<java.lang.String>();
+		  DTMManager dtmManager = nodeRef.getDTMManager();
+		  DTMCursorIterator iter = nodeRef.iterRaw();
+		  int nextNode = DTM.NULL;		  
+		  while ((nextNode = iter.nextNode()) != DTM.NULL) {
+			  XMLNodeCursorImpl node1 = new XMLNodeCursorImpl(nextNode, dtmManager);
+			  java.lang.String str1 = node1.str();
+			  strListR.add(str1);
+		  }
+		  
+		  ResultSequence rSeqL = (ResultSequence)left;
+		  int lSize = rSeqL.size();
+		  int rSize = strListR.size();		   
+		  for (int idx = 0; idx < lSize; idx++) {
+			 // Loop the LHS ResultSequence object			  
+			 XObject xObj1 = rSeqL.item(idx);
+			 Double lDbl = null;
+			 java.lang.String lStr = null;
+			 if (xObj1 instanceof XNumber) {
+				lDbl = ((XNumber)xObj1).num();  
+			 }
+			 else if (xObj1 instanceof XSNumericType) {
+				XSNumericType xsNumericType = (XSNumericType)xObj1;
+				lDbl = Double.valueOf(xsNumericType.stringValue());
+			 }
+			 else {
+				lStr = XslTransformEvaluationHelper.getStrVal(xObj1);  
+			 }
+			 
+			 // Loop the RHS node list string values
+			 for (int idx2 = 0; idx2 < rSize; idx2++) {
+				 java.lang.String strRhs = strListR.get(idx2);
+				 if ((lStr != null) && (lStr.compareTo(strRhs) > 0)) {
+					 return XBoolean.S_TRUE;
+				 }
+				 else if (lDbl != null) {
+					 try {	
+						 Double rDbl = Double.valueOf(strRhs);
+						 if (lDbl.doubleValue() > rDbl.doubleValue()) {
+							 return XBoolean.S_TRUE;	 
+						 }
+					 }
+					 catch (NumberFormatException ex) {
+                         // Compare lDbl's string value with string value strRhs
+						 lStr = lDbl.toString();
+						 if (lStr.compareTo(strRhs) > 0) {
+							return XBoolean.S_TRUE; 
+						 }
+					 }
+				 }
+			 }
+		  }
+		  
+		  return XBoolean.S_FALSE;
+	  }
+	  else if ((left instanceof XMLNodeCursorImpl) && (right instanceof ResultSequence)) {
+		  left = left.getFresh();
+		  Object swapObj = left;
+		  right = left;
+		  left = (XMLNodeCursorImpl)swapObj; 
+			  
+		  XMLNodeCursorImpl nodeRef = (XMLNodeCursorImpl)right;		  
+		  List<java.lang.String> strListR = new ArrayList<java.lang.String>();
+		  DTMManager dtmManager = nodeRef.getDTMManager();
+		  DTMCursorIterator iter = nodeRef.iterRaw();
+		  int nextNode = DTM.NULL;		  
+		  while ((nextNode = iter.nextNode()) != DTM.NULL) {
+			  XMLNodeCursorImpl node1 = new XMLNodeCursorImpl(nextNode, dtmManager);
+			  java.lang.String str1 = node1.str();
+			  strListR.add(str1);
+		  }
+		  
+		  ResultSequence rSeqL = (ResultSequence)left;
+		  int lSize = rSeqL.size();
+		  int rSize = strListR.size();		   
+		  for (int idx = 0; idx < lSize; idx++) {
+			 // Loop the LHS ResultSequence object			  
+			 XObject xObj1 = rSeqL.item(idx);
+			 Double lDbl = null;
+			 java.lang.String lStr = null;
+			 if (xObj1 instanceof XNumber) {
+				lDbl = ((XNumber)xObj1).num();  
+			 }
+			 else if (xObj1 instanceof XSNumericType) {
+				XSNumericType xsNumericType = (XSNumericType)xObj1;
+				lDbl = Double.valueOf(xsNumericType.stringValue());
+			 }
+			 else {
+				lStr = XslTransformEvaluationHelper.getStrVal(xObj1);  
+			 }
+			 
+			 // Loop the RHS node list string values
+			 for (int idx2 = 0; idx2 < rSize; idx2++) {
+				 java.lang.String strRhs = strListR.get(idx2);
+				 if ((lStr != null) && (lStr.compareTo(strRhs) > 0)) {
+					 return XBoolean.S_TRUE;
+				 }
+				 else if (lDbl != null) {
+					 try {	
+						 Double rDbl = Double.valueOf(strRhs);
+						 if (lDbl.doubleValue() > rDbl.doubleValue()) {
+							 return XBoolean.S_TRUE;	 
+						 }
+					 }
+					 catch (NumberFormatException ex) {
+                         // Compare lDbl's string value with string value strRhs
+						 lStr = lDbl.toString();
+						 if (lStr.compareTo(strRhs) > 0) {
+							return XBoolean.S_TRUE; 
+						 }
+					 }
+				 }
+			 }
+		  }
+		  
+		  return XBoolean.S_FALSE;
+	  }
 	  else if ((left instanceof ResultSequence) && (right instanceof ResultSequence)) {
 		  ResultSequence rSeq1 = (ResultSequence)left;
 		  ResultSequence rSeq2 = (ResultSequence)right;
diff --git a/src/main/java/org/apache/xpath/operations/Lt.java b/src/main/java/org/apache/xpath/operations/Lt.java
index 7ee16cdf7..cbc635587 100644
--- a/src/main/java/org/apache/xpath/operations/Lt.java
+++ b/src/main/java/org/apache/xpath/operations/Lt.java
@@ -23,6 +23,7 @@ package org.apache.xpath.operations;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.xalan.xslt.util.XslTransformEvaluationHelper;
 import org.apache.xml.dtm.DTM;
 import org.apache.xml.dtm.DTMCursorIterator;
 import org.apache.xml.dtm.DTMManager;
@@ -169,6 +170,127 @@ public class Lt extends Operation
 		  
 		  return XBoolean.S_FALSE;
 	  }
+	  else if ((left instanceof ResultSequence) && (right instanceof XMLNodeCursorImpl)) {
+		  right = right.getFresh();		  		  
+			  
+		  XMLNodeCursorImpl nodeRef = (XMLNodeCursorImpl)right;		  
+		  List<java.lang.String> strListR = new ArrayList<java.lang.String>();
+		  DTMManager dtmManager = nodeRef.getDTMManager();
+		  DTMCursorIterator iter = nodeRef.iterRaw();
+		  int nextNode = DTM.NULL;		  
+		  while ((nextNode = iter.nextNode()) != DTM.NULL) {
+			  XMLNodeCursorImpl node1 = new XMLNodeCursorImpl(nextNode, dtmManager);
+			  java.lang.String str1 = node1.str();
+			  strListR.add(str1);
+		  }
+		  
+		  ResultSequence rSeqL = (ResultSequence)left;
+		  int lSize = rSeqL.size();
+		  int rSize = strListR.size();		   
+		  for (int idx = 0; idx < lSize; idx++) {
+			 // Loop the LHS ResultSequence object			  
+			 XObject xObj1 = rSeqL.item(idx);
+			 Double lDbl = null;
+			 java.lang.String lStr = null;
+			 if (xObj1 instanceof XNumber) {
+				lDbl = ((XNumber)xObj1).num();  
+			 }
+			 else if (xObj1 instanceof XSNumericType) {
+				XSNumericType xsNumericType = (XSNumericType)xObj1;
+				lDbl = Double.valueOf(xsNumericType.stringValue());
+			 }
+			 else {
+				lStr = XslTransformEvaluationHelper.getStrVal(xObj1);  
+			 }
+			 
+			 // Loop the RHS node list string values
+			 for (int idx2 = 0; idx2 < rSize; idx2++) {
+				 java.lang.String strRhs = strListR.get(idx2);
+				 if ((lStr != null) && (lStr.compareTo(strRhs) < 0)) {
+					 return XBoolean.S_TRUE;
+				 }
+				 else if (lDbl != null) {
+					 try {	
+						 Double rDbl = Double.valueOf(strRhs);
+						 if (lDbl.doubleValue() < rDbl.doubleValue()) {
+							 return XBoolean.S_TRUE;	 
+						 }
+					 }
+					 catch (NumberFormatException ex) {
+                         // Compare lDbl's string value with string value strRhs
+						 lStr = lDbl.toString();
+						 if (lStr.compareTo(strRhs) < 0) {
+							return XBoolean.S_TRUE; 
+						 }
+					 }
+				 }
+			 }
+		  }
+		  
+		  return XBoolean.S_FALSE;
+	  }
+	  else if ((left instanceof XMLNodeCursorImpl) && (right instanceof ResultSequence)) {
+		  left = left.getFresh();
+		  Object swapObj = left;
+		  right = left;
+		  left = (XMLNodeCursorImpl)swapObj; 
+			  
+		  XMLNodeCursorImpl nodeRef = (XMLNodeCursorImpl)right;		  
+		  List<java.lang.String> strListR = new ArrayList<java.lang.String>();
+		  DTMManager dtmManager = nodeRef.getDTMManager();
+		  DTMCursorIterator iter = nodeRef.iterRaw();
+		  int nextNode = DTM.NULL;		  
+		  while ((nextNode = iter.nextNode()) != DTM.NULL) {
+			  XMLNodeCursorImpl node1 = new XMLNodeCursorImpl(nextNode, dtmManager);
+			  java.lang.String str1 = node1.str();
+			  strListR.add(str1);
+		  }
+		  
+		  ResultSequence rSeqL = (ResultSequence)left;
+		  int lSize = rSeqL.size();
+		  int rSize = strListR.size();		   
+		  for (int idx = 0; idx < lSize; idx++) {
+			 // Loop the LHS ResultSequence object			  
+			 XObject xObj1 = rSeqL.item(idx);
+			 Double lDbl = null;
+			 java.lang.String lStr = null;
+			 if (xObj1 instanceof XNumber) {
+				lDbl = ((XNumber)xObj1).num();  
+			 }
+			 else if (xObj1 instanceof XSNumericType) {
+				XSNumericType xsNumericType = (XSNumericType)xObj1;
+				lDbl = Double.valueOf(xsNumericType.stringValue());
+			 }
+			 else {
+				lStr = XslTransformEvaluationHelper.getStrVal(xObj1);  
+			 }
+			 
+			 // Loop the RHS node list string values
+			 for (int idx2 = 0; idx2 < rSize; idx2++) {
+				 java.lang.String strRhs = strListR.get(idx2);
+				 if ((lStr != null) && (lStr.compareTo(strRhs) < 0)) {
+					 return XBoolean.S_TRUE;
+				 }
+				 else if (lDbl != null) {
+					 try {	
+						 Double rDbl = Double.valueOf(strRhs);
+						 if (lDbl.doubleValue() < rDbl.doubleValue()) {
+							 return XBoolean.S_TRUE;	 
+						 }
+					 }
+					 catch (NumberFormatException ex) {
+                         // Compare lDbl's string value with string value strRhs
+						 lStr = lDbl.toString();
+						 if (lStr.compareTo(strRhs) < 0) {
+							return XBoolean.S_TRUE; 
+						 }
+					 }
+				 }
+			 }
+		  }
+		  
+		  return XBoolean.S_FALSE;
+	  }
 	  else if ((left instanceof ResultSequence) && (right instanceof ResultSequence)) {
 		  ResultSequence rSeq1 = (ResultSequence)left;
 		  ResultSequence rSeq2 = (ResultSequence)right;
diff --git a/src/test/java/org/apache/xalan/tests/main/XalanXsl3TestSuite2.java b/src/test/java/org/apache/xalan/tests/main/XalanXsl3TestSuite2.java
index c0e07aaea..617ad5a06 100644
--- a/src/test/java/org/apache/xalan/tests/main/XalanXsl3TestSuite2.java
+++ b/src/test/java/org/apache/xalan/tests/main/XalanXsl3TestSuite2.java
@@ -72,6 +72,7 @@ import org.apache.xalan.tests.xpath3.XPathSequenceFunctionTests;
 import org.apache.xalan.tests.xpath3.XPathSequenceTraversalTests;
 import org.apache.xalan.tests.xpath3.XPathSimpleMapOperatorTests;
 import org.apache.xalan.tests.xpath3.XPathStringConcatExprTests;
+import org.apache.xalan.tests.xpath3.XPathTextAndNodePattern;
 import org.apache.xalan.tests.xpath3.XPathUriQualifiedNameTests;
 import org.apache.xalan.tests.xpath3.XsDurationComponentExtractionFunctionTests;
 import org.apache.xalan.tests.xpath3.XsGregorianTypeTests;
@@ -144,7 +145,8 @@ import org.junit.runners.Suite.SuiteClasses;
                 XPathDefaultNamespaceMiscTests.class, XslFunctionMiscTests.class, XslIncludeTests.class, 
                 XslIncludeMiscTests.class, FnNormalizeUnicodeTests.class, XslExpandTextTests.class,
                 XslJsonValidationTests.class, XPathUriQualifiedNameTests.class, FnRoundHalfToEvenTests.class,
-                XPathPartialFuncApplnTests.class, XslCopyTests.class, XalanJavascriptExtensionTests.class, XalanJavaExtensionTests.class })
+                XPathPartialFuncApplnTests.class, XslCopyTests.class, XalanJavascriptExtensionTests.class, XalanJavaExtensionTests.class,
+                XPathTextAndNodePattern.class })
 public class XalanXsl3TestSuite2 {
 
 }
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_axes-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_axes-test-set_result.xml
index 85bbe0c9e..680ae8192 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_axes-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/expr/_axes-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-09-28T11:12:25Z" fail="18" name="axes" pass="183" skipped="0" statusUnknown="0" totalRun="201">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-09-29T11:57:56Z" fail="17" name="axes" pass="184" skipped="0" statusUnknown="0" totalRun="201">
    <testResult status="pass" testName="axes-001"/>
    <testResult status="pass" testName="axes-002"/>
    <testResult status="pass" testName="axes-003"/>
@@ -41,7 +41,7 @@
    <testResult status="pass" testName="axes-040"/>
    <testResult status="pass" testName="axes-041"/>
    <testResult status="pass" testName="axes-042"/>
-   <testResult status="fail" testName="axes-043"/>
+   <testResult status="pass" testName="axes-043"/>
    <testResult status="pass" testName="axes-044"/>
    <testResult status="pass" testName="axes-045"/>
    <testResult status="pass" testName="axes-046"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_boolean-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_boolean-test-set_result.xml
index ec342e727..1a8a15a21 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_boolean-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/type/_boolean-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-09-28T11:11:47Z" fail="13" name="boolean" pass="99" skipped="0" statusUnknown="0" totalRun="112">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2025-09-29T11:57:27Z" fail="12" name="boolean" pass="100" skipped="0" statusUnknown="0" totalRun="112">
    <testResult status="pass" testName="boolean-001"/>
    <testResult status="pass" testName="boolean-002"/>
    <testResult status="pass" testName="boolean-003"/>
@@ -66,7 +66,7 @@
    <testResult status="pass" testName="boolean-065"/>
    <testResult status="pass" testName="boolean-066"/>
    <testResult status="pass" testName="boolean-067"/>
-   <testResult status="fail" testName="boolean-068"/>
+   <testResult status="pass" testName="boolean-068"/>
    <testResult status="pass" testName="boolean-069"/>
    <testResult status="pass" testName="boolean-070"/>
    <testResult status="fail" testName="boolean-071"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/w3c_xslt3_testsuite_xalan-j_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/w3c_xslt3_testsuite_xalan-j_result.xml
index 975bb40a8..76785b81d 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/w3c_xslt3_testsuite_xalan-j_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/w3c_xslt3_testsuite_xalan-j_result.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<testResult dateTime="2025-09-28T11:13:19Z" desc="W3C XSLT 3.0 test suite results" fail="708" pass="1707" skipped="67" success="70.22%" totalRun="2431" xslt_processor="Xalan-J XSLT 3.0 development code">
+<testResult dateTime="2025-09-29T11:59:12Z" desc="W3C XSLT 3.0 test suite results" fail="706" pass="1709" skipped="67" success="70.3%" totalRun="2431" xslt_processor="Xalan-J XSLT 3.0 development code">
   <attr>
     <as fail="31" pass="73" skipped="4" success="69.52%" totalRun="105"/>
     <avt fail="15" pass="20" skipped="0" success="57.14%" totalRun="35"/>
@@ -15,7 +15,7 @@
     <variable fail="4" pass="15" skipped="0" success="75.0%" totalRun="20"/>
   </decl>
   <expr>
-    <axes fail="18" pass="183" skipped="0" success="91.04%" totalRun="201"/>
+    <axes fail="17" pass="184" skipped="0" success="91.54%" totalRun="201"/>
     <castable fail="3" pass="6" skipped="0" success="66.67%" totalRun="9"/>
     <expression fail="0" pass="9" skipped="0" success="90.0%" totalRun="10"/>
     <for fail="2" pass="1" skipped="0" success="25.0%" totalRun="4"/>
@@ -52,7 +52,7 @@
     <regex fail="12" pass="32" skipped="1" success="72.73%" totalRun="44"/>
   </misc>
   <type>
-    <boolean fail="13" pass="99" skipped="0" success="88.39%" totalRun="112"/>
+    <boolean fail="12" pass="100" skipped="0" success="89.29%" totalRun="112"/>
     <date fail="28" pass="56" skipped="0" success="65.88%" totalRun="85"/>
     <node fail="15" pass="17" skipped="0" success="53.12%" totalRun="32"/>
     <string fail="6" pass="130" skipped="0" success="95.59%" totalRun="136"/>
diff --git a/src/test/java/org/apache/xalan/tests/xpath3/XPathTextAndNodePattern.java b/src/test/java/org/apache/xalan/tests/xpath3/XPathTextAndNodePattern.java
new file mode 100644
index 000000000..ff91d178b
--- /dev/null
+++ b/src/test/java/org/apache/xalan/tests/xpath3/XPathTextAndNodePattern.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xalan.tests.xpath3;
+
+import org.apache.xalan.tests.util.XSLTestConstants;
+import org.apache.xalan.tests.util.XslTransformTestsUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * XSLT test cases, to test XPath 3.1 text() and 
+ * node() patterns.
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class XPathTextAndNodePattern extends XslTransformTestsUtil {        
+    
+    private static final String XSL_TRANSFORM_INPUT_DIRPATH = XSLTestConstants.XSL_TRANSFORM_INPUT_DIRPATH_PREFIX + "xpath_node_tests/";
+    
+    private static final String XSL_TRANSFORM_GOLD_DIRPATH = XSLTestConstants.XSL_TRANSFORM_GOLD_DIRPATH_PREFIX + "xpath_node_tests/gold/";
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+        // no op
+    }
+
+    @AfterClass
+    public static void tearDownAfterClass() throws Exception {        
+        m_xmlDocumentBuilderFactory = null;
+        m_xmlDocumentBuilder = null;
+        m_xslTransformerFactory = null;
+    }
+
+    @Test
+    public void xslTextAndNodeTest1() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test1.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslTextAndNodeTest2() {
+    	String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test2.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test2.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslTextAndNodeTest3() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test3.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test3.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslTextAndNodeTest4() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test4.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test4.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+
+}
diff --git a/src/test/resources/xpath_node_tests/gold/test1.out b/src/test/resources/xpath_node_tests/gold/test1.out
new file mode 100644
index 000000000..60ae23af4
--- /dev/null
+++ b/src/test/resources/xpath_node_tests/gold/test1.out
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <textNodes count="4"/>
+  <info1>
+    <text1>hello</text1>
+    <text2>there</text2>
+    <text3>this is an example</text3>
+    <text4>xml document</text4>
+  </info1>
+  <info2>
+    <x>
+      <a/>
+      <b/>
+      <c/>
+      <d/>
+    </x>
+    <y>
+      <c/>
+      <d/>
+    </y>
+  </info2>
+  <info3>this is an example</info3>
+</result>
diff --git a/src/test/resources/xpath_node_tests/gold/test2.out b/src/test/resources/xpath_node_tests/gold/test2.out
new file mode 100644
index 000000000..89df83e7a
--- /dev/null
+++ b/src/test/resources/xpath_node_tests/gold/test2.out
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <node count="8"/>
+  <info1>
+    <text1>hello</text1>
+    <text2>there</text2>
+    <text3>this is an example</text3>
+    <text4>xml document</text4>
+    <a/>
+    <b/>
+    <c/>
+    <d/>
+  </info1>
+  <info2>
+    <c/>
+    <d/>
+  </info2>
+</result>
diff --git a/src/test/resources/xpath_node_tests/gold/test3.out b/src/test/resources/xpath_node_tests/gold/test3.out
new file mode 100644
index 000000000..60ae23af4
--- /dev/null
+++ b/src/test/resources/xpath_node_tests/gold/test3.out
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <textNodes count="4"/>
+  <info1>
+    <text1>hello</text1>
+    <text2>there</text2>
+    <text3>this is an example</text3>
+    <text4>xml document</text4>
+  </info1>
+  <info2>
+    <x>
+      <a/>
+      <b/>
+      <c/>
+      <d/>
+    </x>
+    <y>
+      <c/>
+      <d/>
+    </y>
+  </info2>
+  <info3>this is an example</info3>
+</result>
diff --git a/src/test/resources/xpath_node_tests/gold/test4.out b/src/test/resources/xpath_node_tests/gold/test4.out
new file mode 100644
index 000000000..82a900449
--- /dev/null
+++ b/src/test/resources/xpath_node_tests/gold/test4.out
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <a>4,8</a>
+  <b>4,8</b>
+  <nodeSet1>
+    <c/>
+    <d/>
+  </nodeSet1>
+  <text nodeCount="2">this is an examplexml document</text>
+</result>
diff --git a/src/test/resources/xpath_node_tests/test1.xml b/src/test/resources/xpath_node_tests/test1.xml
new file mode 100644
index 000000000..53d2787b7
--- /dev/null
+++ b/src/test/resources/xpath_node_tests/test1.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<info>hello<a/><b/>there<c/>this is an example<d/>xml document</info>
diff --git a/src/test/resources/xpath_node_tests/test1.xsl b/src/test/resources/xpath_node_tests/test1.xsl
new file mode 100644
index 000000000..f8275d5f5
--- /dev/null
+++ b/src/test/resources/xpath_node_tests/test1.xsl
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"				
+                version="3.0">				    
+    
+    <!-- Author: mukulg@apache.org -->
+    
+    <!-- use with test1.xml -->
+  
+    <!-- An XSLT test case, to test XPath 3.1 text() pattern. -->				
+				
+    <xsl:output method="xml" indent="yes"/>	
+				
+	<xsl:template match="/info">
+		<result>
+		   <textNodes count="{count(text())}"/>
+		   <info1>
+			  <text1><xsl:value-of select="text()[1]"/></text1>
+			  <text2><xsl:value-of select="text()[2]"/></text2>
+			  <text3><xsl:value-of select="text()[3]"/></text3>
+			  <text4><xsl:value-of select="text()[4]"/></text4>
+		   </info1>		   
+		   <info2>
+		      <x>
+		         <xsl:copy-of select="text()[. = 'hello']/following-sibling::*"/>
+			  </x>
+			  <y>
+		         <xsl:copy-of select="text()[. = 'there']/following-sibling::*"/>
+			  </y>
+		   </info2>
+		   <info3>		      
+			  <xsl:value-of select="let $seq1 := text() return $seq1[3]"/>
+		   </info3>
+		</result>
+	</xsl:template>
+	
+	<!--
+      * Licensed to the Apache Software Foundation (ASF) under one
+      * or more contributor license agreements. See the NOTICE file
+      * distributed with this work for additional information
+      * regarding copyright ownership. The ASF licenses this file
+      * to you under the Apache License, Version 2.0 (the "License");
+      * you may not use this file except in compliance with the License.
+      * You may obtain a copy of the License at
+      *
+      *     http://www.apache.org/licenses/LICENSE-2.0
+      *
+      * Unless required by applicable law or agreed to in writing, software
+      * distributed under the License is distributed on an "AS IS" BASIS,
+      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      * See the License for the specific language governing permissions and
+      * limitations under the License.
+    -->
+	
+</xsl:stylesheet>
diff --git a/src/test/resources/xpath_node_tests/test2.xsl b/src/test/resources/xpath_node_tests/test2.xsl
new file mode 100644
index 000000000..8d73163ce
--- /dev/null
+++ b/src/test/resources/xpath_node_tests/test2.xsl
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"				
+                version="3.0">
+				
+    <!-- Author: mukulg@apache.org -->
+    
+    <!-- use with test1.xml -->
+  
+    <!-- An XSLT test case, to test XPath 3.1 node() pattern. -->				
+				
+    <xsl:output method="xml" indent="yes"/>	
+				
+	<xsl:template match="/info">
+		<result>
+		   <node count="{count(node())}"/>
+		   <info1>
+			  <text1><xsl:value-of select="node()[1]"/></text1>
+			  <text2><xsl:value-of select="node()[4]"/></text2>
+			  <text3><xsl:value-of select="node()[6]"/></text3>
+			  <text4><xsl:value-of select="node()[8]"/></text4>
+			  <xsl:apply-templates select="(node()[2], node()[3], node()[5], node()[7])"/>
+		   </info1>
+		   <info2>
+		      <xsl:copy-of select="node()[self::b]/following-sibling::*"/>
+		   </info2>
+		</result>
+	</xsl:template>
+	
+	<xsl:template match="*">
+	   <xsl:element name="{name()}"/>
+	</xsl:template>
+	
+	<!--
+      * Licensed to the Apache Software Foundation (ASF) under one
+      * or more contributor license agreements. See the NOTICE file
+      * distributed with this work for additional information
+      * regarding copyright ownership. The ASF licenses this file
+      * to you under the Apache License, Version 2.0 (the "License");
+      * you may not use this file except in compliance with the License.
+      * You may obtain a copy of the License at
+      *
+      *     http://www.apache.org/licenses/LICENSE-2.0
+      *
+      * Unless required by applicable law or agreed to in writing, software
+      * distributed under the License is distributed on an "AS IS" BASIS,
+      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      * See the License for the specific language governing permissions and
+      * limitations under the License.
+    -->
+	
+</xsl:stylesheet>
diff --git a/src/test/resources/xpath_node_tests/test3.xsl b/src/test/resources/xpath_node_tests/test3.xsl
new file mode 100644
index 000000000..0953c505c
--- /dev/null
+++ b/src/test/resources/xpath_node_tests/test3.xsl
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"				
+                version="3.0">
+				
+    <!-- Author: mukulg@apache.org -->
+    
+    <!-- use with test1.xml -->
+  
+    <!-- An XSLT test case, to test XPath 3.1 text() pattern. -->		
+				
+    <xsl:output method="xml" indent="yes"/>	
+				
+	<xsl:template match="/">
+		<result>
+		   <textNodes count="{count(let $x := /info/text() return $x)}"/>
+		   <info1>
+			  <text1><xsl:value-of select="/info/text()[1]"/></text1>
+			  <text2><xsl:value-of select="/info/text()[2]"/></text2>
+			  <text3><xsl:value-of select="/info/text()[3]"/></text3>
+			  <text4><xsl:value-of select="/info/text()[4]"/></text4>
+		   </info1>		   
+		   <info2>
+		      <x>
+		         <xsl:copy-of select="/info/text()[. = 'hello']/following-sibling::*"/>
+			  </x>
+			  <y>
+		         <xsl:copy-of select="/info/text()[. = 'there']/following-sibling::*"/>
+			  </y>
+		   </info2>
+		   <info3>		      
+			  <xsl:value-of select="let $seq1 := /info/text() return $seq1[3]"/>
+		   </info3>
+		</result>
+	</xsl:template>
+	
+	<!--
+      * Licensed to the Apache Software Foundation (ASF) under one
+      * or more contributor license agreements. See the NOTICE file
+      * distributed with this work for additional information
+      * regarding copyright ownership. The ASF licenses this file
+      * to you under the Apache License, Version 2.0 (the "License");
+      * you may not use this file except in compliance with the License.
+      * You may obtain a copy of the License at
+      *
+      *     http://www.apache.org/licenses/LICENSE-2.0
+      *
+      * Unless required by applicable law or agreed to in writing, software
+      * distributed under the License is distributed on an "AS IS" BASIS,
+      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      * See the License for the specific language governing permissions and
+      * limitations under the License.
+    -->
+	
+</xsl:stylesheet>
diff --git a/src/test/resources/xpath_node_tests/test4.xsl b/src/test/resources/xpath_node_tests/test4.xsl
new file mode 100644
index 000000000..7d7070e8f
--- /dev/null
+++ b/src/test/resources/xpath_node_tests/test4.xsl
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"				
+                version="3.0">
+				
+    <!-- Author: mukulg@apache.org -->
+    
+    <!-- use with test1.xml -->
+  
+    <!-- An XSLT test case, to test XPath 3.1 text() and node() patterns. -->			
+				
+    <xsl:output method="xml" indent="yes"/>	
+				
+	<xsl:template match="/">
+		<result>
+		   <a>
+		      <xsl:value-of select="count(info/text())"/>,<xsl:value-of select="count(info/node())"/>
+		   </a>
+		   <b>
+		      <xsl:value-of select="count(/info/text())"/>,<xsl:value-of select="count(/info/node())"/>
+		   </b>
+		   <nodeSet1>
+		      <xsl:copy-of select="info/node()[self::b]/following-sibling::*"/>
+		   </nodeSet1>
+		   <xsl:variable name="seq1" select="info/text()[. = 'there']/following-sibling::text()"/>
+		   <text nodeCount="{count($seq1)}">
+		      <xsl:copy-of select="$seq1"/>
+		   </text>
+		</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>


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