You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mu...@apache.org on 2023/07/30 13:07:35 UTC

[xalan-java] branch xalan-j_xslt3.0 updated: committing implementation of few arithmetic operations on xpath 3.1 duration values, along with few new related working test cases. also committing, improvements to few other parts of xalanj xslt 3.0 implementation related to arithmetic operations involving the operators +, -, *, div.

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 77f94acf committing implementation of few arithmetic operations on xpath 3.1 duration values, along with few new related working test cases. also committing, improvements to few other parts of xalanj xslt 3.0 implementation related to arithmetic operations involving the operators +, -, *, div.
     new 13acfed5 Merge pull request #39 from mukulga/xalan-j_xslt3.0_mukul
77f94acf is described below

commit 77f94acf7c06773ddfdc83835c14e5c5bbf5ba36
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Sun Jul 30 18:31:22 2023 +0530

    committing implementation of few arithmetic operations on xpath 3.1 duration values, along with few new related working test cases. also committing, improvements to few other parts of xalanj xslt 3.0 implementation related to arithmetic operations involving the operators +, -, *, div.
---
 src/org/apache/xpath/operations/Div.java           | 175 ++++++++++++++++--
 src/org/apache/xpath/operations/Minus.java         | 195 +++++++++++++-------
 src/org/apache/xpath/operations/Mult.java          | 185 ++++++++++++++++---
 src/org/apache/xpath/operations/Plus.java          | 197 ++++++++++++++-------
 src/org/apache/xpath/xs/types/XSDecimal.java       |   2 +-
 .../apache/xpath/xs/types/XSYearMonthDuration.java |  56 +++++-
 .../XPathArithmeticOnDurationValuesTests.java      |  70 ++++++++
 .../xpath_duration_value_arithmetic/gold/test3.out |   7 +
 .../xpath_duration_value_arithmetic/gold/test4.out |   7 +
 .../xpath_duration_value_arithmetic/gold/test6.out |   7 +
 tests/xpath_duration_value_arithmetic/test1.xsl    |   4 +-
 tests/xpath_duration_value_arithmetic/test1_b.xml  |  11 ++
 tests/xpath_duration_value_arithmetic/test1_c.xml  |  11 ++
 tests/xpath_duration_value_arithmetic/test1_d.xml  |  11 ++
 tests/xpath_duration_value_arithmetic/test1_e.xml  |  11 ++
 tests/xpath_duration_value_arithmetic/test1_f.xml  |  11 ++
 .../{test1.xsl => test3.xsl}                       |   9 +-
 .../test4.xsl}                                     |  21 +--
 .../{test1.xsl => test5.xsl}                       |  17 +-
 .../{test1.xsl => test6.xsl}                       |   7 +-
 .../{test1.xsl => test7.xsl}                       |  14 +-
 .../{test1.xsl => test8.xsl}                       |  14 +-
 .../{test1.xsl => test9.xsl}                       |  14 +-
 tests/xs_constructor_functions/gold/test5.out      |   7 +-
 tests/xs_constructor_functions/gold/test9.out      |   2 +-
 tests/xs_constructor_functions/test1.xsl           |   5 +-
 tests/xs_constructor_functions/test10.xsl          |   4 +-
 tests/xs_constructor_functions/test11.xsl          |   4 +-
 tests/xs_constructor_functions/test12.xsl          |   4 +-
 tests/xs_constructor_functions/test2.xsl           |   4 +-
 tests/xs_constructor_functions/test3.xsl           |   5 +-
 tests/xs_constructor_functions/test4.xsl           |   4 +-
 tests/xs_constructor_functions/test5.xsl           |   9 +-
 tests/xs_constructor_functions/test6.xsl           |   5 +-
 tests/xs_constructor_functions/test7.xsl           |   5 +-
 tests/xs_constructor_functions/test8.xsl           |   5 +-
 tests/xs_constructor_functions/test9.xsl           |   4 +-
 tests/xs_durationComponentExtraction/test1.xsl     |   6 +-
 38 files changed, 887 insertions(+), 242 deletions(-)

diff --git a/src/org/apache/xpath/operations/Div.java b/src/org/apache/xpath/operations/Div.java
index 7eab3956..79ee7f59 100644
--- a/src/org/apache/xpath/operations/Div.java
+++ b/src/org/apache/xpath/operations/Div.java
@@ -21,9 +21,13 @@
 package org.apache.xpath.operations;
 
 import org.apache.xpath.XPathContext;
+import org.apache.xpath.XPathException;
+import org.apache.xpath.objects.XNodeSet;
 import org.apache.xpath.objects.XNumber;
 import org.apache.xpath.objects.XObject;
 import org.apache.xpath.xs.types.XSDouble;
+import org.apache.xpath.xs.types.XSNumericType;
+import org.apache.xpath.xs.types.XSYearMonthDuration;
 
 /**
  * The 'div' operation expression executer.
@@ -47,24 +51,171 @@ public class Div extends Operation
                                            throws javax.xml.transform.TransformerException
   {  
      XObject result = null;
-     
-     if ((left instanceof XSDouble) && (right instanceof XSDouble)) {          
-         double lDouble = ((XSDouble)left).doubleValue();
-         double rDouble = ((XSDouble)right).doubleValue();
-         result = new XNumber(lDouble / rDouble);          
+          
+     if ((left instanceof XNumber) && (right instanceof XSNumericType)) {
+        double lDouble = ((XNumber)left).num();
+        
+        java.lang.String rStrVal = ((XSNumericType)right).stringValue();
+        double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+        
+        result = new XNumber(lDouble / rDouble);
      }
-     else if ((left instanceof XNumber) && (right instanceof XSDouble)) {          
+     else if ((left instanceof XSNumericType) && (right instanceof XNumber)) {
+         java.lang.String lStrVal = ((XSNumericType)left).stringValue();
+         double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+         
+         double rDouble = ((XNumber)right).num();
+         
+         result = new XNumber(lDouble / rDouble);
+     }
+     else if ((left instanceof XNumber) && (right instanceof XNumber)) {
+         double lDouble = ((XNumber)left).num();
+         double rDouble = ((XNumber)right).num();
+         
+         result = new XNumber(lDouble / rDouble);
+     }
+     else if ((left instanceof XSNumericType) && (right instanceof XSNumericType)) {
+         java.lang.String lStrVal = ((XSNumericType)left).stringValue();
+         double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+         
+         java.lang.String rStrVal = ((XSNumericType)right).stringValue();
+         double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+         
+         result = new XNumber(lDouble / rDouble);
+     }
+     else if ((left instanceof XNumber) && (right instanceof XNodeSet)) {
          double lDouble = ((XNumber)left).num();
-         double rDouble = ((XSDouble)right).doubleValue();
-         result = new XNumber(lDouble / rDouble);          
+         
+         XNodeSet rNodeSet = (XNodeSet)right;
+         if (rNodeSet.getLength() > 1) {
+            throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                  + "than one item is not allowed as the second "
+                                                                                  + "operand of division operator 'div'.");  
+         }
+         else {
+            java.lang.String rStrVal = rNodeSet.str();
+            double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+            
+            result = new XNumber(lDouble / rDouble);
+         }
      }
-     else if ((left instanceof XSDouble) && (right instanceof XNumber)) {          
-         double lDouble = ((XSDouble)left).doubleValue();
+     else if ((left instanceof XNodeSet) && (right instanceof XNumber)) {
          double rDouble = ((XNumber)right).num();
-         result = new XNumber(lDouble / rDouble);          
+         
+         XNodeSet lNodeSet = (XNodeSet)left;
+         if (lNodeSet.getLength() > 1) {
+            throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                  + "than one item is not allowed as the first "
+                                                                                  + "operand of division operator 'div'.");  
+         }
+         else {
+            java.lang.String lStrVal = lNodeSet.str();
+            double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+            
+            result = new XNumber(lDouble / rDouble);
+         }
+     }
+     else if ((left instanceof XSNumericType) && (right instanceof XNodeSet)) {
+         java.lang.String lStrVal = ((XSNumericType)left).stringValue();
+         double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+         
+         XNodeSet rNodeSet = (XNodeSet)right;
+         if (rNodeSet.getLength() > 1) {
+            throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                  + "than one item is not allowed as the second "
+                                                                                  + "operand of division operator 'div'.");  
+         }
+         else {
+            java.lang.String rStrVal = rNodeSet.str();
+            double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+            
+            result = new XNumber(lDouble / rDouble);
+         }
+     }
+     else if ((left instanceof XNodeSet) && (right instanceof XSNumericType)) {
+         java.lang.String rStrVal = ((XSNumericType)right).stringValue();
+         double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+         
+         XNodeSet lNodeSet = (XNodeSet)left;
+         if (lNodeSet.getLength() > 1) {
+            throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                  + "than one item is not allowed as the first "
+                                                                                  + "operand of division operator 'div'.");  
+         }
+         else {
+            java.lang.String lStrVal = lNodeSet.str();
+            double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+            
+            result = new XNumber(lDouble / rDouble);
+         }
+     }
+     else if ((left instanceof XNodeSet) && (right instanceof XNodeSet)) {
+         double lDouble = 0.0d;
+         double rDouble = 0.0d;
+         
+         XNodeSet lNodeSet = (XNodeSet)left;
+         if (lNodeSet.getLength() > 1) {
+            throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                  + "than one item is not allowed as the first "
+                                                                                  + "operand of division operator 'div'.");  
+         }
+         else {
+            java.lang.String lStrVal = lNodeSet.str();
+            lDouble = (Double.valueOf(lStrVal)).doubleValue();
+         }
+         
+         XNodeSet rNodeSet = (XNodeSet)right;
+         if (rNodeSet.getLength() > 1) {
+            throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                  + "than one item is not allowed as the second "
+                                                                                  + "operand of division operator 'div'.");  
+         }
+         else {
+            java.lang.String rStrVal = rNodeSet.str();
+            rDouble = (Double.valueOf(rStrVal)).doubleValue();
+         }
+         
+         result = new XNumber(lDouble / rDouble);
+     }
+     else if ((left instanceof XSYearMonthDuration) && (right instanceof XNumber)) {
+         try {
+            double rDouble = ((XNumber)right).num();
+            result = ((XSYearMonthDuration)left).div(new XSDouble(rDouble));
+         }
+         catch (XPathException ex) {
+            throw new javax.xml.transform.TransformerException(ex.getMessage());  
+         } 
+     }
+     else if ((left instanceof XSYearMonthDuration) && (right instanceof XSNumericType)) {
+         try {
+            java.lang.String rStrVal = ((XSNumericType)right).stringValue();
+            result = ((XSYearMonthDuration)left).div(new XSDouble(rStrVal));
+         }
+         catch (XPathException ex) {
+            throw new javax.xml.transform.TransformerException(ex.getMessage());  
+         }
+     }
+     else if ((left instanceof XSYearMonthDuration) && (right instanceof XNodeSet)) {
+         XNodeSet rNodeSet = (XNodeSet)right;
+         if (rNodeSet.getLength() > 1) {
+            throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                + "than one item is not allowed as the second "
+                                                                                + "operand of division operator 'div'.");  
+         }
+         else {
+            java.lang.String rStrVal = rNodeSet.str();
+            result = ((XSYearMonthDuration)left).div(new XSDouble(rStrVal));
+         }
      }
      else {
-         result = new XNumber(left.num() / right.num());
+         try {
+            result = new XNumber(left.num() / right.num());
+         }
+         catch (Exception ex) {
+            throw new javax.xml.transform.TransformerException("XPTY0004 : could not apply the "
+                                                                              + "division operator 'div', due to incorrectly "
+                                                                              + "typed operand(s)."); 
+         }
      }
       
      return result; 
diff --git a/src/org/apache/xpath/operations/Minus.java b/src/org/apache/xpath/operations/Minus.java
index 0d39e911..8b2c273b 100644
--- a/src/org/apache/xpath/operations/Minus.java
+++ b/src/org/apache/xpath/operations/Minus.java
@@ -20,16 +20,11 @@
  */
 package org.apache.xpath.operations;
 
-import java.math.BigInteger;
-
 import org.apache.xpath.XPathContext;
+import org.apache.xpath.objects.XNodeSet;
 import org.apache.xpath.objects.XNumber;
 import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDecimal;
-import org.apache.xpath.xs.types.XSFloat;
-import org.apache.xpath.xs.types.XSInt;
-import org.apache.xpath.xs.types.XSInteger;
-import org.apache.xpath.xs.types.XSLong;
+import org.apache.xpath.xs.types.XSNumericType;
 import org.apache.xpath.xs.types.XSYearMonthDuration;
 
 /**
@@ -55,77 +50,147 @@ public class Minus extends Operation
                                            throws javax.xml.transform.TransformerException {
       XObject result = null;
       
-      if ((left instanceof XSInteger) && (right instanceof XSInteger)) {
-         BigInteger bigIntLeft = ((XSInteger)left).intValue();
-         BigInteger bigIntRight = ((XSInteger)right).intValue();
+      if ((left instanceof XNumber) && (right instanceof XSNumericType)) {
+          double lDouble = ((XNumber)left).num();
+          
+          java.lang.String rStrVal = ((XSNumericType)right).stringValue();
+          double rDouble = (Double.valueOf(rStrVal)).doubleValue();
           
-         return new XSInteger(bigIntLeft.subtract(bigIntRight));    
+          result = new XNumber(lDouble - rDouble);
       }
-       
-      if ((left instanceof XSLong) && (right instanceof XSLong)) {
-          BigInteger bigIntLeft = ((XSLong)left).intValue();
-          BigInteger bigIntRight = ((XSLong)right).intValue();
-           
-          return new XSLong(bigIntLeft.subtract(bigIntRight));    
+      else if ((left instanceof XSNumericType) && (right instanceof XNumber)) {
+          java.lang.String lStrVal = ((XSNumericType)left).stringValue();
+          double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+          
+          double rDouble = ((XNumber)right).num();
+          
+          result = new XNumber(lDouble - rDouble);
       }
-       
-      if ((left instanceof XSInt) && (right instanceof XSInt)) {
-          BigInteger bigIntLeft = ((XSInt)left).intValue();
-          BigInteger bigIntRight = ((XSInt)right).intValue();
-           
-          return new XSInt(bigIntLeft.subtract(bigIntRight));    
+      else if ((left instanceof XNumber) && (right instanceof XNumber)) {
+          double lDouble = ((XNumber)left).num();
+          double rDouble = ((XNumber)right).num();
+          
+          result = new XNumber(lDouble - rDouble);
       }
-      
-      if ((left instanceof XSYearMonthDuration) && 
-                                           (right instanceof XSYearMonthDuration)) {
-          return ((XSYearMonthDuration)left).subtract((XSYearMonthDuration)right);  
+      else if ((left instanceof XSNumericType) && (right instanceof XSNumericType)) {
+          java.lang.String lStrVal = ((XSNumericType)left).stringValue();
+          double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+          
+          java.lang.String rStrVal = ((XSNumericType)right).stringValue();
+          double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+          
+          result = new XNumber(lDouble - rDouble);
       }
-      
-      double leftArg = 0.0;
-      double rightArg = 0.0;
-      
-      float lArg = (float)0.0;
-      float rArg = (float)0.0;
-      
-      boolean isFloatLarg = false;
-      boolean isFloatRarg = false;
-      
-      if (left instanceof XSDecimal) {
-          leftArg = ((XSDecimal)left).doubleValue();    
+      else if ((left instanceof XNumber) && (right instanceof XNodeSet)) {
+          double lDouble = ((XNumber)left).num();
+          
+          XNodeSet rNodeSet = (XNodeSet)right;
+          if (rNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the second "
+                                                                                   + "operand of subtraction operator '-'.");  
+          }
+          else {
+             java.lang.String rStrVal = rNodeSet.str();
+             double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+             
+             result = new XNumber(lDouble - rDouble);
+          }
       }
-      else if (left instanceof XSFloat) {
-          isFloatLarg = true;
-          lArg = ((XSFloat)left).floatValue();    
+      else if ((left instanceof XNodeSet) && (right instanceof XNumber)) {
+          double rDouble = ((XNumber)right).num();
+          
+          XNodeSet lNodeSet = (XNodeSet)left;
+          if (lNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the first "
+                                                                                   + "operand of subtraction operator '-'.");  
+          }
+          else {
+             java.lang.String lStrVal = lNodeSet.str();
+             double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+             
+             result = new XNumber(lDouble - rDouble);
+          }
       }
-      else {
-          leftArg = left.num();  
+      else if ((left instanceof XSNumericType) && (right instanceof XNodeSet)) {
+          java.lang.String lStrVal = ((XSNumericType)left).stringValue();
+          double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+          
+          XNodeSet rNodeSet = (XNodeSet)right;
+          if (rNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the second "
+                                                                                   + "operand of subtraction operator '-'.");  
+          }
+          else {
+             java.lang.String rStrVal = rNodeSet.str();
+             double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+             
+             result = new XNumber(lDouble - rDouble);
+          }
       }
-      
-      if (right instanceof XSDecimal) {
-          rightArg = ((XSDecimal)right).doubleValue();    
+      else if ((left instanceof XNodeSet) && (right instanceof XSNumericType)) {
+          java.lang.String rStrVal = ((XSNumericType)right).stringValue();
+          double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+          
+          XNodeSet lNodeSet = (XNodeSet)left;
+          if (lNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the first "
+                                                                                   + "operand of subtraction operator '-'.");  
+          }
+          else {
+             java.lang.String lStrVal = lNodeSet.str();
+             double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+             
+             result = new XNumber(lDouble - rDouble);
+          }
       }
-      else if (right instanceof XSFloat) {
-          isFloatRarg = true;
-          rArg = ((XSFloat)right).floatValue();    
+      else if ((left instanceof XNodeSet) && (right instanceof XNodeSet)) {
+          double lDouble = 0.0d;
+          double rDouble = 0.0d;
+          
+          XNodeSet lNodeSet = (XNodeSet)left;
+          if (lNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the first "
+                                                                                   + "operand of subtraction operator '-'.");  
+          }
+          else {
+             java.lang.String lStrVal = lNodeSet.str();
+             lDouble = (Double.valueOf(lStrVal)).doubleValue();
+          }
+          
+          XNodeSet rNodeSet = (XNodeSet)right;
+          if (rNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the second "
+                                                                                   + "operand of subtraction operator '-'.");  
+          }
+          else {
+             java.lang.String rStrVal = rNodeSet.str();
+             rDouble = (Double.valueOf(rStrVal)).doubleValue();
+          }
+          
+          result = new XNumber(lDouble - rDouble);
       }
-      else {
-          rightArg = right.num();  
+      else if ((left instanceof XSYearMonthDuration) && (right instanceof XSYearMonthDuration)) {
+          result = ((XSYearMonthDuration)left).subtract((XSYearMonthDuration)right);
+          
+          return result;
       }
-      
-      if (isFloatLarg && isFloatRarg) {
-         // currently, supporting XSFloat typed result, when both operands 
-         // are of type XSFloat.  
-         result = new XSFloat(lArg - rArg);
-         return result;
+      else {          
+          try {
+             result = new XNumber(left.num() - right.num());
+          }
+          catch (Exception ex) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : could not apply the "
+                                                                                    + "subtraction operator '-', due to incorrectly "
+                                                                                    + "typed operand(s)."); 
+          }
       }
       
-      // by default, format the double value upto two decimal places
-      java.lang.String formattedDblStr = java.lang.String.format("%.2f", 
-                                                              leftArg - rightArg);
-      
-      
-      result = new XNumber((new Double(formattedDblStr)).doubleValue());
-      
       return result;
   }
   
diff --git a/src/org/apache/xpath/operations/Mult.java b/src/org/apache/xpath/operations/Mult.java
index e4992787..dddc5b44 100644
--- a/src/org/apache/xpath/operations/Mult.java
+++ b/src/org/apache/xpath/operations/Mult.java
@@ -21,10 +21,13 @@
 package org.apache.xpath.operations;
 
 import org.apache.xpath.XPathContext;
+import org.apache.xpath.XPathException;
+import org.apache.xpath.objects.XNodeSet;
 import org.apache.xpath.objects.XNumber;
 import org.apache.xpath.objects.XObject;
 import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSInteger;
+import org.apache.xpath.xs.types.XSNumericType;
+import org.apache.xpath.xs.types.XSYearMonthDuration;
 
 /**
  * The '*' operation expression executer.
@@ -49,46 +52,172 @@ public class Mult extends Operation
   {
       XObject result = null;
       
-      if ((left instanceof XSInteger) && (right instanceof XSInteger)) {
-          result = ((XSInteger)left).multiply((XSInteger)right);       
+      if ((left instanceof XNumber) && (right instanceof XSNumericType)) {
+          double lDouble = ((XNumber)left).num();
+          
+          java.lang.String rStrVal = ((XSNumericType)right).stringValue();
+          double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+          
+          result = new XNumber(lDouble * rDouble);
       }
-      else if ((left instanceof XSInteger) && (right instanceof XNumber)) {
-          double lDouble = (((XSInteger)left).intValue()).doubleValue();
+      else if ((left instanceof XSNumericType) && (right instanceof XNumber)) {
+          java.lang.String lStrVal = ((XSNumericType)left).stringValue();
+          double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+          
           double rDouble = ((XNumber)right).num();
-          result = new XNumber(lDouble * rDouble);          
+          
+          result = new XNumber(lDouble * rDouble);
       }
-      else if ((left instanceof XNumber) && (right instanceof XSInteger)) {          
+      else if ((left instanceof XNumber) && (right instanceof XNumber)) {
           double lDouble = ((XNumber)left).num();
-          double rDouble = (((XSInteger)right).intValue()).doubleValue();
-          result = new XNumber(lDouble * rDouble);          
+          double rDouble = ((XNumber)right).num();
+          
+          result = new XNumber(lDouble * rDouble);
       }
-      else if ((left instanceof XSDouble) && (right instanceof XSDouble)) {          
-          double lDouble = ((XSDouble)left).doubleValue();
-          double rDouble = ((XSDouble)right).doubleValue();
-          result = new XNumber(lDouble * rDouble);          
+      else if ((left instanceof XSNumericType) && (right instanceof XSNumericType)) {
+          java.lang.String lStrVal = ((XSNumericType)left).stringValue();
+          double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+          
+          java.lang.String rStrVal = ((XSNumericType)right).stringValue();
+          double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+          
+          result = new XNumber(lDouble * rDouble);
       }
-      else if ((left instanceof XNumber) && (right instanceof XSDouble)) {          
+      else if ((left instanceof XNumber) && (right instanceof XNodeSet)) {
           double lDouble = ((XNumber)left).num();
-          double rDouble = ((XSDouble)right).doubleValue();
-          result = new XNumber(lDouble * rDouble);          
+          
+          XNodeSet rNodeSet = (XNodeSet)right;
+          if (rNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the second "
+                                                                                   + "operand of multiplication operator '*'.");  
+          }
+          else {
+             java.lang.String rStrVal = rNodeSet.str();
+             double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+             
+             result = new XNumber(lDouble * rDouble);
+          }
       }
-      else if ((left instanceof XSDouble) && (right instanceof XNumber)) {          
-          double lDouble = ((XSDouble)left).doubleValue();
+      else if ((left instanceof XNodeSet) && (right instanceof XNumber)) {
           double rDouble = ((XNumber)right).num();
-          result = new XNumber(lDouble * rDouble);          
+          
+          XNodeSet lNodeSet = (XNodeSet)left;
+          if (lNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the first "
+                                                                                   + "operand of multiplication operator '*'.");  
+          }
+          else {
+             java.lang.String lStrVal = lNodeSet.str();
+             double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+             
+             result = new XNumber(lDouble * rDouble);
+          }
+      }
+      else if ((left instanceof XSNumericType) && (right instanceof XNodeSet)) {
+          java.lang.String lStrVal = ((XSNumericType)left).stringValue();
+          double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+          
+          XNodeSet rNodeSet = (XNodeSet)right;
+          if (rNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the second "
+                                                                                   + "operand of multiplication operator '*'.");  
+          }
+          else {
+             java.lang.String rStrVal = rNodeSet.str();
+             double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+             
+             result = new XNumber(lDouble * rDouble);
+          }
+      }
+      else if ((left instanceof XNodeSet) && (right instanceof XSNumericType)) {
+          java.lang.String rStrVal = ((XSNumericType)right).stringValue();
+          double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+          
+          XNodeSet lNodeSet = (XNodeSet)left;
+          if (lNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the first "
+                                                                                   + "operand of multiplication operator '*'.");  
+          }
+          else {
+             java.lang.String lStrVal = lNodeSet.str();
+             double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+             
+             result = new XNumber(lDouble * rDouble);
+          }
+      }
+      else if ((left instanceof XNodeSet) && (right instanceof XNodeSet)) {
+          double lDouble = 0.0d;
+          double rDouble = 0.0d;
+          
+          XNodeSet lNodeSet = (XNodeSet)left;
+          if (lNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the first "
+                                                                                   + "operand of multiplication operator '*'.");  
+          }
+          else {
+             java.lang.String lStrVal = lNodeSet.str();
+             lDouble = (Double.valueOf(lStrVal)).doubleValue();
+          }
+          
+          XNodeSet rNodeSet = (XNodeSet)right;
+          if (rNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the second "
+                                                                                   + "operand of multiplication operator '*'.");  
+          }
+          else {
+             java.lang.String rStrVal = rNodeSet.str();
+             rDouble = (Double.valueOf(rStrVal)).doubleValue();
+          }
+          
+          result = new XNumber(lDouble * rDouble);
+      }
+      else if ((left instanceof XSYearMonthDuration) && 
+                                                 (right instanceof XNumber)) {
+          try {
+             double rDouble = ((XNumber)right).num();
+             result = ((XSYearMonthDuration)left).mult(new XSDouble(rDouble));
+          }
+          catch (XPathException ex) {
+             throw new javax.xml.transform.TransformerException(ex.getMessage());  
+          }
       }
-      else if ((left instanceof XSInteger) && (right instanceof XSDouble)) {
-          double lDouble = (((XSInteger)left).intValue()).doubleValue();
-          double rDouble = ((XSDouble)right).doubleValue();
-          result = new XNumber(lDouble * rDouble); 
+      else if ((left instanceof XSYearMonthDuration) && 
+                                                 (right instanceof XSNumericType)) {
+          try {
+             java.lang.String rStrVal = ((XSNumericType)right).stringValue();
+             result = ((XSYearMonthDuration)left).mult(new XSDouble(rStrVal));
+          }
+          catch (XPathException ex) {
+             throw new javax.xml.transform.TransformerException(ex.getMessage());  
+          }
       }
-      else if ((left instanceof XSDouble) && (right instanceof XSInteger)) {
-          double lDouble = ((XSDouble)left).doubleValue();
-          double rDouble = (((XSInteger)right).intValue()).doubleValue();
-          result = new XNumber(lDouble * rDouble); 
+      else if ((left instanceof XSYearMonthDuration) && (right instanceof XNodeSet)) {
+          XNodeSet rNodeSet = (XNodeSet)right;
+          if (rNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                 + "than one item is not allowed as the second "
+                                                                                 + "operand of multiplication operator '*'.");  
+          }
+          else {
+             java.lang.String rStrVal = rNodeSet.str();
+             result = ((XSYearMonthDuration)left).mult(new XSDouble(rStrVal));
+          }
       }
       else {
-          result = new XNumber(left.num() * right.num());
+          try {
+             result = new XNumber(left.num() * right.num());
+          }
+          catch (Exception ex) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : could not apply the "
+                                                                                   + "multiplication operator '*', due to incorrectly "
+                                                                                   + "typed operand(s)."); 
+          }
       }
       
       return result;
diff --git a/src/org/apache/xpath/operations/Plus.java b/src/org/apache/xpath/operations/Plus.java
index 9038e960..7831238b 100644
--- a/src/org/apache/xpath/operations/Plus.java
+++ b/src/org/apache/xpath/operations/Plus.java
@@ -20,16 +20,11 @@
  */
 package org.apache.xpath.operations;
 
-import java.math.BigInteger;
-
 import org.apache.xpath.XPathContext;
+import org.apache.xpath.objects.XNodeSet;
 import org.apache.xpath.objects.XNumber;
 import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDecimal;
-import org.apache.xpath.xs.types.XSFloat;
-import org.apache.xpath.xs.types.XSInt;
-import org.apache.xpath.xs.types.XSInteger;
-import org.apache.xpath.xs.types.XSLong;
+import org.apache.xpath.xs.types.XSNumericType;
 import org.apache.xpath.xs.types.XSYearMonthDuration;
 
 /**
@@ -53,77 +48,145 @@ public class Plus extends Operation
   public XObject operate(XObject left, XObject right)
                                            throws javax.xml.transform.TransformerException {
       XObject result = null;
-      
-      if ((left instanceof XSInteger) && (right instanceof XSInteger)) {
-         BigInteger bigintLeft = ((XSInteger)left).intValue();
-         BigInteger bigintRight = ((XSInteger)right).intValue();
-         
-         return new XSInteger(bigintLeft.add(bigintRight));    
-      }      
-      
-      if ((left instanceof XSLong) && (right instanceof XSLong)) {
-          BigInteger bigintLeft = ((XSLong)left).intValue();
-          BigInteger bigintRight = ((XSLong)right).intValue();
+   
+      if ((left instanceof XNumber) && (right instanceof XSNumericType)) {
+          double lDouble = ((XNumber)left).num();
           
-          // its possible that, result after addition is, not within value space of xs:long.
-          // handle this error. revisit
-          return new XSLong(bigintLeft.add(bigintRight));    
-      }      
-      
-      if ((left instanceof XSInt) && (right instanceof XSInt)) {
-          BigInteger bigintLeft = ((XSInt)left).intValue();
-          BigInteger bigintRight = ((XSInt)right).intValue();
+          java.lang.String rStrVal = ((XSNumericType)right).stringValue();
+          double rDouble = (Double.valueOf(rStrVal)).doubleValue();
           
-          // its possible that, result after addition is, not within value space of xs:int.
-          // handle this error. revisit
-          return new XSInt(bigintLeft.add(bigintRight));    
+          result = new XNumber(lDouble + rDouble);
       }
-      
-      if ((left instanceof XSYearMonthDuration) && 
-                                         (right instanceof XSYearMonthDuration)) {
-          return ((XSYearMonthDuration)left).add((XSYearMonthDuration)right);  
+      else if ((left instanceof XSNumericType) && (right instanceof XNumber)) {
+          java.lang.String lStrVal = ((XSNumericType)left).stringValue();
+          double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+          
+          double rDouble = ((XNumber)right).num();
+          
+          result = new XNumber(lDouble + rDouble);
       }
-      
-      double leftArg = 0.0;
-      double rightArg = 0.0;
-      
-      float lArg = (float)0.0;
-      float rArg = (float)0.0;
-      
-      boolean isFloatLarg = false;
-      boolean isFloatRarg = false;
-      
-      if (left instanceof XSDecimal) {
-          leftArg = ((XSDecimal)left).doubleValue();    
+      else if ((left instanceof XNumber) && (right instanceof XNumber)) {
+          double lDouble = ((XNumber)left).num();
+          double rDouble = ((XNumber)right).num();
+          
+          result = new XNumber(lDouble + rDouble);
       }
-      else if (left instanceof XSFloat) {
-          isFloatLarg = true;
-          lArg = ((XSFloat)left).floatValue();    
+      else if ((left instanceof XSNumericType) && (right instanceof XSNumericType)) {
+          java.lang.String lStrVal = ((XSNumericType)left).stringValue();
+          double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+          
+          java.lang.String rStrVal = ((XSNumericType)right).stringValue();
+          double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+          
+          result = new XNumber(lDouble + rDouble);
       }
-      else {
-          leftArg = left.num();  
+      else if ((left instanceof XNumber) && (right instanceof XNodeSet)) {
+          double lDouble = ((XNumber)left).num();
+          
+          XNodeSet rNodeSet = (XNodeSet)right;
+          if (rNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the second "
+                                                                                   + "operand of addition operator '+'.");  
+          }
+          else {
+             java.lang.String rStrVal = rNodeSet.str();
+             double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+             
+             result = new XNumber(lDouble + rDouble);
+          }
       }
-      
-      if (right instanceof XSDecimal) {
-          rightArg = ((XSDecimal)right).doubleValue();    
+      else if ((left instanceof XNodeSet) && (right instanceof XNumber)) {
+          double rDouble = ((XNumber)right).num();
+          
+          XNodeSet lNodeSet = (XNodeSet)left;
+          if (lNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the first "
+                                                                                   + "operand of addition operator '+'.");  
+          }
+          else {
+             java.lang.String lStrVal = lNodeSet.str();
+             double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+             
+             result = new XNumber(lDouble + rDouble);
+          }
       }
-      else if (right instanceof XSFloat) {
-          isFloatRarg = true;
-          rArg = ((XSFloat)right).floatValue();    
+      else if ((left instanceof XSNumericType) && (right instanceof XNodeSet)) {
+          java.lang.String lStrVal = ((XSNumericType)left).stringValue();
+          double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+          
+          XNodeSet rNodeSet = (XNodeSet)right;
+          if (rNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the second "
+                                                                                   + "operand of addition operator '+'.");  
+          }
+          else {
+             java.lang.String rStrVal = rNodeSet.str();
+             double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+             
+             result = new XNumber(lDouble + rDouble);
+          }
       }
-      else {
-          rightArg = right.num();  
+      else if ((left instanceof XNodeSet) && (right instanceof XSNumericType)) {
+          java.lang.String rStrVal = ((XSNumericType)right).stringValue();
+          double rDouble = (Double.valueOf(rStrVal)).doubleValue();
+          
+          XNodeSet lNodeSet = (XNodeSet)left;
+          if (lNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the first "
+                                                                                   + "operand of addition operator '+'.");  
+          }
+          else {
+             java.lang.String lStrVal = lNodeSet.str();
+             double lDouble = (Double.valueOf(lStrVal)).doubleValue();
+             
+             result = new XNumber(lDouble + rDouble);
+          }
       }
-      
-      if (isFloatLarg && isFloatRarg) {
-         // currently, supporting XSFloat typed result, when both operands 
-         // are of type XSFloat.  
-         result = new XSFloat(lArg + rArg);
-         
-         return result;
+      else if ((left instanceof XNodeSet) && (right instanceof XNodeSet)) {
+          double lDouble = 0.0d;
+          double rDouble = 0.0d;
+          
+          XNodeSet lNodeSet = (XNodeSet)left;
+          if (lNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the first "
+                                                                                   + "operand of addition operator '+'.");  
+          }
+          else {
+             java.lang.String lStrVal = lNodeSet.str();
+             lDouble = (Double.valueOf(lStrVal)).doubleValue();
+          }
+          
+          XNodeSet rNodeSet = (XNodeSet)right;
+          if (rNodeSet.getLength() > 1) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : a sequence of more "
+                                                                                   + "than one item is not allowed as the second "
+                                                                                   + "operand of addition operator '+'.");  
+          }
+          else {
+             java.lang.String rStrVal = rNodeSet.str();
+             rDouble = (Double.valueOf(rStrVal)).doubleValue();
+          }
+          
+          result = new XNumber(lDouble + rDouble);
+      }
+      else if ((left instanceof XSYearMonthDuration) && (right instanceof XSYearMonthDuration)) {
+          result = ((XSYearMonthDuration)left).add((XSYearMonthDuration)right);  
+      }
+      else {
+          try {
+             result = new XNumber(left.num() + right.num());
+          }
+          catch (Exception ex) {
+             throw new javax.xml.transform.TransformerException("XPTY0004 : could not apply the "
+                                                                                     + "addition operator '+', due to incorrectly "
+                                                                                     + "typed operand(s)."); 
+          }
       }
-      
-      result = new XNumber(leftArg + rightArg);
       
       return result;
   }
diff --git a/src/org/apache/xpath/xs/types/XSDecimal.java b/src/org/apache/xpath/xs/types/XSDecimal.java
index 980a9519..e1cdb9f6 100644
--- a/src/org/apache/xpath/xs/types/XSDecimal.java
+++ b/src/org/apache/xpath/xs/types/XSDecimal.java
@@ -92,7 +92,7 @@ public class XSDecimal extends XSNumericType {
         try {            
             XSDecimal xsDecimal = castToDecimal(xsAnyType);            
             resultSeq.add(xsDecimal);
-        } catch (NumberFormatException e) {
+        } catch (NumberFormatException ex) {
             // to do
             return null;
         }        
diff --git a/src/org/apache/xpath/xs/types/XSYearMonthDuration.java b/src/org/apache/xpath/xs/types/XSYearMonthDuration.java
index 3541ae9f..fcd721cb 100644
--- a/src/org/apache/xpath/xs/types/XSYearMonthDuration.java
+++ b/src/org/apache/xpath/xs/types/XSYearMonthDuration.java
@@ -19,6 +19,7 @@
  */
 package org.apache.xpath.xs.types;
 
