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/10/18 15:28:52 UTC

[xalan-java] branch xalan-j_xslt3.0 updated: committing xpath 3.1 implementation of xs:dateTime data type addition and subtraction operations, and few new working related 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 ef69a19a committing xpath 3.1 implementation of xs:dateTime data type addition and subtraction operations, and few new working related test cases as well.
     new 21684b00 Merge pull request #107 from mukulga/xalan-j_xslt3.0_mukul
ef69a19a is described below

commit ef69a19a9c447bb2b2a29aa16282c30e624f24bb
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Wed Oct 18 20:53:34 2023 +0530

    committing xpath 3.1 implementation of xs:dateTime data type addition and subtraction operations, and few new working related test cases as well.
---
 src/org/apache/xpath/operations/Minus.java         | 10 ++++
 src/org/apache/xpath/operations/Plus.java          | 10 ++++
 src/org/apache/xpath/xs/types/XSDate.java          | 56 +++++++++---------
 src/org/apache/xpath/xs/types/XSDateTime.java      | 68 ++++++++++++++++++++++
 .../xalan/xpath3/XsConstructorFunctionTests.java   | 20 +++++++
 tests/org/apache/xalan/xslt3/Xsl3TestSuite1.java   |  6 +-
 tests/org/apache/xalan/xslt3/Xsl3TestSuite2.java   |  6 +-
 tests/xs_constructor_functions/gold/test21.out     |  8 +++
 tests/xs_constructor_functions/gold/test22.out     |  8 +++
 tests/xs_constructor_functions/test21.xsl          | 55 +++++++++++++++++
 tests/xs_constructor_functions/test22.xsl          | 55 +++++++++++++++++
 11 files changed, 268 insertions(+), 34 deletions(-)

diff --git a/src/org/apache/xpath/operations/Minus.java b/src/org/apache/xpath/operations/Minus.java
index 243a23ea..432d2eed 100644
--- a/src/org/apache/xpath/operations/Minus.java
+++ b/src/org/apache/xpath/operations/Minus.java
@@ -27,6 +27,7 @@ import org.apache.xpath.objects.XNodeSet;
 import org.apache.xpath.objects.XNumber;
 import org.apache.xpath.objects.XObject;
 import org.apache.xpath.xs.types.XSDate;
+import org.apache.xpath.xs.types.XSDateTime;
 import org.apache.xpath.xs.types.XSNumericType;
 import org.apache.xpath.xs.types.XSYearMonthDuration;
 
@@ -252,6 +253,9 @@ public class Minus extends Operation
       else if (left instanceof XSDate) {
           result = ((XSDate)left).subtract(right);  
       }
