[prev in list] [next in list] [prev in thread] [next in thread]
List: xalan-cvs
Subject: [xalan-java] branch xalan-j_xslt3.0 updated: committing implementation of xpath 3.1 value comparison
From: mukulg () apache ! org
Date: 2023-06-25 14:19:24
Message-ID: 168770276479.109991.2456350481419074439 () gitbox2-he-fi ! apache ! org
[Download RAW message or body]
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 2a1f171b committing implementation of xpath 3.1 value comparison operators \
gt, le, ge. also committing few other xalanj miscellaneous codebase improvements on \
this xalanj dev branch, and few new related working test cases as \
well.
new a80e1649 Merge pull request #11 from mukulga/xalan-j_xslt3.0_mukul
2a1f171b is described below
commit 2a1f171bc8912dda76726d2da94549fb5c919e29
Author: Mukul Gandhi <gandhi.mukul@gmail.com>
AuthorDate: Sun Jun 25 19:39:05 2023 +0530
committing implementation of xpath 3.1 value comparison operators gt, le, ge. \
also committing few other xalanj miscellaneous codebase improvements on this xalanj \
dev branch, and few new related working test cases as well.
---
.../extensions/ExtensionHandlerJavaPackage.java | 29 ++++-
src/org/apache/xpath/compiler/Compiler.java | 36 ++++++
src/org/apache/xpath/compiler/OpCodes.java | 23 +++-
src/org/apache/xpath/compiler/XPathParser.java | 45 ++++++++
src/org/apache/xpath/objects/XObject.java | 127 +++++++++++++++++----
src/org/apache/xpath/operations/VcEquals.java | 2 +-
.../xpath/operations/{VcLt.java => VcGe.java} | 6 +-
.../xpath/operations/{VcLt.java => VcGt.java} | 6 +-
.../xpath/operations/{VcLt.java => VcLe.java} | 6 +-
src/org/apache/xpath/operations/VcLt.java | 2 +-
src/org/apache/xpath/operations/VcNotEquals.java | 2 +-
src/org/apache/xpath/res/XPATHErrorResources.java | 27 ++++-
.../apache/xalan/xpath3/ValueComparisonTests.java | 70 ++++++++++++
tests/org/apache/xalan/xslt3/XSLConstants.java | 4 +-
tests/org/apache/xalan/xslt3/XslIterateTests.java | 10 ++
tests/xpath_value_comparison/gold/test10.out | 5 +
tests/xpath_value_comparison/gold/test11.out | 14 +++
tests/xpath_value_comparison/gold/test12.out | 12 ++
tests/xpath_value_comparison/gold/test13.out | 16 +++
tests/xpath_value_comparison/gold/test14.out | 16 +++
tests/xpath_value_comparison/gold/test8.out | 5 +
tests/xpath_value_comparison/gold/test9.out | 5 +
tests/xpath_value_comparison/test10.xsl | 38 ++++++
tests/xpath_value_comparison/test11.xsl | 46 ++++++++
tests/xpath_value_comparison/test12.xsl | 47 ++++++++
tests/xpath_value_comparison/test13.xsl | 43 +++++++
tests/xpath_value_comparison/test14.xsl | 43 +++++++
tests/xpath_value_comparison/test1_c.xml | 9 ++
tests/xpath_value_comparison/test1_d.xml | 9 ++
tests/xpath_value_comparison/test1_e.xml | 13 +++
tests/xpath_value_comparison/test8.xsl | 38 ++++++
tests/xpath_value_comparison/test9.xsl | 38 ++++++
tests/xsl_iterate/gold/test14.out | 8 ++
tests/xsl_iterate/test14.xsl | 48 ++++++++
tests/xsl_iterate/test1_e.xml | 13 +++
35 files changed, 819 insertions(+), 42 deletions(-)
diff --git a/src/org/apache/xalan/extensions/ExtensionHandlerJavaPackage.java \
b/src/org/apache/xalan/extensions/ExtensionHandlerJavaPackage.java index \
fcdcc4cc..f7d09744 100644
--- a/src/org/apache/xalan/extensions/ExtensionHandlerJavaPackage.java
+++ b/src/org/apache/xalan/extensions/ExtensionHandlerJavaPackage.java
@@ -33,10 +33,12 @@ import org.apache.xalan.res.XSLMessages;
import org.apache.xalan.res.XSLTErrorResources;
import org.apache.xalan.templates.ElemTemplateElement;
import org.apache.xalan.templates.Stylesheet;
+import org.apache.xalan.templates.XSConstructorFunctionUtil;
import org.apache.xalan.trace.ExtensionEvent;
import org.apache.xalan.transformer.TransformerImpl;
import org.apache.xpath.functions.FuncExtFunction;
import org.apache.xpath.objects.XObject;
+import org.xml.sax.SAXException;
/**
* Represents an extension namespace for XPath that handles java packages
@@ -58,8 +60,6 @@ import org.apache.xpath.objects.XObject;
*
* @xsl.usage internal
*/
-
-
public class ExtensionHandlerJavaPackage extends ExtensionHandlerJava
{
@@ -434,11 +434,28 @@ public class ExtensionHandlerJavaPackage extends \
ExtensionHandlerJava
*/
public Object callFunction(FuncExtFunction extFunction,
Vector args,
- ExpressionContext exprContext)
- throws TransformerException
+ ExpressionContext exprContext) throws \
TransformerException {
- return callFunction(extFunction.getFunctionName(), args,
- extFunction.getMethodKey(), exprContext);
+
+ Object funcEvalResult = null;
+
+ try {
+ XObject evalResult = \
XSConstructorFunctionUtil.processFuncExtFunctionOrXPathOpn + \
(exprContext.getXPathContext(), extFunction); + if (evalResult != null) {
+ funcEvalResult = evalResult;
+ }
+ else {
+ funcEvalResult = callFunction(extFunction.getFunctionName(), args, \
extFunction.getMethodKey(), + \
exprContext); + }
+ }
+ catch (SAXException ex) {
+ throw new TransformerException(ex);
+ }
+
+ return funcEvalResult;
+
}
/**
diff --git a/src/org/apache/xpath/compiler/Compiler.java \
b/src/org/apache/xpath/compiler/Compiler.java index d3ce8db2..d56e8560 100644
--- a/src/org/apache/xpath/compiler/Compiler.java
+++ b/src/org/apache/xpath/compiler/Compiler.java
@@ -59,6 +59,9 @@ import org.apache.xpath.operations.Range;
import org.apache.xpath.operations.UnaryOperation;
import org.apache.xpath.operations.Variable;
import org.apache.xpath.operations.VcEquals;
+import org.apache.xpath.operations.VcGe;
+import org.apache.xpath.operations.VcGt;
+import org.apache.xpath.operations.VcLe;
import org.apache.xpath.operations.VcLt;
import org.apache.xpath.operations.VcNotEquals;
import org.apache.xpath.patterns.FunctionPattern;
@@ -140,6 +143,12 @@ public class Compiler extends OpMap
expr = vcNotEquals(opPos); break;
case OpCodes.OP_VC_LT :
expr = vcLt(opPos); break;
+ case OpCodes.OP_VC_GT :
+ expr = vcGt(opPos); break;
+ case OpCodes.OP_VC_LE :
+ expr = vcLe(opPos); break;
+ case OpCodes.OP_VC_GE :
+ expr = vcGe(opPos); break;
case OpCodes.OP_LTE :
expr = lte(opPos); break;
case OpCodes.OP_LT :
@@ -359,6 +368,33 @@ public class Compiler extends OpMap
{
return compileOperation(new VcLt(), opPos);
}
+
+ /**
+ * Compile an XPath 3.1 value comparison 'gt' operation.
+ *
+ */
+ protected Expression vcGt(int opPos) throws TransformerException
+ {
+ return compileOperation(new VcGt(), opPos);
+ }
+
+ /**
+ * Compile an XPath 3.1 value comparison 'le' operation.
+ *
+ */
+ protected Expression vcLe(int opPos) throws TransformerException
+ {
+ return compileOperation(new VcLe(), opPos);
+ }
+
+ /**
+ * Compile an XPath 3.1 value comparison 'ge' operation.
+ *
+ */
+ protected Expression vcGe(int opPos) throws TransformerException
+ {
+ return compileOperation(new VcGe(), opPos);
+ }
/**
* Compile a '>=' operation.
diff --git a/src/org/apache/xpath/compiler/OpCodes.java \
b/src/org/apache/xpath/compiler/OpCodes.java index 80d07447..82076356 100644
--- a/src/org/apache/xpath/compiler/OpCodes.java
+++ b/src/org/apache/xpath/compiler/OpCodes.java
@@ -654,8 +654,29 @@ public class OpCodes
* @xsl.usage advanced
*/
public static final int OP_VC_LT = 57;
+
+ /**
+ * For XPath 3.1 value comparison operator "gt".
+ *
+ * @xsl.usage advanced
+ */
+ public static final int OP_VC_GT = 58;
+
+ /**
+ * For XPath 3.1 value comparison operator "le".
+ *
+ * @xsl.usage advanced
+ */
+ public static final int OP_VC_LE = 59;
+
+ /**
+ * For XPath 3.1 value comparison operator "ge".
+ *
+ * @xsl.usage advanced
+ */
+ public static final int OP_VC_GE = 60;
/** The next free ID. Please keep this up to date. */
- private static final int NEXT_FREE_ID = 58;
+ private static final int NEXT_FREE_ID = 61;
}
diff --git a/src/org/apache/xpath/compiler/XPathParser.java \
b/src/org/apache/xpath/compiler/XPathParser.java index b697beb4..ec199d32 100644
--- a/src/org/apache/xpath/compiler/XPathParser.java
+++ b/src/org/apache/xpath/compiler/XPathParser.java
@@ -1032,6 +1032,51 @@ public class XPathParser
int op1 = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos;
+ addPos = RelationalExpr(addPos);
+ m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH,
+ m_ops.getOp(addPos + op1 + 1) + op1);
+ addPos += 2;
+ }
+ else if (tokenIs("gt"))
+ {
+ // support for XPath 3.1 value comparison operator "gt"
+
+ nextToken();
+
+ insertOp(addPos, 2, OpCodes.OP_VC_GT);
+
+ int op1 = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos;
+
+ addPos = RelationalExpr(addPos);
+ m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH,
+ m_ops.getOp(addPos + op1 + 1) + op1);
+ addPos += 2;
+ }
+ else if (tokenIs("le"))
+ {
+ // support for XPath 3.1 value comparison operator "le"
+
+ nextToken();
+
+ insertOp(addPos, 2, OpCodes.OP_VC_LE);
+
+ int op1 = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos;
+
+ addPos = RelationalExpr(addPos);
+ m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH,
+ m_ops.getOp(addPos + op1 + 1) + op1);
+ addPos += 2;
+ }
+ else if (tokenIs("ge"))
+ {
+ // support for XPath 3.1 value comparison operator "ge"
+
+ nextToken();
+
+ insertOp(addPos, 2, OpCodes.OP_VC_GE);
+
+ int op1 = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos;
+
addPos = RelationalExpr(addPos);
m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH,
m_ops.getOp(addPos + op1 + 1) + op1);
diff --git a/src/org/apache/xpath/objects/XObject.java \
b/src/org/apache/xpath/objects/XObject.java index 79c2415c..d7f38c8b 100644
--- a/src/org/apache/xpath/objects/XObject.java
+++ b/src/org/apache/xpath/objects/XObject.java
@@ -565,19 +565,22 @@ public class XObject extends Expression implements \
Serializable, Cloneable
*
* @param obj2 Object to compare this to
* @param expressionOwner this object is used, for error reporting
+ * @param isLtTest is this method called, to check "lt" or "ge"
+ * operation. true, if that's "lt" check and false
+ * otherwise.
*
* @return True if this object is less than the given object
*
* @throws javax.xml.transform.TransformerException
*
- * Notes : Currently, we don't implement following XPath 3.1 spec definitions for
- * value comparison operator "lt",
- * 1) XPath 3.1 spec, requires atomizing the operands of XPath operator \
"lt",
- * before applying operator "lt" to the operands.
- * 2) If any of the operands of operator "lt", after atomization is an \
empty
- * sequence, the result of operation "lt" should be an empty sequence. \
- */
- public boolean vcLessThan(XObject obj2, ExpressionNode expressionOwner) throws
+ * Notes : Currently, we haven't implemented following XPath 3.1 spec definitions \
for + * value comparison operator "lt"/"ge",
+ * 1) XPath 3.1 spec, requires atomizing the operands of XPath operator \
"lt"/"ge", + * before applying operator "lt"/"ge" to the operands.
+ * 2) If any of the operands of operator "lt"/"ge", after atomization is \
an empty + * sequence, the result of operation "lt"/"ge" should be an \
empty sequence. + */
+ public boolean vcLessThan(XObject obj2, ExpressionNode expressionOwner, boolean \
isLtTest) throws
\
javax.xml.transform.TransformerException {
if ((this instanceof XSDecimal) && (obj2 instanceof XSDecimal)) {
@@ -611,14 +614,16 @@ public class XObject extends Expression implements \
Serializable, Cloneable if (this.getType() == XObject.CLASS_NODESET) {
isOperandNodeSet1 = true;
if ((((XNodeSet)this).getLength() > 1)) {
- error(XPATHErrorResources.ER_EQ_OPERAND_CARDINALITY_ERROR, null, \
expressionOwner); + error(isLtTest ? \
XPATHErrorResources.ER_LT_OPERAND_CARDINALITY_ERROR : + \
XPATHErrorResources.ER_GE_OPERAND_CARDINALITY_ERROR, null, expressionOwner); }
}
if (obj2.getType() == XObject.CLASS_NODESET) {
isOperandNodeSet2 = true;
if ((((XNodeSet)obj2).getLength() > 1)) {
- error(XPATHErrorResources.ER_EQ_OPERAND_CARDINALITY_ERROR, null, \
expressionOwner); + error(isLtTest ? \
XPATHErrorResources.ER_LT_OPERAND_CARDINALITY_ERROR : + \
XPATHErrorResources.ER_GE_OPERAND_CARDINALITY_ERROR, null, expressionOwner); }
}
@@ -629,7 +634,84 @@ public class XObject extends Expression implements Serializable, \
Cloneable return obj2.num() < this.num();
}
- // revisit
+ return true;
+ }
+
+ /**
+ * Tell if one object is greater than an another one, using the rules
+ * of value comparison operator "gt".
+ *
+ * @param obj2 Object to compare this to
+ * @param expressionOwner this object is used, for error reporting
+ * @param isGtTest is this method called, to check "gt" or "le"
+ * operation. true, if that's "gt" check and false
+ * otherwise.
+ *
+ * @return True if this object is greater than the given object
+ *
+ * @throws javax.xml.transform.TransformerException
+ *
+ * Notes : Currently, we haven't implemented following XPath 3.1 spec definitions \
for + * value comparison operator "gt"/"le",
+ * 1) XPath 3.1 spec, requires atomizing the operands of XPath operator \
"gt"/"le", + * before applying operator "gt"/"le" to the operands.
+ * 2) If any of the operands of operator "gt"/"le", after atomization is \
an empty + * sequence, the result of operation "gt"/"le" should be an \
empty sequence. + */
+ public boolean vcGreaterThan(XObject obj2, ExpressionNode expressionOwner, boolean \
isGtTest) throws + \
javax.xml.transform.TransformerException { +
+ if ((this instanceof XSDecimal) && (obj2 instanceof XSDecimal)) {
+ return ((XSDecimal)this).gt((XSDecimal)obj2);
+ }
+ else if ((this instanceof XSFloat) && (obj2 instanceof XSFloat)) {
+ return ((XSFloat)this).gt((XSFloat)obj2);
+ }
+ else if ((this instanceof XSDouble) && (obj2 instanceof XSDouble)) {
+ return ((XSDouble)this).gt((XSDouble)obj2);
+ }
+ else if ((this instanceof XSBoolean) && (obj2 instanceof XSBoolean)) {
+ return ((XSBoolean)this).gt((XSBoolean)obj2);
+ }
+ else if ((this instanceof XSInteger) && (obj2 instanceof XSInteger)) {
+ return ((XSInteger)this).gt((XSInteger)obj2);
+ }
+ else if ((this instanceof XSLong) && (obj2 instanceof XSLong)) {
+ return ((XSLong)this).gt((XSLong)obj2);
+ }
+ else if ((this instanceof XSInt) && (obj2 instanceof XSInt)) {
+ return ((XSInt)this).gt((XSInt)obj2);
+ }
+ else if ((this instanceof XSDate) && (obj2 instanceof XSDate)) {
+ return ((XSDate)this).gt((XSDate)obj2);
+ }
+
+ boolean isOperandNodeSet1 = false;
+ boolean isOperandNodeSet2 = false;
+
+ if (this.getType() == XObject.CLASS_NODESET) {
+ isOperandNodeSet1 = true;
+ if ((((XNodeSet)this).getLength() > 1)) {
+ error(isGtTest ? XPATHErrorResources.ER_GT_OPERAND_CARDINALITY_ERROR : \
+ \
XPATHErrorResources.ER_LE_OPERAND_CARDINALITY_ERROR, null, expressionOwner); + \
} + }
+
+ if (obj2.getType() == XObject.CLASS_NODESET) {
+ isOperandNodeSet2 = true;
+ if ((((XNodeSet)obj2).getLength() > 1)) {
+ error(isGtTest ? XPATHErrorResources.ER_GT_OPERAND_CARDINALITY_ERROR : \
+ \
XPATHErrorResources.ER_LE_OPERAND_CARDINALITY_ERROR, null, expressionOwner); + \
} + }
+
+ if (isOperandNodeSet1 || this instanceof XNumber) {
+ return this.num() > obj2.num();
+ }
+ else if (isOperandNodeSet2 || obj2 instanceof XNumber) {
+ return obj2.num() > this.num();
+ }
+
return true;
}
@@ -759,20 +841,23 @@ public class XObject extends Expression implements \
Serializable, Cloneable
*
* @param obj2 Object to compare this to
* @param expressionOwner this object is used, for error reporting
+ * @param isEqTest is this method called, to check "eq" or "ne"
+ * operation. true, if that's "eq" check and false
+ * otherwise.
*
* @return True if this object is equal to the given object
*
* @throws javax.xml.transform.TransformerException
*
- * Notes : Currently, we don't implement following XPath 3.1 spec definitions for
- * value comparison operator "eq",
- * 1) XPath 3.1 spec, requires atomizing the operands of XPath operator \
"eq",
- * before applying operator "eq" to the operands.
- * 2) If any of the operands of operator "eq", after atomization is an \
empty
- * sequence, the result of operation "eq" should be an empty sequence.
+ * Notes : Currently, we haven't implemented following XPath 3.1 spec definitions \
for + * value comparison operator "eq"/"ne",
+ * 1) XPath 3.1 spec, requires atomizing the operands of XPath operator \
"eq"/"ne", + * before applying operator "eq"/"ne" to the operands.
+ * 2) If any of the operands of operator "eq"/"ne", after atomization is \
an empty + * sequence, the result of operation "eq"/"ne" should be an \
empty sequence.
* Instead, we return the result as false for such cases.
*/
- public boolean vcEquals(XObject obj2, ExpressionNode expressionOwner)
+ public boolean vcEquals(XObject obj2, ExpressionNode expressionOwner, boolean \
isEqTest)
throws \
javax.xml.transform.TransformerException {
if ((this instanceof XSDecimal) && (obj2 instanceof XSDecimal)) {
@@ -806,14 +891,16 @@ public class XObject extends Expression implements \
Serializable, Cloneable if (this.getType() == XObject.CLASS_NODESET) {
isOperandNodeSet1 = true;
if ((((XNodeSet)this).getLength() > 1)) {
- error(XPATHErrorResources.ER_EQ_OPERAND_CARDINALITY_ERROR, null, \
expressionOwner); + error(isEqTest ? \
XPATHErrorResources.ER_EQ_OPERAND_CARDINALITY_ERROR : + \
XPATHErrorResources.ER_NE_OPERAND_CARDINALITY_ERROR, null, expressionOwner); }
}
if (obj2.getType() == XObject.CLASS_NODESET) {
isOperandNodeSet2 = true;
if ((((XNodeSet)obj2).getLength() > 1)) {
- error(XPATHErrorResources.ER_EQ_OPERAND_CARDINALITY_ERROR, null, \
expressionOwner); + error(isEqTest ? \
XPATHErrorResources.ER_EQ_OPERAND_CARDINALITY_ERROR : + \
XPATHErrorResources.ER_NE_OPERAND_CARDINALITY_ERROR, null, expressionOwner); }
}
diff --git a/src/org/apache/xpath/operations/VcEquals.java \
b/src/org/apache/xpath/operations/VcEquals.java index 2092d9c6..881751d0 100644
--- a/src/org/apache/xpath/operations/VcEquals.java
+++ b/src/org/apache/xpath/operations/VcEquals.java
@@ -46,7 +46,7 @@ public class VcEquals extends Operation
public XObject operate(XObject left, XObject right) throws
\
javax.xml.transform.TransformerException {
- return left.vcEquals(right, getExpressionOwner()) ? XBoolean.S_TRUE : \
XBoolean.S_FALSE; + return left.vcEquals(right, getExpressionOwner(), true) ? \
XBoolean.S_TRUE : XBoolean.S_FALSE; }
}
diff --git a/src/org/apache/xpath/operations/VcLt.java \
b/src/org/apache/xpath/operations/VcGe.java similarity index 89%
copy from src/org/apache/xpath/operations/VcLt.java
copy to src/org/apache/xpath/operations/VcGe.java
index 0928099b..aaa54f51 100644
--- a/src/org/apache/xpath/operations/VcLt.java
+++ b/src/org/apache/xpath/operations/VcGe.java
@@ -24,13 +24,13 @@ import org.apache.xpath.objects.XBoolean;
import org.apache.xpath.objects.XObject;
/**
- * The XPath 3.1 value comparison "lt" operation.
+ * The XPath 3.1 value comparison "ge" operation.
*
* @author Mukul Gandhi <mukulg@apache.org>
*
* @xsl.usage advanced
*/
-public class VcLt extends Operation
+public class VcGe extends Operation
{
private static final long serialVersionUID = 3832212036565766741L;
@@ -49,6 +49,6 @@ public class VcLt extends Operation
public XObject operate(XObject left, XObject right)
throws \
javax.xml.transform.TransformerException {
- return left.vcLessThan(right, getExpressionOwner()) ? XBoolean.S_TRUE : \
XBoolean.S_FALSE; + return left.vcLessThan(right, getExpressionOwner(), false) ? \
XBoolean.S_FALSE : XBoolean.S_TRUE; }
}
diff --git a/src/org/apache/xpath/operations/VcLt.java \
b/src/org/apache/xpath/operations/VcGt.java similarity index 89%
copy from src/org/apache/xpath/operations/VcLt.java
copy to src/org/apache/xpath/operations/VcGt.java
index 0928099b..43a0f6c2 100644
--- a/src/org/apache/xpath/operations/VcLt.java
+++ b/src/org/apache/xpath/operations/VcGt.java
@@ -24,13 +24,13 @@ import org.apache.xpath.objects.XBoolean;
import org.apache.xpath.objects.XObject;
/**
- * The XPath 3.1 value comparison "lt" operation.
+ * The XPath 3.1 value comparison "gt" operation.
*
* @author Mukul Gandhi <mukulg@apache.org>
*
* @xsl.usage advanced
*/
-public class VcLt extends Operation
+public class VcGt extends Operation
{
private static final long serialVersionUID = 3832212036565766741L;
@@ -49,6 +49,6 @@ public class VcLt extends Operation
public XObject operate(XObject left, XObject right)
throws \
javax.xml.transform.TransformerException {
- return left.vcLessThan(right, getExpressionOwner()) ? XBoolean.S_TRUE : \
XBoolean.S_FALSE; + return left.vcGreaterThan(right, getExpressionOwner(), true) \
? XBoolean.S_TRUE : XBoolean.S_FALSE; }
}
diff --git a/src/org/apache/xpath/operations/VcLt.java \
b/src/org/apache/xpath/operations/VcLe.java similarity index 89%
copy from src/org/apache/xpath/operations/VcLt.java
copy to src/org/apache/xpath/operations/VcLe.java
index 0928099b..67372a01 100644
--- a/src/org/apache/xpath/operations/VcLt.java
+++ b/src/org/apache/xpath/operations/VcLe.java
@@ -24,13 +24,13 @@ import org.apache.xpath.objects.XBoolean;
import org.apache.xpath.objects.XObject;
/**
- * The XPath 3.1 value comparison "lt" operation.
+ * The XPath 3.1 value comparison "le" operation.
*
* @author Mukul Gandhi <mukulg@apache.org>
*
* @xsl.usage advanced
*/
-public class VcLt extends Operation
+public class VcLe extends Operation
{
private static final long serialVersionUID = 3832212036565766741L;
@@ -49,6 +49,6 @@ public class VcLt extends Operation
public XObject operate(XObject left, XObject right)
throws \
javax.xml.transform.TransformerException {
- return left.vcLessThan(right, getExpressionOwner()) ? XBoolean.S_TRUE : \
XBoolean.S_FALSE; + return left.vcGreaterThan(right, getExpressionOwner(), \
false) ? XBoolean.S_FALSE : XBoolean.S_TRUE; }
}
diff --git a/src/org/apache/xpath/operations/VcLt.java \
b/src/org/apache/xpath/operations/VcLt.java index 0928099b..3412f133 100644
--- a/src/org/apache/xpath/operations/VcLt.java
+++ b/src/org/apache/xpath/operations/VcLt.java
@@ -49,6 +49,6 @@ public class VcLt extends Operation
public XObject operate(XObject left, XObject right)
throws \
javax.xml.transform.TransformerException {
- return left.vcLessThan(right, getExpressionOwner()) ? XBoolean.S_TRUE : \
XBoolean.S_FALSE; + return left.vcLessThan(right, getExpressionOwner(), true) ? \
XBoolean.S_TRUE : XBoolean.S_FALSE; }
}
diff --git a/src/org/apache/xpath/operations/VcNotEquals.java \
b/src/org/apache/xpath/operations/VcNotEquals.java index 35bc7bd5..da447b55 100644
--- a/src/org/apache/xpath/operations/VcNotEquals.java
+++ b/src/org/apache/xpath/operations/VcNotEquals.java
@@ -46,7 +46,7 @@ public class VcNotEquals extends Operation
public XObject operate(XObject left, XObject right) throws
\
javax.xml.transform.TransformerException {
- return left.vcEquals(right, getExpressionOwner()) ? XBoolean.S_FALSE : \
XBoolean.S_TRUE; + return left.vcEquals(right, getExpressionOwner(), false) ? \
XBoolean.S_FALSE : XBoolean.S_TRUE; }
}
diff --git a/src/org/apache/xpath/res/XPATHErrorResources.java \
b/src/org/apache/xpath/res/XPATHErrorResources.java index db64c362..eeed93a3 100644
--- a/src/org/apache/xpath/res/XPATHErrorResources.java
+++ b/src/org/apache/xpath/res/XPATHErrorResources.java
@@ -370,6 +370,16 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
public static final String ER_INVALID_REGEX = "ER_INVALID_REGEX";
public static final String ER_EQ_OPERAND_CARDINALITY_ERROR = \
"ER_EQ_OPERAND_CARDINALITY_ERROR"; +
+ public static final String ER_NE_OPERAND_CARDINALITY_ERROR = \
"ER_NE_OPERAND_CARDINALITY_ERROR"; +
+ public static final String ER_LT_OPERAND_CARDINALITY_ERROR = \
"ER_LT_OPERAND_CARDINALITY_ERROR"; +
+ public static final String ER_GT_OPERAND_CARDINALITY_ERROR = \
"ER_GT_OPERAND_CARDINALITY_ERROR"; +
+ public static final String ER_LE_OPERAND_CARDINALITY_ERROR = \
"ER_LE_OPERAND_CARDINALITY_ERROR"; +
+ public static final String ER_GE_OPERAND_CARDINALITY_ERROR = \
"ER_GE_OPERAND_CARDINALITY_ERROR";
// Error messages...
@@ -863,8 +873,23 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
{ ER_EQ_OPERAND_CARDINALITY_ERROR,
"XPTY0004 : none of the eq's operands can be a sequence with length greater \
than one."}, +
+ { ER_NE_OPERAND_CARDINALITY_ERROR,
+ "XPTY0004 : none of the ne's operands can be a sequence with length greater \
than one."}, +
+ { ER_LT_OPERAND_CARDINALITY_ERROR,
+ "XPTY0004 : none of the lt's operands can be a sequence with length greater \
than one."}, +
+ { ER_GT_OPERAND_CARDINALITY_ERROR,
+ "XPTY0004 : none of the gt's operands can be a sequence with length greater \
than one."}, +
+ { ER_LE_OPERAND_CARDINALITY_ERROR,
+ "XPTY0004 : none of the le's operands can be a sequence with length greater \
than one."}, +
+ { ER_GE_OPERAND_CARDINALITY_ERROR,
+ "XPTY0004 : none of the ge's operands can be a sequence with length greater \
than one."},
- //END: Definitions of error keys used in exception messages of JAXP 1.3 XPath \
API implementation + //END: Definitions of error keys used in exception messages of \
JAXP 1.3 XPath API implementation
// Warnings...
diff --git a/tests/org/apache/xalan/xpath3/ValueComparisonTests.java \
b/tests/org/apache/xalan/xpath3/ValueComparisonTests.java index 2d639ce2..37de4627 \
100644
--- a/tests/org/apache/xalan/xpath3/ValueComparisonTests.java
+++ b/tests/org/apache/xalan/xpath3/ValueComparisonTests.java
@@ -119,5 +119,75 @@ public class ValueComparisonTests extends XslTransformTestsUtil \
{
runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, \
null); }
+
+ @Test
+ public void xslValueComparison8() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test8.xsl";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test8.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test8.out"; \
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, \
null); + }
+
+ @Test
+ public void xslValueComparison9() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test9.xsl";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test9.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test9.out"; \
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, \
null); + }
+
+ @Test
+ public void xslValueComparison10() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test10.xsl";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test10.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test10.out"; \
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, \
null); + }
+
+ @Test
+ public void xslValueComparison11() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_c.xml";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test11.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test11.out"; \
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, \
null); + }
+
+ @Test
+ public void xslValueComparison12() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_d.xml";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test12.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test12.out"; \
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, \
null); + }
+
+ @Test
+ public void xslValueComparison13() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_e.xml";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test13.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test13.out"; \
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, \
null); + }
+
+ @Test
+ public void xslValueComparison14() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_e.xml";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test14.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test14.out"; \
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, \
null); + }
}
diff --git a/tests/org/apache/xalan/xslt3/XSLConstants.java \
b/tests/org/apache/xalan/xslt3/XSLConstants.java index ccaf7dab..c85a98db 100644
--- a/tests/org/apache/xalan/xslt3/XSLConstants.java
+++ b/tests/org/apache/xalan/xslt3/XSLConstants.java
@@ -36,8 +36,8 @@ public class XSLConstants {
// the values of following, two variables are host specific where this test \
suite shall be run. the values of // following two variables may be modified, \
accordingly.
- public static final String XSL_TRANSFORM_INPUT_DIRPATH_PREFIX = \
"file:///d:/eclipseWorkspaces/xalanj/xalan-java_mukul/tests/"; + public static \
final String XSL_TRANSFORM_INPUT_DIRPATH_PREFIX = \
"file:///d:/eclipseWorkspaces/xalanj/xalan-java/tests/";
- public static final String XSL_TRANSFORM_GOLD_DIRPATH_PREFIX = \
"d:/eclipseWorkspaces/xalanj/xalan-java_mukul/tests/"; + public static final \
String XSL_TRANSFORM_GOLD_DIRPATH_PREFIX = \
"d:/eclipseWorkspaces/xalanj/xalan-java/tests/";
}
diff --git a/tests/org/apache/xalan/xslt3/XslIterateTests.java \
b/tests/org/apache/xalan/xslt3/XslIterateTests.java index 3ef89058..d0be3be0 100644
--- a/tests/org/apache/xalan/xslt3/XslIterateTests.java
+++ b/tests/org/apache/xalan/xslt3/XslIterateTests.java
@@ -200,5 +200,15 @@ public class XslIterateTests extends XslTransformTestsUtil {
runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, \
null); }
+
+ @Test
+ public void xslIterateTest16() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_e.xml";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test14.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test14.out"; \
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, \
null); + }
}
diff --git a/tests/xpath_value_comparison/gold/test10.out \
b/tests/xpath_value_comparison/gold/test10.out new file mode 100644
index 00000000..ebd80f74
--- /dev/null
+++ b/tests/xpath_value_comparison/gold/test10.out
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?><elem>
+ <result1>true</result1>
+ <result2>false</result2>
+ <result3>true</result3>
+</elem>
diff --git a/tests/xpath_value_comparison/gold/test11.out \
b/tests/xpath_value_comparison/gold/test11.out new file mode 100644
index 00000000..88a36785
--- /dev/null
+++ b/tests/xpath_value_comparison/gold/test11.out
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <chk1>
+ <a>hello</a>
+ <a>hello</a>
+ </chk1>
+ <chk2>
+ <a>hi</a>
+ <a>hi</a>
+ <a>hi</a>
+ </chk2>
+ <chk3>
+ <a>there</a>
+ </chk3>
+</result>
diff --git a/tests/xpath_value_comparison/gold/test12.out \
b/tests/xpath_value_comparison/gold/test12.out new file mode 100644
index 00000000..8f3c94db
--- /dev/null
+++ b/tests/xpath_value_comparison/gold/test12.out
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <before>
+ <a dt="2007-10-07">1</a>
+ <a dt="2008-10-07">3</a>
+ <a dt="2009-10-07">5</a>
+ </before>
+ <after>
+ <a dt="2500-10-07">2</a>
+ <a dt="2501-10-07">4</a>
+ <a dt="2502-10-07">6</a>
+ </after>
+</result>
diff --git a/tests/xpath_value_comparison/gold/test13.out \
b/tests/xpath_value_comparison/gold/test13.out new file mode 100644
index 00000000..00b4154d
--- /dev/null
+++ b/tests/xpath_value_comparison/gold/test13.out
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <lessOrEqual>
+ <item weight="5">A</item>
+ <item weight="6">B</item>
+ <item weight="7">C</item>
+ <item weight="8">D</item>
+ <item weight="9">E</item>
+ <item weight="10">F</item>
+ </lessOrEqual>
+ <greaterThan>
+ <item weight="11">G</item>
+ <item weight="12">H</item>
+ <item weight="13">I</item>
+ <item weight="14">J</item>
+ </greaterThan>
+</result>
diff --git a/tests/xpath_value_comparison/gold/test14.out \
b/tests/xpath_value_comparison/gold/test14.out new file mode 100644
index 00000000..1e61bf84
--- /dev/null
+++ b/tests/xpath_value_comparison/gold/test14.out
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <lessThan>
+ <item weight="5">A</item>
+ <item weight="6">B</item>
+ <item weight="7">C</item>
+ <item weight="8">D</item>
+ <item weight="9">E</item>
+ </lessThan>
+ <greaterOrEqual>
+ <item weight="10">F</item>
+ <item weight="11">G</item>
+ <item weight="12">H</item>
+ <item weight="13">I</item>
+ <item weight="14">J</item>
+ </greaterOrEqual>
+</result>
diff --git a/tests/xpath_value_comparison/gold/test8.out \
b/tests/xpath_value_comparison/gold/test8.out new file mode 100644
index 00000000..d2f51c73
--- /dev/null
+++ b/tests/xpath_value_comparison/gold/test8.out
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?><elem>
+ <result1>true</result1>
+ <result2>false</result2>
+ <result3>false</result3>
+</elem>
diff --git a/tests/xpath_value_comparison/gold/test9.out \
b/tests/xpath_value_comparison/gold/test9.out new file mode 100644
index 00000000..dcc4489f
--- /dev/null
+++ b/tests/xpath_value_comparison/gold/test9.out
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?><elem>
+ <result1>false</result1>
+ <result2>true</result2>
+ <result3>true</result3>
+</elem>
diff --git a/tests/xpath_value_comparison/test10.xsl \
b/tests/xpath_value_comparison/test10.xsl new file mode 100644
index 00000000..f5e62901
--- /dev/null
+++ b/tests/xpath_value_comparison/test10.xsl
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- An XSLT stylesheet to test, implementation of XPath 3.1 value
+ comparison operator 'ge'. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/">
+ <elem>
+ <result1><xsl:value-of select="2 ge 1"/></result1>
+ <result2><xsl:value-of select="1 ge 2"/></result2>
+ <result3><xsl:value-of select="1 ge 1"/></result3>
+ </elem>
+ </xsl:template>
+
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xpath_value_comparison/test11.xsl \
b/tests/xpath_value_comparison/test11.xsl new file mode 100644
index 00000000..10cf3b5c
--- /dev/null
+++ b/tests/xpath_value_comparison/test11.xsl
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- use with test1_c.xml -->
+
+ <!-- An XSLT stylesheet to test, implementation of XPath 3.1 value
+ comparison operator 'eq'. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/elem">
+ <result>
+ <chk1>
+ <xsl:copy-of select="a[. eq /elem/@chk1]"/>
+ </chk1>
+ <chk2>
+ <xsl:copy-of select="a[. eq /elem/@chk2]"/>
+ </chk2>
+ <chk3>
+ <xsl:copy-of select="a[. eq /elem/@chk3]"/>
+ </chk3>
+ </result>
+ </xsl:template>
+
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xpath_value_comparison/test12.xsl \
b/tests/xpath_value_comparison/test12.xsl new file mode 100644
index 00000000..b7f9c5c7
--- /dev/null
+++ b/tests/xpath_value_comparison/test12.xsl
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ exclude-result-prefixes="xs"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- use with test1_d.xml -->
+
+ <!-- An XSLT stylesheet to test, implementation of XPath 3.1 value
+ comparison operator 'lt'. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:variable name="currDate" select="current-date()"/>
+
+ <xsl:template match="/elem">
+ <result>
+ <before>
+ <xsl:copy-of select="a[xs:date(@dt) lt $currDate]"/>
+ </before>
+ <after>
+ <xsl:copy-of select="a[xs:date(@dt) gt $currDate]"/>
+ </after>
+ </result>
+ </xsl:template>
+
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xpath_value_comparison/test13.xsl \
b/tests/xpath_value_comparison/test13.xsl new file mode 100644
index 00000000..b542644b
--- /dev/null
+++ b/tests/xpath_value_comparison/test13.xsl
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- use with test1_e.xml -->
+
+ <!-- An XSLT stylesheet to test, implementation of XPath 3.1 value
+ comparison operators 'le' and 'gt'. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/elem">
+ <result>
+ <lessOrEqual>
+ <xsl:copy-of select="item[number(@weight) le 10]"/>
+ </lessOrEqual>
+ <greaterThan>
+ <xsl:copy-of select="item[number(@weight) gt 10]"/>
+ </greaterThan>
+ </result>
+ </xsl:template>
+
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xpath_value_comparison/test14.xsl \
b/tests/xpath_value_comparison/test14.xsl new file mode 100644
index 00000000..add294d8
--- /dev/null
+++ b/tests/xpath_value_comparison/test14.xsl
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- use with test1_e.xml -->
+
+ <!-- An XSLT stylesheet to test, implementation of XPath 3.1 value
+ comparison operators 'lt' and 'ge'. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/elem">
+ <result>
+ <lessThan>
+ <xsl:copy-of select="item[number(@weight) lt 10]"/>
+ </lessThan>
+ <greaterOrEqual>
+ <xsl:copy-of select="item[number(@weight) ge 10]"/>
+ </greaterOrEqual>
+ </result>
+ </xsl:template>
+
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xpath_value_comparison/test1_c.xml \
b/tests/xpath_value_comparison/test1_c.xml new file mode 100644
index 00000000..96e12ee6
--- /dev/null
+++ b/tests/xpath_value_comparison/test1_c.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<elem chk1="hello" chk2="hi" chk3="there">
+ <a>hello</a>
+ <a>hello</a>
+ <a>hi</a>
+ <a>hi</a>
+ <a>hi</a>
+ <a>there</a>
+</elem>
\ No newline at end of file
diff --git a/tests/xpath_value_comparison/test1_d.xml \
b/tests/xpath_value_comparison/test1_d.xml new file mode 100644
index 00000000..7aa2048f
--- /dev/null
+++ b/tests/xpath_value_comparison/test1_d.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<elem>
+ <a dt="2007-10-07">1</a>
+ <a dt="2500-10-07">2</a>
+ <a dt="2008-10-07">3</a>
+ <a dt="2501-10-07">4</a>
+ <a dt="2009-10-07">5</a>
+ <a dt="2502-10-07">6</a>
+</elem>
\ No newline at end of file
diff --git a/tests/xpath_value_comparison/test1_e.xml \
b/tests/xpath_value_comparison/test1_e.xml new file mode 100644
index 00000000..c4fc37e9
--- /dev/null
+++ b/tests/xpath_value_comparison/test1_e.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<elem>
+ <item weight="5">A</item>
+ <item weight="6">B</item>
+ <item weight="7">C</item>
+ <item weight="8">D</item>
+ <item weight="9">E</item>
+ <item weight="10">F</item>
+ <item weight="11">G</item>
+ <item weight="12">H</item>
+ <item weight="13">I</item>
+ <item weight="14">J</item>
+</elem>
\ No newline at end of file
diff --git a/tests/xpath_value_comparison/test8.xsl \
b/tests/xpath_value_comparison/test8.xsl new file mode 100644
index 00000000..ecbdce6c
--- /dev/null
+++ b/tests/xpath_value_comparison/test8.xsl
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- An XSLT stylesheet to test, implementation of XPath 3.1 value
+ comparison operator 'gt'. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/">
+ <elem>
+ <result1><xsl:value-of select="2 gt 1"/></result1>
+ <result2><xsl:value-of select="1 gt 2"/></result2>
+ <result3><xsl:value-of select="1 gt 1"/></result3>
+ </elem>
+ </xsl:template>
+
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xpath_value_comparison/test9.xsl \
b/tests/xpath_value_comparison/test9.xsl new file mode 100644
index 00000000..ff1c71e9
--- /dev/null
+++ b/tests/xpath_value_comparison/test9.xsl
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- An XSLT stylesheet to test, implementation of XPath 3.1 value
+ comparison operator 'le'. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/">
+ <elem>
+ <result1><xsl:value-of select="2 le 1"/></result1>
+ <result2><xsl:value-of select="1 le 2"/></result2>
+ <result3><xsl:value-of select="1 le 1"/></result3>
+ </elem>
+ </xsl:template>
+
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xsl_iterate/gold/test14.out b/tests/xsl_iterate/gold/test14.out
new file mode 100644
index 00000000..b4d3b7dc
--- /dev/null
+++ b/tests/xsl_iterate/gold/test14.out
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <item weight="5">A</item>
+ <item weight="6">B</item>
+ <item weight="7">C</item>
+ <item weight="8">D</item>
+ <item weight="9">E</item>
+ <item weight="10">F</item>
+</result>
diff --git a/tests/xsl_iterate/test14.xsl b/tests/xsl_iterate/test14.xsl
new file mode 100644
index 00000000..bb1933cb
--- /dev/null
+++ b/tests/xsl_iterate/test14.xsl
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- use with test1_e.xml -->
+
+ <!-- An XSLT stylesheet to test, xsl:iterate instruction,
+ which breaks from xsl:iterate loop when a particular
+ condition becomes true. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/elem">
+ <result>
+ <xsl:iterate select="item">
+ <xsl:choose>
+ <xsl:when test="number(@weight) eq 11">
+ <xsl:break/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:iterate>
+ </result>
+ </xsl:template>
+
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xsl_iterate/test1_e.xml b/tests/xsl_iterate/test1_e.xml
new file mode 100644
index 00000000..c4fc37e9
--- /dev/null
+++ b/tests/xsl_iterate/test1_e.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<elem>
+ <item weight="5">A</item>
+ <item weight="6">B</item>
+ <item weight="7">C</item>
+ <item weight="8">D</item>
+ <item weight="9">E</item>
+ <item weight="10">F</item>
+ <item weight="11">G</item>
+ <item weight="12">H</item>
+ <item weight="13">I</item>
+ <item weight="14">J</item>
+</elem>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic