You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mu...@apache.org on 2023/06/19 11:34:07 UTC
[xalan-java] branch xalan-j_xslt3.0 updated: committing implementation of xpath 3.1 value comparison operators eq and ne. also committing, few new related working test cases as well.
This is an automated email from the ASF dual-hosted git repository.
mukulg pushed a commit to branch xalan-j_xslt3.0
in repository https://gitbox.apache.org/repos/asf/xalan-java.git
The following commit(s) were added to refs/heads/xalan-j_xslt3.0 by this push:
new cd2c70a0 committing implementation of xpath 3.1 value comparison operators eq and ne. also committing, few new related working test cases as well.
new d0ac9c75 Merge pull request #6 from mukulga/xalan-j_xslt3.0_mukul
cd2c70a0 is described below
commit cd2c70a0925a36b35e3b2d11cea619ac13310c2e
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Mon Jun 19 16:36:14 2023 +0530
committing implementation of xpath 3.1 value comparison operators eq and ne. also committing, few new related working test cases as well.
---
src/org/apache/xpath/Expression.java | 3 +-
src/org/apache/xpath/compiler/Compiler.java | 22 +++++
src/org/apache/xpath/compiler/OpCodes.java | 23 +++++-
src/org/apache/xpath/compiler/XPathParser.java | 28 +++++++
src/org/apache/xpath/objects/XObject.java | 90 ++++++++++++++++++++-
src/org/apache/xpath/operations/Operation.java | 2 +-
src/org/apache/xpath/operations/VcEquals.java | 52 ++++++++++++
src/org/apache/xpath/operations/VcNotEquals.java | 52 ++++++++++++
src/org/apache/xpath/res/XPATHErrorResources.java | 7 +-
.../apache/xalan/xpath3/ValueComparisonTests.java | 94 ++++++++++++++++++++++
tests/org/apache/xalan/xslt3/AllXsl3Tests.java | 4 +-
tests/xpath_value_comparison/gold/test1.out | 4 +
tests/xpath_value_comparison/gold/test2.out | 4 +
tests/xpath_value_comparison/gold/test3.out | 0
tests/xpath_value_comparison/gold/test4.out | 6 ++
tests/xpath_value_comparison/test1.xsl | 34 ++++++++
tests/xpath_value_comparison/test1_a.xml | 11 +++
tests/xpath_value_comparison/test2.xsl | 36 +++++++++
tests/xpath_value_comparison/test3.xsl | 35 ++++++++
tests/xpath_value_comparison/test4.xsl | 38 +++++++++
20 files changed, 536 insertions(+), 9 deletions(-)
diff --git a/src/org/apache/xpath/Expression.java b/src/org/apache/xpath/Expression.java
index 002f01de..ac3ffa16 100644
--- a/src/org/apache/xpath/Expression.java
+++ b/src/org/apache/xpath/Expression.java
@@ -44,7 +44,8 @@ import org.xml.sax.ContentHandler;
*/
public abstract class Expression implements java.io.Serializable, ExpressionNode, XPathVisitable
{
- static final long serialVersionUID = 565665869777906902L;
+ static final long serialVersionUID = 565665869777906902L;
+
/**
* The location where this expression was built from. Need for diagnostic
* messages. May be null.
diff --git a/src/org/apache/xpath/compiler/Compiler.java b/src/org/apache/xpath/compiler/Compiler.java
index 0113fa77..e16ce7cf 100644
--- a/src/org/apache/xpath/compiler/Compiler.java
+++ b/src/org/apache/xpath/compiler/Compiler.java
@@ -58,6 +58,8 @@ import org.apache.xpath.operations.Plus;
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.VcNotEquals;
import org.apache.xpath.patterns.FunctionPattern;
import org.apache.xpath.patterns.NodeTest;
import org.apache.xpath.patterns.StepPattern;
@@ -131,6 +133,10 @@ public class Compiler extends OpMap
expr = notequals(opPos); break;
case OpCodes.OP_EQUALS :
expr = equals(opPos); break;
+ case OpCodes.OP_VC_EQUALS :
+ expr = vcEquals(opPos); break;
+ case OpCodes.OP_VC_NOT_EQUALS :
+ expr = vcNotEquals(opPos); break;
case OpCodes.OP_LTE :
expr = lte(opPos); break;
case OpCodes.OP_LT :
@@ -297,6 +303,22 @@ public class Compiler extends OpMap
{
return compileOperation(new Equals(), opPos);
}
+
+ /**
+ * Compile an 'eq' operation.
+ */
+ protected Expression vcEquals(int opPos) throws TransformerException
+ {
+ return compileOperation(new VcEquals(), opPos);
+ }
+
+ /**
+ * Compile an 'ne' operation.
+ */
+ protected Expression vcNotEquals(int opPos) throws TransformerException
+ {
+ return compileOperation(new VcNotEquals(), opPos);
+ }
/**
* Compile a '<=' operation.
diff --git a/src/org/apache/xpath/compiler/OpCodes.java b/src/org/apache/xpath/compiler/OpCodes.java
index e8bdc2e3..799dd7fc 100644
--- a/src/org/apache/xpath/compiler/OpCodes.java
+++ b/src/org/apache/xpath/compiler/OpCodes.java
@@ -627,11 +627,28 @@ public class OpCodes
/** The end of the axes types. */
public static final int AXES_END_TYPES = 53;
- /*
+ /**
* For XPath 3.1 "to" range expressions.
+ *
+ * @xsl.usage advanced
*/
public static final int OP_TO = 54;
+
+ /**
+ * For XPath 3.1 value comparison operator "eq".
+ *
+ * @xsl.usage advanced
+ */
+ public static final int OP_VC_EQUALS = 55;
+
+ /**
+ * For XPath 3.1 value comparison operator "ne".
+ *
+ * @xsl.usage advanced
+ */
+ public static final int OP_VC_NOT_EQUALS = 56;
- /** The next free ID. Please keep this up to date. */
- private static final int NEXT_FREE_ID = 99;
+ /** The next free ID. Please keep this up to date. */
+ private static final int NEXT_FREE_ID = 57;
+
}
diff --git a/src/org/apache/xpath/compiler/XPathParser.java b/src/org/apache/xpath/compiler/XPathParser.java
index 084c9a85..649a658e 100644
--- a/src/org/apache/xpath/compiler/XPathParser.java
+++ b/src/org/apache/xpath/compiler/XPathParser.java
@@ -896,6 +896,34 @@ public class XPathParser
m_ops.getOp(addPos + opPlusLeftHandLen + 1) + opPlusLeftHandLen);
addPos += 2;
}
+ else if (tokenIs("eq"))
+ {
+ // support for XPath 3.1 value comparison operator "eq"
+
+ nextToken();
+ insertOp(addPos, 2, OpCodes.OP_VC_EQUALS);
+
+ int op1 = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos;
+
+ addPos = EqualityExpr(addPos);
+ m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH,
+ m_ops.getOp(addPos + op1 + 1) + op1);
+ addPos += 2;
+ }
+ else if (tokenIs("ne"))
+ {
+ // support for XPath 3.1 value comparison operator "ne"
+
+ nextToken();
+ insertOp(addPos, 2, OpCodes.OP_VC_NOT_EQUALS);
+
+ int op1 = m_ops.getOp(OpMap.MAPINDEX_LENGTH) - addPos;
+
+ addPos = EqualityExpr(addPos);
+ m_ops.setOp(addPos + OpMap.MAPINDEX_LENGTH,
+ m_ops.getOp(addPos + op1 + 1) + op1);
+ addPos += 2;
+ }
}
return addPos;
diff --git a/src/org/apache/xpath/objects/XObject.java b/src/org/apache/xpath/objects/XObject.java
index d9fe70de..f2374675 100644
--- a/src/org/apache/xpath/objects/XObject.java
+++ b/src/org/apache/xpath/objects/XObject.java
@@ -27,6 +27,7 @@ import org.apache.xml.dtm.DTM;
import org.apache.xml.dtm.DTMIterator;
import org.apache.xml.utils.XMLString;
import org.apache.xpath.Expression;
+import org.apache.xpath.ExpressionNode;
import org.apache.xpath.ExpressionOwner;
import org.apache.xpath.NodeSetDTM;
import org.apache.xpath.XPathContext;
@@ -54,7 +55,8 @@ import org.w3c.dom.traversal.NodeIterator;
*/
public class XObject extends Expression implements Serializable, Cloneable
{
- static final long serialVersionUID = -821887098985662951L;
+
+ static final long serialVersionUID = -821887098985662951L;
/**
* The java object which this object wraps.
@@ -639,7 +641,6 @@ public class XObject extends Expression implements Serializable, Cloneable
*/
public boolean equals(XObject obj2)
{
-
if ((this instanceof XSDecimal) && (obj2 instanceof XSDecimal)) {
return ((XSDecimal)this).equals((XSDecimal)obj2);
}
@@ -673,6 +674,83 @@ public class XObject extends Expression implements Serializable, Cloneable
return obj2.m_obj == null;
}
}
+
+ /**
+ * Tell if two objects are functionally equal, using the rules
+ * of value comparison operator "eq".
+ *
+ * @param obj2 Object to compare this to
+ * @param expressionOwner this object is used, for error reporting
+ *
+ * @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.
+ * Instead, we return the result as false for such cases.
+ */
+ public boolean vcEquals(XObject obj2, ExpressionNode expressionOwner)
+ throws javax.xml.transform.TransformerException
+ {
+ if ((this instanceof XSDecimal) && (obj2 instanceof XSDecimal)) {
+ return ((XSDecimal)this).equals((XSDecimal)obj2);
+ }
+ else if ((this instanceof XSFloat) && (obj2 instanceof XSFloat)) {
+ return ((XSFloat)this).equals((XSFloat)obj2);
+ }
+ else if ((this instanceof XSDouble) && (obj2 instanceof XSDouble)) {
+ return ((XSDouble)this).equals((XSDouble)obj2);
+ }
+ else if ((this instanceof XSBoolean) && (obj2 instanceof XSBoolean)) {
+ return ((XSBoolean)this).equals((XSBoolean)obj2);
+ }
+ else if ((this instanceof XSInteger) && (obj2 instanceof XSInteger)) {
+ return ((XSInteger)this).equals((XSInteger)obj2);
+ }
+ else if ((this instanceof XSLong) && (obj2 instanceof XSLong)) {
+ return ((XSLong)this).equals((XSLong)obj2);
+ }
+ else if ((this instanceof XSInt) && (obj2 instanceof XSInt)) {
+ return ((XSInt)this).equals((XSInt)obj2);
+ }
+
+ boolean isOperandNodeSet1 = false;
+ boolean isOperandNodeSet2 = false;
+
+ if (this.getType() == XObject.CLASS_NODESET) {
+ isOperandNodeSet1 = true;
+ if ((((XNodeSet)this).getLength() > 1)) {
+ error(XPATHErrorResources.ER_EQ_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);
+ }
+ }
+
+ if (isOperandNodeSet1 || this instanceof XNumber) {
+ return this.equals(obj2);
+ }
+ else if (isOperandNodeSet2 || obj2 instanceof XNumber) {
+ return obj2.equals(this);
+ }
+
+ if (m_obj != null) {
+ return m_obj.equals(obj2.m_obj);
+ }
+ else {
+ return obj2.m_obj == null;
+ }
+
+ }
/**
* Tell if two objects are functionally not equal.
@@ -735,6 +813,14 @@ public class XObject extends Expression implements Serializable, Cloneable
}
}
+ protected void error(String msg, Object[] args, ExpressionNode expressionOwner)
+ throws javax.xml.transform.TransformerException
+ {
+ String fmsg = XSLMessages.createXPATHMessage(msg, args);
+
+ throw new XPathException(fmsg, expressionOwner);
+ }
+
/**
* XObjects should not normally need to fix up variables.
diff --git a/src/org/apache/xpath/operations/Operation.java b/src/org/apache/xpath/operations/Operation.java
index 15141ada..d411945c 100644
--- a/src/org/apache/xpath/operations/Operation.java
+++ b/src/org/apache/xpath/operations/Operation.java
@@ -31,7 +31,7 @@ import org.apache.xpath.objects.XObject;
*/
public class Operation extends Expression implements ExpressionOwner
{
- static final long serialVersionUID = -3037139537171050430L;
+ static final long serialVersionUID = -3037139537171050430L;
/** The left operand expression.
* @serial */
diff --git a/src/org/apache/xpath/operations/VcEquals.java b/src/org/apache/xpath/operations/VcEquals.java
new file mode 100644
index 00000000..2092d9c6
--- /dev/null
+++ b/src/org/apache/xpath/operations/VcEquals.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xpath.operations;
+
+import org.apache.xpath.objects.XBoolean;
+import org.apache.xpath.objects.XObject;
+
+/**
+ * The XPath 3.1 value comparison "eq" operation.
+ *
+ * @author Mukul Gandhi <mu...@apache.org>
+ *
+ * @xsl.usage advanced
+ */
+public class VcEquals extends Operation
+{
+
+ private static final long serialVersionUID = 4786065470189699263L;
+
+ /**
+ * Apply the operation to two operands, and return the result.
+ *
+ *
+ * @param left non-null reference to the evaluated left operand.
+ * @param right non-null reference to the evaluated right operand.
+ *
+ * @return non-null reference to the XObject that represents the result of the operation.
+ *
+ * @throws javax.xml.transform.TransformerException
+ */
+ public XObject operate(XObject left, XObject right) throws
+ javax.xml.transform.TransformerException
+ {
+ return left.vcEquals(right, getExpressionOwner()) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
+ }
+
+}
diff --git a/src/org/apache/xpath/operations/VcNotEquals.java b/src/org/apache/xpath/operations/VcNotEquals.java
new file mode 100644
index 00000000..35bc7bd5
--- /dev/null
+++ b/src/org/apache/xpath/operations/VcNotEquals.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xpath.operations;
+
+import org.apache.xpath.objects.XBoolean;
+import org.apache.xpath.objects.XObject;
+
+/**
+ * The XPath 3.1 value comparison "ne" operation.
+ *
+ * @author Mukul Gandhi <mu...@apache.org>
+ *
+ * @xsl.usage advanced
+ */
+public class VcNotEquals extends Operation
+{
+
+ private static final long serialVersionUID = -7873849261282675642L;
+
+ /**
+ * Apply the operation to two operands, and return the result.
+ *
+ *
+ * @param left non-null reference to the evaluated left operand.
+ * @param right non-null reference to the evaluated right operand.
+ *
+ * @return non-null reference to the XObject that represents the result of the operation.
+ *
+ * @throws javax.xml.transform.TransformerException
+ */
+ public XObject operate(XObject left, XObject right) throws
+ javax.xml.transform.TransformerException
+ {
+ return left.vcEquals(right, getExpressionOwner()) ? 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 38aa6842..db64c362 100644
--- a/src/org/apache/xpath/res/XPATHErrorResources.java
+++ b/src/org/apache/xpath/res/XPATHErrorResources.java
@@ -368,6 +368,8 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
public static final String ER_INVALID_REGEX_FLAGS = "ER_INVALID_REGEX_FLAGS";
public static final String ER_INVALID_REGEX = "ER_INVALID_REGEX";
+
+ public static final String ER_EQ_OPERAND_CARDINALITY_ERROR = "ER_EQ_OPERAND_CARDINALITY_ERROR";
// Error messages...
@@ -858,8 +860,11 @@ public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
{ ER_INVALID_REGEX,
"FORX0002: Invalid regular expression syntax used, with function call {0}."},
+
+ { ER_EQ_OPERAND_CARDINALITY_ERROR,
+ "XPTY0004 : none of the eq'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
new file mode 100644
index 00000000..e6638fc6
--- /dev/null
+++ b/tests/org/apache/xalan/xpath3/ValueComparisonTests.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xalan.xpath3;
+
+import org.apache.xalan.util.XslTestsErrorHandler;
+import org.apache.xalan.util.XslTransformTestsUtil;
+import org.apache.xalan.xslt3.XSLConstants;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * XPath test cases, for value comparison operators
+ * eq, ne, lt, le, gt, ge.
+ *
+ * @author Mukul Gandhi <mu...@apache.org>
+ *
+ * @xsl.usage advanced
+ */
+public class ValueComparisonTests extends XslTransformTestsUtil {
+
+ private static final String XSL_TRANSFORM_INPUT_DIRPATH = XSLConstants.XSL_TRANSFORM_INPUT_DIRPATH_PREFIX + "xpath_value_comparison/";
+
+ private static final String XSL_TRANSFORM_GOLD_DIRPATH = XSLConstants.XSL_TRANSFORM_GOLD_DIRPATH_PREFIX + "xpath_value_comparison/gold/";
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ // no op
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ xmlDocumentBuilderFactory = null;
+ xmlDocumentBuilder = null;
+ xslTransformerFactory = null;
+ }
+
+ @Test
+ public void xslValueComparison1() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1.xsl";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test1.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
+
+ @Test
+ public void xslValueComparison2() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_a.xml";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test2.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test2.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
+
+ @Test
+ public void xslValueComparison3() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_a.xml";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test3.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test3.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath,
+ new XslTestsErrorHandler());
+ }
+
+ @Test
+ public void xslValueComparison4() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_a.xml";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test4.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test4.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath,
+ new XslTestsErrorHandler());
+ }
+
+}
diff --git a/tests/org/apache/xalan/xslt3/AllXsl3Tests.java b/tests/org/apache/xalan/xslt3/AllXsl3Tests.java
index 1a4b27ae..cf777bba 100644
--- a/tests/org/apache/xalan/xslt3/AllXsl3Tests.java
+++ b/tests/org/apache/xalan/xslt3/AllXsl3Tests.java
@@ -24,6 +24,7 @@ import org.apache.xalan.xpath3.FnUnparsedTextTests;
import org.apache.xalan.xpath3.RangeExprTests;
import org.apache.xalan.xpath3.SequenceTests;
import org.apache.xalan.xpath3.StringTests;
+import org.apache.xalan.xpath3.ValueComparisonTests;
import org.apache.xalan.xpath3.XsConstructorFunctions;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -47,7 +48,8 @@ import org.junit.runners.Suite.SuiteClasses;
FnUnparsedTextTests.class, FnTokenizeTests.class, FnStringJoinTests.class,
FnAbsTests.class, StringTests.class, XsConstructorFunctions.class,
FnIndexOfTests.class, SequenceTests.class, RangeExprTests.class,
- W3c_xslt30_IterateTests.class, W3c_xslt30_AxesTests.class, XslIterateTests.class })
+ W3c_xslt30_IterateTests.class, W3c_xslt30_AxesTests.class, XslIterateTests.class,
+ ValueComparisonTests.class })
public class AllXsl3Tests {
}
diff --git a/tests/xpath_value_comparison/gold/test1.out b/tests/xpath_value_comparison/gold/test1.out
new file mode 100644
index 00000000..c25f269c
--- /dev/null
+++ b/tests/xpath_value_comparison/gold/test1.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><elem>
+ <result1>false</result1>
+ <result2>true</result2>
+</elem>
diff --git a/tests/xpath_value_comparison/gold/test2.out b/tests/xpath_value_comparison/gold/test2.out
new file mode 100644
index 00000000..0b68d605
--- /dev/null
+++ b/tests/xpath_value_comparison/gold/test2.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><elem>
+ <result1>true</result1>
+ <result2>false</result2>
+</elem>
diff --git a/tests/xpath_value_comparison/gold/test3.out b/tests/xpath_value_comparison/gold/test3.out
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/xpath_value_comparison/gold/test4.out b/tests/xpath_value_comparison/gold/test4.out
new file mode 100644
index 00000000..08eda3d4
--- /dev/null
+++ b/tests/xpath_value_comparison/gold/test4.out
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?><elem>
+ <result1>true</result1>
+ <result2>false</result2>
+ <result3>true</result3>
+ <result4>false</result4>
+</elem>
diff --git a/tests/xpath_value_comparison/test1.xsl b/tests/xpath_value_comparison/test1.xsl
new file mode 100644
index 00000000..c10bcc01
--- /dev/null
+++ b/tests/xpath_value_comparison/test1.xsl
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/">
+ <elem>
+ <result1><xsl:value-of select="1 eq 2"/></result1>
+ <result2><xsl:value-of select="1 eq 1"/></result2>
+ </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/test1_a.xml b/tests/xpath_value_comparison/test1_a.xml
new file mode 100644
index 00000000..67f4f4bf
--- /dev/null
+++ b/tests/xpath_value_comparison/test1_a.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<elem>
+ <a>6.5</a>
+ <a>6.5</a>
+ <a>7</a>
+ <a>-55.23</a>
+ <b>hello</b>
+ <b>hello1</b>
+ <b>hello</b>
+ <b>5</b>
+</elem>
\ No newline at end of file
diff --git a/tests/xpath_value_comparison/test2.xsl b/tests/xpath_value_comparison/test2.xsl
new file mode 100644
index 00000000..4157a324
--- /dev/null
+++ b/tests/xpath_value_comparison/test2.xsl
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- use with test1_a.xml -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/elem">
+ <elem>
+ <result1><xsl:value-of select="a[1] eq a[2]"/></result1>
+ <result2><xsl:value-of select="a[1] eq a[3]"/></result2>
+ </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/test3.xsl b/tests/xpath_value_comparison/test3.xsl
new file mode 100644
index 00000000..1a79f2d4
--- /dev/null
+++ b/tests/xpath_value_comparison/test3.xsl
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- use with test1_a.xml -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/elem">
+ <elem>
+ <result><xsl:value-of select="a[1] eq a"/></result>
+ </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/test4.xsl b/tests/xpath_value_comparison/test4.xsl
new file mode 100644
index 00000000..07de2645
--- /dev/null
+++ b/tests/xpath_value_comparison/test4.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 -->
+
+ <!-- use with test1_a.xml -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/elem">
+ <elem>
+ <result1><xsl:value-of select="b[1] ne b[2]"/></result1>
+ <result2><xsl:value-of select="b[1] ne b[3]"/></result2>
+ <result3><xsl:value-of select="a[1] ne b[last()]"/></result3>
+ <result4><xsl:value-of select="not(a[1] ne b[last()])"/></result4>
+ </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
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org