+      else if (left instanceof XSDateTime) {
+          result = ((XSDateTime)left).subtract(right);  
+      }
       else if ((left instanceof ResultSequence) && (right instanceof ResultSequence)) {
           ResultSequence rsLeft = (ResultSequence)left;          
           if (rsLeft.size() > 1) {
@@ -273,6 +277,9 @@ public class Minus extends Operation
           if (lArg instanceof XSDate) {
               result = ((XSDate)lArg).subtract(rArg); 
           }
+          else if (lArg instanceof XSDateTime) {
+              result = ((XSDateTime)lArg).subtract(rArg); 
+          }
           else {
               java.lang.String lStr = XslTransformEvaluationHelper.getStrVal(lArg);
               double lDouble = (Double.valueOf(lStr)).doubleValue();
@@ -295,6 +302,9 @@ public class Minus extends Operation
           if (lArg instanceof XSDate) {
               result = ((XSDate)lArg).subtract(right); 
           }
+          else if (lArg instanceof XSDateTime) {
+              result = ((XSDateTime)lArg).subtract(right); 
+          }
       }
       else {          
           try {
diff --git a/src/org/apache/xpath/operations/Plus.java b/src/org/apache/xpath/operations/Plus.java
index 94cf4b8d..9093c9bb 100644
--- a/src/org/apache/xpath/operations/Plus.java
+++ b/src/org/apache/xpath/operations/Plus.java
@@ -27,6 +27,7 @@ import org.apache.xpath.objects.XNodeSet;
 import org.apache.xpath.objects.XNumber;
 import org.apache.xpath.objects.XObject;
 import org.apache.xpath.xs.types.XSDate;
+import org.apache.xpath.xs.types.XSDateTime;
 import org.apache.xpath.xs.types.XSNumericType;
 import org.apache.xpath.xs.types.XSUntyped;
 import org.apache.xpath.xs.types.XSUntypedAtomic;
@@ -285,6 +286,9 @@ public class Plus extends Operation
       else if (left instanceof XSDate) {
           result = ((XSDate)left).add(right);  
       }
+      else if (left instanceof XSDateTime) {
+          result = ((XSDateTime)left).add(right);  
+      }
       else if ((left instanceof ResultSequence) && (right instanceof ResultSequence)) {
           ResultSequence rsLeft = (ResultSequence)left;          
           if (rsLeft.size() > 1) {
@@ -306,6 +310,9 @@ public class Plus extends Operation
           if (lArg instanceof XSDate) {
              result = ((XSDate)lArg).add(rArg); 
           }
+          else if (lArg instanceof XSDateTime) {
+             result = ((XSDateTime)lArg).add(rArg); 
+          }
           else {
              java.lang.String lStr = XslTransformEvaluationHelper.getStrVal(rsLeft.item(0));
              double lDouble = (Double.valueOf(lStr)).doubleValue();
@@ -328,6 +335,9 @@ public class Plus extends Operation
           if (lArg instanceof XSDate) {
               result = ((XSDate)lArg).add(right); 
           }
+          else if (lArg instanceof XSDateTime) {
+              result = ((XSDateTime)lArg).add(right); 
+          }
       }
       else {
           try {
diff --git a/src/org/apache/xpath/xs/types/XSDate.java b/src/org/apache/xpath/xs/types/XSDate.java
index 8544a235..d0d3cc7e 100644
--- a/src/org/apache/xpath/xs/types/XSDate.java
+++ b/src/org/apache/xpath/xs/types/XSDate.java
@@ -329,38 +329,31 @@ public class XSDate extends XSCalendarType {
         
         return isDateAfter; 
     }
-    
+       
     /**
-    * Implementation of subtraction operation between this XSDate value, and a supplied value
-    * (as per XPath 3.1 spec, xs:date, xs:yearMonthDuration and xs:dayTimeDuration are the only
-    * permissible data type values, that may be subtracted from an xs:date value).
+    * Implementation of addition operation between this XSDate value, and a supplied value
+    * (as per XPath 3.1 spec, xs:yearMonthDuration and xs:dayTimeDuration are the only permissible 
+    * data type values, that may be added to an xs:date value).
     */
-    public XObject subtract(XObject xObject) throws TransformerException {
+    public XObject add(XObject xObject) throws TransformerException {
         XObject result = null;
         
-        if (!((xObject instanceof XSDate) || (xObject instanceof XSYearMonthDuration)
-                                          || (xObject instanceof XSDayTimeDuration))) {
-           throw new TransformerException("XPTY0004 : The values of types xs:date, xs:yearMonthDuration or "
-                                                                                 + "xs:dayTimeDuration are only ones that may be subtracted from an xs:date value.");
+        if (!((xObject instanceof XSYearMonthDuration) || (xObject instanceof XSDayTimeDuration))) {
+           throw new TransformerException("XPTY0004 : The values of types xs:yearMonthDuration or "
+                                                                               + "xs:dayTimeDuration are only ones that may be added to an xs:date value.");
         }
         
-        if (xObject instanceof XSDate) {
-           Calendar cal1 = getCalendar();
-           Calendar cal2 = ((XSDate)xObject).getCalendar();
-           long diffDurationMilliSecs = cal1.getTimeInMillis() - cal2.getTimeInMillis();
-           result = new XSDuration(diffDurationMilliSecs / 1000);
-        }
-        else if (xObject instanceof XSYearMonthDuration) {
+        if (xObject instanceof XSYearMonthDuration) {
            XSYearMonthDuration argVal = (XSYearMonthDuration)xObject;
            Calendar cal1 = (Calendar)((getCalendar()).clone());
-           cal1.add(Calendar.MONTH, argVal.monthValue() * -1);
+           cal1.add(Calendar.MONTH, argVal.monthValue());
            result = new XSDate(cal1, getTimezone());
         }
         else if (xObject instanceof XSDayTimeDuration) {
            XSDayTimeDuration argVal = (XSDayTimeDuration)xObject;
            double argValSecs = argVal.value();
            Calendar cal1 = (Calendar)((getCalendar()).clone());
-           cal1.setTimeInMillis(cal1.getTimeInMillis() + ((((long)argValSecs * 1000)) * -1));
+           cal1.setTimeInMillis(cal1.getTimeInMillis() + ((((long)argValSecs * 1000))));
            result = new XSDate(cal1, getTimezone());
         }
         
@@ -368,29 +361,36 @@ public class XSDate extends XSCalendarType {
     }
     
     /**
-    * Implementation of addition operation between this XSDate value, and a supplied value
-    * (as per XPath 3.1 spec, xs:yearMonthDuration and xs:dayTimeDuration are the only permissible 
-    * data type values, that may be added to an xs:date value).
+    * Implementation of subtraction operation between this XSDate value, and a supplied value
+    * (as per XPath 3.1 spec, xs:date, xs:yearMonthDuration and xs:dayTimeDuration are the only
+    * permissible data type values, that may be subtracted from an xs:date value).
     */
-    public XObject add(XObject xObject) throws TransformerException {
+    public XObject subtract(XObject xObject) throws TransformerException {
         XObject result = null;
         
-        if (!((xObject instanceof XSYearMonthDuration) || (xObject instanceof XSDayTimeDuration))) {
-           throw new TransformerException("XPTY0004 : The values of types xs:yearMonthDuration or "
-                                                                               + "xs:dayTimeDuration are only ones that may be added to an xs:date value.");
+        if (!((xObject instanceof XSDate) || (xObject instanceof XSYearMonthDuration)
+                                          || (xObject instanceof XSDayTimeDuration))) {
+           throw new TransformerException("XPTY0004 : The values of types xs:date, xs:yearMonthDuration or "
+                                                                                 + "xs:dayTimeDuration are only ones that may be subtracted from an xs:date value.");
         }
         
-        if (xObject instanceof XSYearMonthDuration) {
+        if (xObject instanceof XSDate) {
+           Calendar cal1 = getCalendar();
+           Calendar cal2 = ((XSDate)xObject).getCalendar();
+           long diffDurationMilliSecs = cal1.getTimeInMillis() - cal2.getTimeInMillis();
+           result = new XSDuration(diffDurationMilliSecs / 1000);
+        }
+        else if (xObject instanceof XSYearMonthDuration) {
            XSYearMonthDuration argVal = (XSYearMonthDuration)xObject;
            Calendar cal1 = (Calendar)((getCalendar()).clone());
-           cal1.add(Calendar.MONTH, argVal.monthValue());
+           cal1.add(Calendar.MONTH, argVal.monthValue() * -1);
            result = new XSDate(cal1, getTimezone());
         }
         else if (xObject instanceof XSDayTimeDuration) {
            XSDayTimeDuration argVal = (XSDayTimeDuration)xObject;
            double argValSecs = argVal.value();
            Calendar cal1 = (Calendar)((getCalendar()).clone());
-           cal1.setTimeInMillis(cal1.getTimeInMillis() + ((((long)argValSecs * 1000))));
+           cal1.setTimeInMillis(cal1.getTimeInMillis() + ((((long)argValSecs * 1000)) * -1));
            result = new XSDate(cal1, getTimezone());
         }
         
diff --git a/src/org/apache/xpath/xs/types/XSDateTime.java b/src/org/apache/xpath/xs/types/XSDateTime.java
index 0ceac968..625817bd 100644
--- a/src/org/apache/xpath/xs/types/XSDateTime.java
+++ b/src/org/apache/xpath/xs/types/XSDateTime.java
@@ -27,6 +27,7 @@ import java.util.TimeZone;
 import javax.xml.transform.TransformerException;
 
 import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XObject;
 
 /**
  * An XML Schema data type representation, of the xs:dateTime 
@@ -803,6 +804,73 @@ public class XSDateTime extends XSCalendarType {
         return isDateTimeAfter;
     }
     
+    /**
+    * Implementation of addition operation between this XSDateTime value, and a supplied value
+    * (as per XPath 3.1 spec, xs:yearMonthDuration and xs:dayTimeDuration are the only permissible 
+    * data type values, that may be added to an xs:dateTime value).
+    */
+    public XObject add(XObject xObject) throws TransformerException {
+        XObject result = null;
+        
+        if (!((xObject instanceof XSYearMonthDuration) || (xObject instanceof XSDayTimeDuration))) {
+           throw new TransformerException("XPTY0004 : The values of types xs:yearMonthDuration or "
+                                                                               + "xs:dayTimeDuration are only ones that may be added to an xs:dateTime value.");
+        }
+        
+        if (xObject instanceof XSYearMonthDuration) {
+           XSYearMonthDuration argVal = (XSYearMonthDuration)xObject;
+           Calendar cal1 = (Calendar)((getCalendar()).clone());
+           cal1.add(Calendar.MONTH, argVal.monthValue());
+           result = new XSDateTime(cal1, getTimezone());
+        }
+        else if (xObject instanceof XSDayTimeDuration) {
+           XSDayTimeDuration argVal = (XSDayTimeDuration)xObject;
+           double argValSecs = argVal.value();
+           Calendar cal1 = (Calendar)((getCalendar()).clone());
+           cal1.setTimeInMillis(cal1.getTimeInMillis() + ((((long)argValSecs * 1000))));
+           result = new XSDateTime(cal1, getTimezone());
+        }
+        
+        return result;
+    }
+    
+    /**
+     * Implementation of subtraction operation between this XSDateTime value, and a supplied value
+     * (as per XPath 3.1 spec, xs:dateTime, xs:yearMonthDuration and xs:dayTimeDuration are the only
+     * permissible data type values, that may be subtracted from an xs:dateTime value).
+     */
+     public XObject subtract(XObject xObject) throws TransformerException {
+         XObject result = null;
+         
+         if (!((xObject instanceof XSDateTime) || (xObject instanceof XSYearMonthDuration)
+                                               || (xObject instanceof XSDayTimeDuration))) {
+            throw new TransformerException("XPTY0004 : The values of types xs:dateTime, xs:yearMonthDuration or "
+                                                                                  + "xs:dayTimeDuration are only ones that may be subtracted from an xs:dateTime value.");
+         }
+         
+         if (xObject instanceof XSDateTime) {
+            Calendar cal1 = getCalendar();
+            Calendar cal2 = ((XSDateTime)xObject).getCalendar();
+            long diffDurationMilliSecs = cal1.getTimeInMillis() - cal2.getTimeInMillis();
+            result = new XSDayTimeDuration(diffDurationMilliSecs / 1000);
+         }
+         else if (xObject instanceof XSYearMonthDuration) {
+            XSYearMonthDuration argVal = (XSYearMonthDuration)xObject;
+            Calendar cal1 = (Calendar)((getCalendar()).clone());
+            cal1.add(Calendar.MONTH, argVal.monthValue() * -1);
+            result = new XSDateTime(cal1, getTimezone());
+         }
+         else if (xObject instanceof XSDayTimeDuration) {
+            XSDayTimeDuration argVal = (XSDayTimeDuration)xObject;
+            double argValSecs = argVal.value();
+            Calendar cal1 = (Calendar)((getCalendar()).clone());
+            cal1.setTimeInMillis(cal1.getTimeInMillis() + ((((long)argValSecs * 1000)) * -1));
+            result = new XSDateTime(cal1, getTimezone());
+         }
+         
+         return result;
+    }
+    
     public boolean isPopulatedFromFnCurrentDateTime() {
         return isPopulatedFromFnCurrentDateTime;
     }
diff --git a/tests/org/apache/xalan/xpath3/XsConstructorFunctionTests.java b/tests/org/apache/xalan/xpath3/XsConstructorFunctionTests.java
index a6a85db4..18605ad5 100644
--- a/tests/org/apache/xalan/xpath3/XsConstructorFunctionTests.java
+++ b/tests/org/apache/xalan/xpath3/XsConstructorFunctionTests.java
@@ -247,5 +247,25 @@ public class XsConstructorFunctionTests extends XslTransformTestsUtil {
         
         runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
     }
+    
+    @Test
+    public void XsConstructorFunctionsTest21() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test21.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test21.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test21.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void XsConstructorFunctionsTest22() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test22.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test22.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test22.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
 
 }
diff --git a/tests/org/apache/xalan/xslt3/Xsl3TestSuite1.java b/tests/org/apache/xalan/xslt3/Xsl3TestSuite1.java
index 6d037382..5a25540f 100644
--- a/tests/org/apache/xalan/xslt3/Xsl3TestSuite1.java
+++ b/tests/org/apache/xalan/xslt3/Xsl3TestSuite1.java
@@ -16,11 +16,14 @@
  */
 package org.apache.xalan.xslt3;
 
+import org.apache.xalan.xpath3.FnAbsTests;
 import org.apache.xalan.xpath3.FnDataTests;
 import org.apache.xalan.xpath3.FnDocTests;
 import org.apache.xalan.xpath3.FnForEachTests;
 import org.apache.xalan.xpath3.InlineFunctionItemExprTests;
+import org.apache.xalan.xpath3.StringTests;
 import org.apache.xalan.xpath3.ValueComparisonTests;
+import org.apache.xalan.xpath3.XsConstructorFunctionTests;
 import org.apache.xalan.xpath3.XsDateTimeTests;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
@@ -37,7 +40,8 @@ import org.junit.runners.Suite.SuiteClasses;
 @SuiteClasses({ FnDocTests.class, FnDataTests.class, RecursiveFunctionTests.class,
                 XslFunctionTests.class, HigherOrderFunctionTests.class, XsDateTimeTests.class,
                 ValueComparisonTests.class, InlineFunctionItemExprTests.class, 
-                FnForEachTests.class })
+                FnForEachTests.class, XsConstructorFunctionTests.class,
+                FnAbsTests.class, StringTests.class })
 public class Xsl3TestSuite1 {
 
 }
diff --git a/tests/org/apache/xalan/xslt3/Xsl3TestSuite2.java b/tests/org/apache/xalan/xslt3/Xsl3TestSuite2.java
index 093f8ec9..b2634d46 100644
--- a/tests/org/apache/xalan/xslt3/Xsl3TestSuite2.java
+++ b/tests/org/apache/xalan/xslt3/Xsl3TestSuite2.java
@@ -18,7 +18,6 @@ package org.apache.xalan.xslt3;
 
 import org.apache.xalan.xpath3.BuiltinFunctionsNamespceTests;
 import org.apache.xalan.xpath3.DynamicFunctionCallTests;
-import org.apache.xalan.xpath3.FnAbsTests;
 import org.apache.xalan.xpath3.FnAvgTests;
 import org.apache.xalan.xpath3.FnCodepointEqualTests;
 import org.apache.xalan.xpath3.FnCodepointsToStringTests;
@@ -52,10 +51,8 @@ import org.apache.xalan.xpath3.SequenceFunctionTests;
 import org.apache.xalan.xpath3.SequenceTests;
 import org.apache.xalan.xpath3.SimpleMapOperatorTests;
 import org.apache.xalan.xpath3.StringConcatExprTests;
-import org.apache.xalan.xpath3.StringTests;
 import org.apache.xalan.xpath3.TrignometricAndExponentialFunctionTests;
 import org.apache.xalan.xpath3.XPathArithmeticOnDurationValuesTests;
-import org.apache.xalan.xpath3.XsConstructorFunctionTests;
 import org.apache.xalan.xpath3.XsDurationComponentExtractionFunctionTests;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
@@ -71,8 +68,7 @@ import org.junit.runners.Suite.SuiteClasses;
 @RunWith(Suite.class)
 @SuiteClasses({ AnalyzeStringTests.class, AttributeTests.class, GroupingTests.class,
                 GroupingWithSortTests.class, RtfMigrationTests.class, QuantifiedExprTests.class, 
-                FnUnparsedTextTests.class, FnTokenizeTests.class, FnStringJoinTests.class,
-                FnAbsTests.class, StringTests.class, XsConstructorFunctionTests.class, 
+                FnUnparsedTextTests.class, FnTokenizeTests.class, FnStringJoinTests.class,                 
                 FnIndexOfTests.class, SequenceTests.class, RangeExprTests.class, 
                 W3c_xslt30_IterateTests.class, W3c_xslt30_AxesTests.class, XslIterateTests.class,                 
                 FnFilterTests.class, DynamicFunctionCallTests.class, IfExprTests.class, 
diff --git a/tests/xs_constructor_functions/gold/test21.out b/tests/xs_constructor_functions/gold/test21.out
new file mode 100644
index 00000000..184f3001
--- /dev/null
+++ b/tests/xs_constructor_functions/gold/test21.out
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>2007-12-05T10:00:00</one>
+  <two>2011-03-05T10:00:00</two>
+  <three>2011-03-05T10:00:00+06:00</three>
+  <four>2008-03-05T10:00:00</four>
+  <five>2007-10-06T01:00:00</five>
+  <six>2007-10-10T10:00:00</six>
+</result>
diff --git a/tests/xs_constructor_functions/gold/test22.out b/tests/xs_constructor_functions/gold/test22.out
new file mode 100644
index 00000000..2eb8d801
--- /dev/null
+++ b/tests/xs_constructor_functions/gold/test22.out
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>PT0S</one>
+  <two>P94D</two>
+  <three>P365D</three>
+  <four>2006-04-05T10:00:00</four>
+  <five>2007-09-25T10:00:00</five>
+  <six>2007-09-25T10:00:00+06:00</six>
+</result>
diff --git a/tests/xs_constructor_functions/test21.xsl b/tests/xs_constructor_functions/test21.xsl
new file mode 100644
index 00000000..2e120f77
--- /dev/null
+++ b/tests/xs_constructor_functions/test21.xsl
@@ -0,0 +1,55 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                exclude-result-prefixes="xs"
+                version="3.0">
+                
+  <!-- Author: mukulg@apache.org -->
+  
+  <!-- An XSLT stylesheet test case, to test XPath
+       xs:dateTime data type arithmetic.
+  -->                
+                
+  <xsl:output method="xml" indent="yes"/>
+  
+  <xsl:template match="/">     
+     <result>
+        <one>
+           <xsl:value-of select="xs:dateTime('2007-10-05T10:00:00') + xs:yearMonthDuration('P2M')"/>
+        </one>
+        <two>
+           <xsl:value-of select="xs:dateTime('2007-10-05T10:00:00') + xs:yearMonthDuration('P3Y5M')"/>
+        </two>
+        <three>
+           <xsl:value-of select="xs:dateTime('2007-10-05T10:00:00+06:00') + xs:yearMonthDuration('P3Y5M')"/>
+        </three>
+        <four>
+           <xsl:value-of select="xs:dateTime('2007-10-05T10:00:00') + xs:yearMonthDuration('P5M')"/>
+        </four>
+        <five>
+           <xsl:value-of select="xs:dateTime('2007-10-05T10:00:00') + xs:dayTimeDuration('PT15H')"/>
+        </five>
+        <six>
+           <xsl:value-of select="xs:dateTime('2007-10-05T10:00:00') + xs:dayTimeDuration('P5D')"/>
+        </six>
+     </result>
+  </xsl:template>
+  
+  <!--
+      * Licensed to the Apache Software Foundation (ASF) under one
+      * or more contributor license agreements. See the NOTICE file
+      * distributed with this work for additional information
+      * regarding copyright ownership. The ASF licenses this file
+      * to you under the Apache License, Version 2.0 (the  "License");
+      * you may not use this file except in compliance with the License.
+      * You may obtain a copy of the License at
+      *
+      *     http://www.apache.org/licenses/LICENSE-2.0
+      *
+      * Unless required by applicable law or agreed to in writing, software
+      * distributed under the License is distributed on an "AS IS" BASIS,
+      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      * See the License for the specific language governing permissions and
+      * limitations under the License.
+  -->
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/tests/xs_constructor_functions/test22.xsl b/tests/xs_constructor_functions/test22.xsl
new file mode 100644
index 00000000..eec46e12
--- /dev/null
+++ b/tests/xs_constructor_functions/test22.xsl
@@ -0,0 +1,55 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                exclude-result-prefixes="xs"
+                version="3.0">
+                
+  <!-- Author: mukulg@apache.org -->
+  
+  <!-- An XSLT stylesheet test case, to test XPath
+       xs:dateTime data type arithmetic.
+  -->                 
+                
+  <xsl:output method="xml" indent="yes"/>
+  
+  <xsl:template match="/">     
+     <result>
+        <one>
+           <xsl:value-of select="xs:dateTime('2007-10-05T10:00:00') - xs:dateTime('2007-10-05T10:00:00')"/>
+        </one>
+        <two>
+           <xsl:value-of select="xs:dateTime('2007-10-05T10:00:00') - xs:dateTime('2007-07-03T10:00:00')"/>
+        </two>
+        <three>
+           <xsl:value-of select="xs:dateTime('2007-10-05T10:00:00') - xs:dateTime('2006-10-05T10:00:00')"/>
+        </three>
+        <four>
+           <xsl:value-of select="xs:dateTime('2007-10-05T10:00:00') - xs:yearMonthDuration('P1Y6M')"/>
+        </four>
+        <five>
+           <xsl:value-of select="xs:dateTime('2007-10-05T10:00:00') - xs:dayTimeDuration('P10D')"/>
+        </five>
+        <six>
+           <xsl:value-of select="xs:dateTime('2007-10-05T10:00:00+06:00') - xs:dayTimeDuration('P10D')"/>
+        </six>
+     </result>
+  </xsl:template>
+  
+  <!--
+      * Licensed to the Apache Software Foundation (ASF) under one
+      * or more contributor license agreements. See the NOTICE file
+      * distributed with this work for additional information
+      * regarding copyright ownership. The ASF licenses this file
+      * to you under the Apache License, Version 2.0 (the  "License");
+      * you may not use this file except in compliance with the License.
+      * You may obtain a copy of the License at
+      *
+      *     http://www.apache.org/licenses/LICENSE-2.0
+      *
+      * Unless required by applicable law or agreed to in writing, software
+      * distributed under the License is distributed on an "AS IS" BASIS,
+      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      * See the License for the specific language governing permissions and
+      * limitations under the License.
+  -->
+
+</xsl:stylesheet>
\ No newline at end of file


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