+import org.apache.xpath.XPathException;
 import org.apache.xpath.objects.ResultSequence;
 
 /**
@@ -261,7 +262,7 @@ public class XSYearMonthDuration extends XSDuration {
     }
     
     /**
-     * Subtract one XSYearMonthDuration value from another XSYearMonthDuration value,
+     * Subtract an XSYearMonthDuration value from another XSYearMonthDuration value,
      * and return the result as an XSYearMonthDuration value.
      */
     public XSYearMonthDuration subtract(XSYearMonthDuration arg) {
@@ -270,6 +271,59 @@ public class XSYearMonthDuration extends XSDuration {
        return result; 
     }
     
+    /**
+     * Multiply an XSYearMonthDuration value by a numeric value, and return the 
+     * result as an XSYearMonthDuration value.
+     */
+    public XSYearMonthDuration mult(XSDouble arg) throws XPathException {
+       XSYearMonthDuration result = null;
+       
+       if (arg.nan()) {
+          throw new XPathException("FOCA0005 : NaN supplied as float/double value.");    
+       }
+       
+       if (arg.infinite()) {
+          throw new XPathException("FODT0001 : Overflow/underflow of value for the "
+                                                                         + "date/time operation.");
+       }
+       
+       int intVal = (int)Math.round(monthValue() * arg.doubleValue());
+       
+       result = new XSYearMonthDuration(intVal);
+       
+       return result; 
+    }
+    
+    /**
+     * Divide an XSYearMonthDuration value by a numeric value, and return the 
+     * result as an XSYearMonthDuration value.
+     */
+    public XSYearMonthDuration div(XSDouble arg) throws XPathException {
+        XSYearMonthDuration result = null;
+        
+        if (arg.nan()) {
+           throw new XPathException("FOCA0005 : NaN supplied as float/double value.");    
+        }
+        
+        if (arg.infinite()) {
+           result = new XSYearMonthDuration(0); 
+        }
+        else {
+           XSDouble xsDouble = (XSDouble)arg;
+
+           if (!arg.zero()) {
+              int intVal = (int)Math.round(monthValue() / xsDouble.doubleValue());
+              result = new XSYearMonthDuration(intVal); 
+           }
+           else {
+              throw new XPathException("FODT0001 : Overflow/underflow of value for the "
+                                                                                    + "date/time operation."); 
+           } 
+        }
+
+        return result;
+    }
+    
     /**
      * Do a data type cast, of a XSAnyType value to an XSDuration
      * value. 
diff --git a/tests/org/apache/xalan/xpath3/XPathArithmeticOnDurationValuesTests.java b/tests/org/apache/xalan/xpath3/XPathArithmeticOnDurationValuesTests.java
index be77fdde..6cfea310 100644
--- a/tests/org/apache/xalan/xpath3/XPathArithmeticOnDurationValuesTests.java
+++ b/tests/org/apache/xalan/xpath3/XPathArithmeticOnDurationValuesTests.java
@@ -69,5 +69,75 @@ public class XPathArithmeticOnDurationValuesTests extends XslTransformTestsUtil
         
         runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
     }
+    
+    @Test
+    public void xslArithmeticOnDurationValuesTest3() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test3.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test3.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test3.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslArithmeticOnDurationValuesTest4() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_b.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test4.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test4.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslArithmeticOnDurationValuesTest5() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_c.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test5.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test4.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslArithmeticOnDurationValuesTest6() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test6.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test6.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test6.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslArithmeticOnDurationValuesTest7() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_d.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test7.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test6.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslArithmeticOnDurationValuesTest8() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_e.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test8.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test6.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslArithmeticOnDurationValuesTest9() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_f.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test9.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test6.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
 
 }
diff --git a/tests/xpath_duration_value_arithmetic/gold/test3.out b/tests/xpath_duration_value_arithmetic/gold/test3.out
new file mode 100644
index 00000000..36ca14a8
--- /dev/null
+++ b/tests/xpath_duration_value_arithmetic/gold/test3.out
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>P6Y9M</one>
+  <two>P8Y9M</two>
+  <three>P8Y</three>
+  <four>P0M</four>
+  <five>P0M</five>
+</result>
diff --git a/tests/xpath_duration_value_arithmetic/gold/test4.out b/tests/xpath_duration_value_arithmetic/gold/test4.out
new file mode 100644
index 00000000..36ca14a8
--- /dev/null
+++ b/tests/xpath_duration_value_arithmetic/gold/test4.out
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>P6Y9M</one>
+  <two>P8Y9M</two>
+  <three>P8Y</three>
+  <four>P0M</four>
+  <five>P0M</five>
+</result>
diff --git a/tests/xpath_duration_value_arithmetic/gold/test6.out b/tests/xpath_duration_value_arithmetic/gold/test6.out
new file mode 100644
index 00000000..4edf95ce
--- /dev/null
+++ b/tests/xpath_duration_value_arithmetic/gold/test6.out
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>P1Y11M</one>
+  <two>P1Y6M</two>
+  <three>P1Y5M</three>
+  <four>P11M</four>
+  <five>P9M</five>
+</result>
diff --git a/tests/xpath_duration_value_arithmetic/test1.xsl b/tests/xpath_duration_value_arithmetic/test1.xsl
index 32ba215f..16a200a7 100644
--- a/tests/xpath_duration_value_arithmetic/test1.xsl
+++ b/tests/xpath_duration_value_arithmetic/test1.xsl
@@ -7,7 +7,9 @@
    <!-- Author: mukulg@apache.org -->
    
    <!-- This XSLT stylesheet, tests XPath 3.1 arithmetic on
-        XML Schema duration typed values. -->                
+        XML Schema duration typed values. The XPath expression
+        examples, as mentioned within this test case are borrowed
+        from XPath 3.1 spec. -->                
 
    <xsl:output method="xml" indent="yes"/>
       
diff --git a/tests/xpath_duration_value_arithmetic/test1_b.xml b/tests/xpath_duration_value_arithmetic/test1_b.xml
new file mode 100644
index 00000000..8175a580
--- /dev/null
+++ b/tests/xpath_duration_value_arithmetic/test1_b.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<temp>
+  <val1>P2Y11M</val1>
+  <val2>
+    <num>2.3</num>
+    <num>3</num>
+    <num>2.75</num>
+    <num>0</num>
+    <num>-0</num>
+  </val2>
+</temp>
\ No newline at end of file
diff --git a/tests/xpath_duration_value_arithmetic/test1_c.xml b/tests/xpath_duration_value_arithmetic/test1_c.xml
new file mode 100644
index 00000000..7ba7efd3
--- /dev/null
+++ b/tests/xpath_duration_value_arithmetic/test1_c.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<temp>
+  <val1>P2Y11M</val1>
+  <val2>
+    <num x1="2.3"/>
+    <num x1="3"/>
+    <num x1="2.75"/>
+    <num x1="0"/>
+    <num x1="-0"/>
+  </val2>
+</temp>
\ No newline at end of file
diff --git a/tests/xpath_duration_value_arithmetic/test1_d.xml b/tests/xpath_duration_value_arithmetic/test1_d.xml
new file mode 100644
index 00000000..c59690ef
--- /dev/null
+++ b/tests/xpath_duration_value_arithmetic/test1_d.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<temp>
+  <val1>P2Y11M</val1>
+  <val2>
+    <num>1.5</num>
+    <num>2</num>
+    <num>2.1</num>
+    <num>3.1</num>
+    <num>4.1</num>
+  </val2>
+</temp>
\ No newline at end of file
diff --git a/tests/xpath_duration_value_arithmetic/test1_e.xml b/tests/xpath_duration_value_arithmetic/test1_e.xml
new file mode 100644
index 00000000..058e2e13
--- /dev/null
+++ b/tests/xpath_duration_value_arithmetic/test1_e.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<temp>
+  <val1>P2Y11M</val1>
+  <val2>
+    <num x1="1.5"/>
+    <num x1="2"/>
+    <num x1="2.1"/>
+    <num x1="3.1"/>
+    <num x1="4.1"/>
+  </val2>
+</temp>
\ No newline at end of file
diff --git a/tests/xpath_duration_value_arithmetic/test1_f.xml b/tests/xpath_duration_value_arithmetic/test1_f.xml
new file mode 100644
index 00000000..a5e21591
--- /dev/null
+++ b/tests/xpath_duration_value_arithmetic/test1_f.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<temp>
+  <val1 x1="P2Y11M"/>
+  <val2>
+    <num x1="1.5"/>
+    <num x1="2"/>
+    <num x1="2.1"/>
+    <num x1="3.1"/>
+    <num x1="4.1"/>
+  </val2>
+</temp>
\ No newline at end of file
diff --git a/tests/xpath_duration_value_arithmetic/test1.xsl b/tests/xpath_duration_value_arithmetic/test3.xsl
similarity index 79%
copy from tests/xpath_duration_value_arithmetic/test1.xsl
copy to tests/xpath_duration_value_arithmetic/test3.xsl
index 32ba215f..32332b41 100644
--- a/tests/xpath_duration_value_arithmetic/test1.xsl
+++ b/tests/xpath_duration_value_arithmetic/test3.xsl
@@ -7,14 +7,17 @@
    <!-- Author: mukulg@apache.org -->
    
    <!-- This XSLT stylesheet, tests XPath 3.1 arithmetic on
-        XML Schema duration typed values. -->                
+        XML Schema duration typed values. -->                 
 
    <xsl:output method="xml" indent="yes"/>
       
    <xsl:template match="/">
       <result>
-         <one><xsl:value-of select="xs:yearMonthDuration('P2Y11M') + xs:yearMonthDuration('P3Y3M')"/></one>
-         <two><xsl:value-of select="xs:yearMonthDuration('P2Y11M') - xs:yearMonthDuration('P3Y3M')"/></two>
+         <one><xsl:value-of select="xs:yearMonthDuration('P2Y11M') * 2.3"/></one>
+         <two><xsl:value-of select="xs:yearMonthDuration('P2Y11M') * xs:integer(3)"/></two>
+         <three><xsl:value-of select="xs:yearMonthDuration('P2Y11M') * xs:double(2.75)"/></three>
+         <four><xsl:value-of select="xs:yearMonthDuration('P2Y11M') * 0"/></four>
+         <five><xsl:value-of select="xs:yearMonthDuration('P2Y11M') * -0"/></five>
       </result>
    </xsl:template>
    
diff --git a/tests/xs_constructor_functions/test10.xsl b/tests/xpath_duration_value_arithmetic/test4.xsl
similarity index 64%
copy from tests/xs_constructor_functions/test10.xsl
copy to tests/xpath_duration_value_arithmetic/test4.xsl
index 2d0ef7e7..d2084b1b 100644
--- a/tests/xs_constructor_functions/test10.xsl
+++ b/tests/xpath_duration_value_arithmetic/test4.xsl
@@ -8,19 +8,20 @@
    
    <!-- use with test1_b.xml -->
    
-     <!-- this stylesheet, does few XPath arithmetic and logical operations, 
-          involving xs:integer type. -->              
+   <!-- This XSLT stylesheet, tests XPath 3.1 arithmetic
+        on XML Schema duration typed values, by fetching
+        the input values from an XML external source 
+        document. -->                
 
    <xsl:output method="xml" indent="yes"/>
-
-   <xsl:template match="/elem">
+      
+   <xsl:template match="/temp">
       <result>
-         <one><xsl:value-of select="xs:integer(a) + xs:integer(b)"/></one>
-         <two><xsl:value-of select="xs:integer(d) - xs:integer(a)"/></two>
-         <three><xsl:value-of select="(xs:integer(d) - xs:integer(a)) = 3"/></three>
-         <four><xsl:value-of select="not((xs:integer(d) - xs:integer(a)) = 3)"/></four>
-         <xsl:variable name="temp1" select="xs:integer(a) + xs:integer(b)"/>
-         <five><xsl:value-of select="$temp1"/></five>
+         <one><xsl:value-of select="xs:yearMonthDuration(val1) * val2/num[1]"/></one>
+         <two><xsl:value-of select="xs:yearMonthDuration(val1) * xs:integer(val2/num[2])"/></two>
+         <three><xsl:value-of select="xs:yearMonthDuration(val1) * xs:double(val2/num[3])"/></three>
+         <four><xsl:value-of select="xs:yearMonthDuration(val1) * val2/num[4]"/></four>
+         <five><xsl:value-of select="xs:yearMonthDuration(val1) * val2/num[5]"/></five>
       </result>
    </xsl:template>
    
diff --git a/tests/xpath_duration_value_arithmetic/test1.xsl b/tests/xpath_duration_value_arithmetic/test5.xsl
similarity index 62%
copy from tests/xpath_duration_value_arithmetic/test1.xsl
copy to tests/xpath_duration_value_arithmetic/test5.xsl
index 32ba215f..9d7f6ebf 100644
--- a/tests/xpath_duration_value_arithmetic/test1.xsl
+++ b/tests/xpath_duration_value_arithmetic/test5.xsl
@@ -6,15 +6,22 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- This XSLT stylesheet, tests XPath 3.1 arithmetic on
-        XML Schema duration typed values. -->                
+   <!-- use with test1_c.xml -->
+   
+   <!-- This XSLT stylesheet, tests XPath 3.1 arithmetic
+        on XML Schema duration typed values, by fetching
+        the input values from an XML external source 
+        document. -->                 
 
    <xsl:output method="xml" indent="yes"/>
       
-   <xsl:template match="/">
+   <xsl:template match="/temp">
       <result>
-         <one><xsl:value-of select="xs:yearMonthDuration('P2Y11M') + xs:yearMonthDuration('P3Y3M')"/></one>
-         <two><xsl:value-of select="xs:yearMonthDuration('P2Y11M') - xs:yearMonthDuration('P3Y3M')"/></two>
+         <one><xsl:value-of select="xs:yearMonthDuration(val1) * val2/num[1]/@x1"/></one>
+         <two><xsl:value-of select="xs:yearMonthDuration(val1) * xs:integer(val2/num[2]/@x1)"/></two>
+         <three><xsl:value-of select="xs:yearMonthDuration(val1) * xs:double(val2/num[3]/@x1)"/></three>
+         <four><xsl:value-of select="xs:yearMonthDuration(val1) * val2/num[4]/@x1"/></four>
+         <five><xsl:value-of select="xs:yearMonthDuration(val1) * val2/num[5]/@x1"/></five>
       </result>
    </xsl:template>
    
diff --git a/tests/xpath_duration_value_arithmetic/test1.xsl b/tests/xpath_duration_value_arithmetic/test6.xsl
similarity index 81%
copy from tests/xpath_duration_value_arithmetic/test1.xsl
copy to tests/xpath_duration_value_arithmetic/test6.xsl
index 32ba215f..e1cb7b0d 100644
--- a/tests/xpath_duration_value_arithmetic/test1.xsl
+++ b/tests/xpath_duration_value_arithmetic/test6.xsl
@@ -13,8 +13,11 @@
       
    <xsl:template match="/">
       <result>
-         <one><xsl:value-of select="xs:yearMonthDuration('P2Y11M') + xs:yearMonthDuration('P3Y3M')"/></one>
-         <two><xsl:value-of select="xs:yearMonthDuration('P2Y11M') - xs:yearMonthDuration('P3Y3M')"/></two>
+         <one><xsl:value-of select="xs:yearMonthDuration('P2Y11M') div 1.5"/></one>
+         <two><xsl:value-of select="xs:yearMonthDuration('P2Y11M') div xs:integer(2)"/></two>
+         <three><xsl:value-of select="xs:yearMonthDuration('P2Y11M') div number(2.1)"/></three>
+         <four><xsl:value-of select="xs:yearMonthDuration('P2Y11M') div xs:float(3.1)"/></four>
+         <five><xsl:value-of select="xs:yearMonthDuration('P2Y11M') div xs:double(4.1)"/></five>
       </result>
    </xsl:template>
    
diff --git a/tests/xpath_duration_value_arithmetic/test1.xsl b/tests/xpath_duration_value_arithmetic/test7.xsl
similarity index 65%
copy from tests/xpath_duration_value_arithmetic/test1.xsl
copy to tests/xpath_duration_value_arithmetic/test7.xsl
index 32ba215f..7556c2b1 100644
--- a/tests/xpath_duration_value_arithmetic/test1.xsl
+++ b/tests/xpath_duration_value_arithmetic/test7.xsl
@@ -6,15 +6,21 @@
                 
    <!-- Author: mukulg@apache.org -->
    
+   <!-- use with test1_d.xml -->
+   
    <!-- This XSLT stylesheet, tests XPath 3.1 arithmetic on
-        XML Schema duration typed values. -->                
+        XML Schema duration typed values, by fetching the 
+        input values from an XML external source document. -->                
 
    <xsl:output method="xml" indent="yes"/>
       
-   <xsl:template match="/">
+   <xsl:template match="/temp">
       <result>
-         <one><xsl:value-of select="xs:yearMonthDuration('P2Y11M') + xs:yearMonthDuration('P3Y3M')"/></one>
-         <two><xsl:value-of select="xs:yearMonthDuration('P2Y11M') - xs:yearMonthDuration('P3Y3M')"/></two>
+         <one><xsl:value-of select="xs:yearMonthDuration(val1) div val2/num[1]"/></one>
+         <two><xsl:value-of select="xs:yearMonthDuration(val1) div xs:integer(val2/num[2])"/></two>
+         <three><xsl:value-of select="xs:yearMonthDuration(val1) div number(val2/num[3])"/></three>
+         <four><xsl:value-of select="xs:yearMonthDuration(val1) div xs:float(val2/num[4])"/></four>
+         <five><xsl:value-of select="xs:yearMonthDuration(val1) div xs:double(val2/num[5])"/></five>
       </result>
    </xsl:template>
    
diff --git a/tests/xpath_duration_value_arithmetic/test1.xsl b/tests/xpath_duration_value_arithmetic/test8.xsl
similarity index 64%
copy from tests/xpath_duration_value_arithmetic/test1.xsl
copy to tests/xpath_duration_value_arithmetic/test8.xsl
index 32ba215f..1498be8b 100644
--- a/tests/xpath_duration_value_arithmetic/test1.xsl
+++ b/tests/xpath_duration_value_arithmetic/test8.xsl
@@ -6,15 +6,21 @@
                 
    <!-- Author: mukulg@apache.org -->
    
+   <!-- use with test1_e.xml -->
+   
    <!-- This XSLT stylesheet, tests XPath 3.1 arithmetic on
-        XML Schema duration typed values. -->                
+        XML Schema duration typed values, by fetching the 
+        input values from an XML external source document. -->                
 
    <xsl:output method="xml" indent="yes"/>
       
-   <xsl:template match="/">
+   <xsl:template match="/temp">
       <result>
-         <one><xsl:value-of select="xs:yearMonthDuration('P2Y11M') + xs:yearMonthDuration('P3Y3M')"/></one>
-         <two><xsl:value-of select="xs:yearMonthDuration('P2Y11M') - xs:yearMonthDuration('P3Y3M')"/></two>
+         <one><xsl:value-of select="xs:yearMonthDuration(val1) div val2/num[1]/@x1"/></one>
+         <two><xsl:value-of select="xs:yearMonthDuration(val1) div xs:integer(val2/num[2]/@x1)"/></two>
+         <three><xsl:value-of select="xs:yearMonthDuration(val1) div number(val2/num[3]/@x1)"/></three>
+         <four><xsl:value-of select="xs:yearMonthDuration(val1) div xs:float(val2/num[4]/@x1)"/></four>
+         <five><xsl:value-of select="xs:yearMonthDuration(val1) div xs:double(val2/num[5]/@x1)"/></five>
       </result>
    </xsl:template>
    
diff --git a/tests/xpath_duration_value_arithmetic/test1.xsl b/tests/xpath_duration_value_arithmetic/test9.xsl
similarity index 63%
copy from tests/xpath_duration_value_arithmetic/test1.xsl
copy to tests/xpath_duration_value_arithmetic/test9.xsl
index 32ba215f..1ecabc4d 100644
--- a/tests/xpath_duration_value_arithmetic/test1.xsl
+++ b/tests/xpath_duration_value_arithmetic/test9.xsl
@@ -6,15 +6,21 @@
                 
    <!-- Author: mukulg@apache.org -->
    
+   <!-- use with test1_f.xml -->
+   
    <!-- This XSLT stylesheet, tests XPath 3.1 arithmetic on
-        XML Schema duration typed values. -->                
+        XML Schema duration typed values, by fetching the 
+        input values from an XML external source document. -->                
 
    <xsl:output method="xml" indent="yes"/>
       
-   <xsl:template match="/">
+   <xsl:template match="/temp">
       <result>
-         <one><xsl:value-of select="xs:yearMonthDuration('P2Y11M') + xs:yearMonthDuration('P3Y3M')"/></one>
-         <two><xsl:value-of select="xs:yearMonthDuration('P2Y11M') - xs:yearMonthDuration('P3Y3M')"/></two>
+         <one><xsl:value-of select="xs:yearMonthDuration(val1/@x1) div val2/num[1]/@x1"/></one>
+         <two><xsl:value-of select="xs:yearMonthDuration(val1/@x1) div xs:integer(val2/num[2]/@x1)"/></two>
+         <three><xsl:value-of select="xs:yearMonthDuration(val1/@x1) div number(val2/num[3]/@x1)"/></three>
+         <four><xsl:value-of select="xs:yearMonthDuration(val1/@x1) div xs:float(val2/num[4]/@x1)"/></four>
+         <five><xsl:value-of select="xs:yearMonthDuration(val1/@x1) div xs:double(val2/num[5]/@x1)"/></five>
       </result>
    </xsl:template>
    
diff --git a/tests/xs_constructor_functions/gold/test5.out b/tests/xs_constructor_functions/gold/test5.out
index 63a67c88..d7553318 100644
--- a/tests/xs_constructor_functions/gold/test5.out
+++ b/tests/xs_constructor_functions/gold/test5.out
@@ -1,7 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?><result>
-  <one>0.1</one>
-  <two>true</two>
-  <three>false</three>
-  <four>true</four>
-  <five>0.22</five>
+  <one>0.10000000000000009</one>
+  <two>0.22000000000000008</two>
 </result>
diff --git a/tests/xs_constructor_functions/gold/test9.out b/tests/xs_constructor_functions/gold/test9.out
index fa046cc7..97bd6a8f 100644
--- a/tests/xs_constructor_functions/gold/test9.out
+++ b/tests/xs_constructor_functions/gold/test9.out
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?><result>
-  <one>0.0999999</one>
+  <one>0.10000000000000009</one>
   <two>2.5</two>
 </result>
diff --git a/tests/xs_constructor_functions/test1.xsl b/tests/xs_constructor_functions/test1.xsl
index 76710a9e..35d88524 100644
--- a/tests/xs_constructor_functions/test1.xsl
+++ b/tests/xs_constructor_functions/test1.xsl
@@ -6,8 +6,9 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- this stylesheet, tests XPath 3.1 constructor function xs:decimal(),
-        and use of logical operations on such values. -->                
+   <!-- This XSLT stylesheet, tests XPath 3.1 constructor function
+        xs:decimal(), and use of XPath logical operations on such 
+        values. -->                
 
    <xsl:output method="xml" indent="yes"/>
 
diff --git a/tests/xs_constructor_functions/test10.xsl b/tests/xs_constructor_functions/test10.xsl
index 2d0ef7e7..e8ab2aa5 100644
--- a/tests/xs_constructor_functions/test10.xsl
+++ b/tests/xs_constructor_functions/test10.xsl
@@ -8,8 +8,8 @@
    
    <!-- use with test1_b.xml -->
    
-     <!-- this stylesheet, does few XPath arithmetic and logical operations, 
-          involving xs:integer type. -->              
+   <!-- This XSLT stylesheet, does few XPath arithmetic and logical 
+        operations, involving xs:integer typed values. -->              
 
    <xsl:output method="xml" indent="yes"/>
 
diff --git a/tests/xs_constructor_functions/test11.xsl b/tests/xs_constructor_functions/test11.xsl
index 03955a4f..d79cbf62 100644
--- a/tests/xs_constructor_functions/test11.xsl
+++ b/tests/xs_constructor_functions/test11.xsl
@@ -8,8 +8,8 @@
    
    <!-- use with test1_b.xml -->
    
-     <!-- this stylesheet, does few XPath arithmetic and logical operations, 
-          involving xs:long type. -->              
+   <!-- This XSLT stylesheet, does few XPath arithmetic and logical 
+        operations, involving xs:long typed values. -->              
 
    <xsl:output method="xml" indent="yes"/>
 
diff --git a/tests/xs_constructor_functions/test12.xsl b/tests/xs_constructor_functions/test12.xsl
index 6d5c339e..a60479bb 100644
--- a/tests/xs_constructor_functions/test12.xsl
+++ b/tests/xs_constructor_functions/test12.xsl
@@ -8,8 +8,8 @@
    
    <!-- use with test1_b.xml -->
    
-     <!-- this stylesheet, does few XPath arithmetic and logical operations, 
-          involving xs:int type. -->              
+   <!-- This XSLT stylesheet, does few XPath arithmetic and logical 
+        operations, involving xs:int typed values. -->              
 
    <xsl:output method="xml" indent="yes"/>
 
diff --git a/tests/xs_constructor_functions/test2.xsl b/tests/xs_constructor_functions/test2.xsl
index c61ce726..c1259fcb 100644
--- a/tests/xs_constructor_functions/test2.xsl
+++ b/tests/xs_constructor_functions/test2.xsl
@@ -6,8 +6,8 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- this stylesheet, tests XPath 3.1 constructor function xs:boolean(),
-        and use of logical operations on such values. -->                
+   <!-- This XSLT stylesheet, tests XPath 3.1 constructor function
+        xs:boolean() and use of logical operations on such values. -->                
 
    <xsl:output method="xml" indent="yes"/>
 
diff --git a/tests/xs_constructor_functions/test3.xsl b/tests/xs_constructor_functions/test3.xsl
index 304e2c23..a89875be 100644
--- a/tests/xs_constructor_functions/test3.xsl
+++ b/tests/xs_constructor_functions/test3.xsl
@@ -4,7 +4,10 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- use with test1_a.xml -->             
+   <!-- use with test1_a.xml -->
+   
+   <!-- This XSLT stylesheet, tests few simple XPath arithmetic
+        expressions. -->             
 
    <xsl:output method="xml" indent="yes"/>
 
diff --git a/tests/xs_constructor_functions/test4.xsl b/tests/xs_constructor_functions/test4.xsl
index 53a733c2..0721cb65 100644
--- a/tests/xs_constructor_functions/test4.xsl
+++ b/tests/xs_constructor_functions/test4.xsl
@@ -8,8 +8,8 @@
    
    <!-- use with test1_a.xml -->
    
-   <!-- this stylesheet, does few XPath arithmetic and logical 
-        operations, involving xs:decimal types. -->             
+   <!-- This XSLT stylesheet, tests few XPath arithmetic and 
+        logical operations, involving xs:decimal types. -->             
 
    <xsl:output method="xml" indent="yes"/>
 
diff --git a/tests/xs_constructor_functions/test5.xsl b/tests/xs_constructor_functions/test5.xsl
index ec6ea5c4..0889e17a 100644
--- a/tests/xs_constructor_functions/test5.xsl
+++ b/tests/xs_constructor_functions/test5.xsl
@@ -8,18 +8,15 @@
    
    <!-- use with test1_a.xml -->
    
-     <!-- this stylesheet, does few XPath arithmetic and logical 
-          operations, involving xs:decimal types. -->              
+   <!-- This XSLT stylesheet, tests few XPath arithmetic and 
+        logical operations, involving xs:decimal types. -->              
 
    <xsl:output method="xml" indent="yes"/>
 
    <xsl:template match="/elem">
       <result>
          <one><xsl:value-of select="(xs:decimal(b) - xs:decimal(a))"/></one>
-         <two><xsl:value-of select="(xs:decimal(b) - xs:decimal(a)) = 0.10"/></two>
-         <three><xsl:value-of select="(xs:decimal(b) - xs:decimal(a)) = 0.12"/></three>
-         <four><xsl:value-of select="(xs:decimal(b) - xs:decimal(a)) = (0.12 - 0.02)"/></four>
-         <five><xsl:value-of select="(xs:decimal(b) - xs:decimal(a)) + 0.12"/></five>
+         <two><xsl:value-of select="(xs:decimal(b) - xs:decimal(a)) + 0.12"/></two>
       </result>
    </xsl:template>
    
diff --git a/tests/xs_constructor_functions/test6.xsl b/tests/xs_constructor_functions/test6.xsl
index 6a3ed73c..c6f38f8e 100644
--- a/tests/xs_constructor_functions/test6.xsl
+++ b/tests/xs_constructor_functions/test6.xsl
@@ -6,8 +6,9 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- this stylesheet, tests XPath 3.1 constructor function xs:decimal(),
-        and use of arithmetic and logical operations on such values. -->                
+   <!-- This XSLT stylesheet, tests XPath 3.1 constructor function
+        xs:decimal() and use of arithmetic and logical operations 
+        on such values. -->                
 
    <xsl:output method="xml" indent="yes"/>
 
diff --git a/tests/xs_constructor_functions/test7.xsl b/tests/xs_constructor_functions/test7.xsl
index 957b084a..b6bdfb31 100644
--- a/tests/xs_constructor_functions/test7.xsl
+++ b/tests/xs_constructor_functions/test7.xsl
@@ -6,8 +6,9 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- this stylesheet, tests XPath 3.1 constructor function xs:float(),
-        along with logical '=' operation evaluation on xs:float values. -->                
+   <!-- This XSLT stylesheet, tests XPath 3.1 constructor function
+        xs:float(), along with logical '=' operation evaluation on 
+        xs:float values. -->                
 
    <xsl:output method="xml" indent="yes"/>
 
diff --git a/tests/xs_constructor_functions/test8.xsl b/tests/xs_constructor_functions/test8.xsl
index d5ea37a8..4f2d9d14 100644
--- a/tests/xs_constructor_functions/test8.xsl
+++ b/tests/xs_constructor_functions/test8.xsl
@@ -6,8 +6,9 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- this stylesheet, tests XPath 3.1 constructor function xs:double(),
-        along with logical '=' operation evaluation on xs:double values. -->                
+   <!-- This XSLT stylesheet, tests XPath 3.1 constructor function
+        xs:double(), along with logical '=' operation evaluation on 
+        xs:double values. -->                
 
    <xsl:output method="xml" indent="yes"/>
 
diff --git a/tests/xs_constructor_functions/test9.xsl b/tests/xs_constructor_functions/test9.xsl
index b8164c72..f4cdf4f8 100644
--- a/tests/xs_constructor_functions/test9.xsl
+++ b/tests/xs_constructor_functions/test9.xsl
@@ -8,8 +8,8 @@
    
    <!-- use with test1_a.xml -->
    
-     <!-- this stylesheet, does few XPath arithmetic operations, 
-          involving xs:float type. -->              
+   <!-- This XSLT stylesheet, does few XPath arithmetic operations, 
+        involving xs:float typed values. -->              
 
    <xsl:output method="xml" indent="yes"/>
 
diff --git a/tests/xs_durationComponentExtraction/test1.xsl b/tests/xs_durationComponentExtraction/test1.xsl
index 2112a489..1ec38417 100644
--- a/tests/xs_durationComponentExtraction/test1.xsl
+++ b/tests/xs_durationComponentExtraction/test1.xsl
@@ -6,8 +6,10 @@
                 
    <!-- Author: mukulg@apache.org -->
    
-   <!-- This XSLT stylesheet, tests XPath 3.1 duration values,
-        component extraction functions. -->                 
+   <!-- This XSLT stylesheet, tests XPath 3.1 duration value
+        component extraction functions. The XPath function
+        invocation examples, as mentioned within this
+        stylesheet test are borrowed from XPath 3.1 spec. -->                 
 
    <xsl:output method="xml" indent="yes"/>
       


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