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/12/07 01:47:00 UTC

(xalan-java) branch xalan-j_xslt3.0 updated: committing improvements to, assignment of values of schema types xs:duration and its subtypes, along with 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 24cf2417 committing improvements to, assignment of values of schema types xs:duration and its subtypes, along with few new working related test cases as well
     new 7a5742f0 Merge pull request #139 from mukulga/xalan-j_xslt3.0_mukul
24cf2417 is described below

commit 24cf24178905a072d6c31b1da007bb79ed8adf9f
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Thu Dec 7 07:12:10 2023 +0530

    committing improvements to, assignment of values of schema types xs:duration and its subtypes, along with few new working related test cases as well
---
 src/org/apache/xalan/templates/ElemVariable.java   |   8 +-
 .../xpath/composite/SequenceTypeSupport.java       |  26 ++--
 .../apache/xalan/xpath3/XsDurationSubtypes.java    | 142 +++++++++++++++++++++
 tests/org/apache/xalan/xslt3/Xsl3TestSuite1.java   |   3 +-
 tests/xs_duration_subtypes/gold/test1.out          |   4 +
 tests/xs_duration_subtypes/gold/test2.out          |   0
 tests/xs_duration_subtypes/gold/test3.out          |   4 +
 tests/xs_duration_subtypes/gold/test4.out          |   0
 tests/xs_duration_subtypes/gold/test5.out          |   0
 tests/xs_duration_subtypes/gold/test6.out          |   4 +
 tests/xs_duration_subtypes/gold/test7.out          |   0
 tests/xs_duration_subtypes/gold/test8.out          |   4 +
 tests/xs_duration_subtypes/gold/test9.out          |   0
 tests/xs_duration_subtypes/test1.xsl               |  50 ++++++++
 tests/xs_duration_subtypes/test1_a.xml             |   2 +
 tests/xs_duration_subtypes/test2.xsl               |  42 ++++++
 tests/xs_duration_subtypes/test3.xsl               |  59 +++++++++
 tests/xs_duration_subtypes/test4.xsl               |  59 +++++++++
 tests/xs_duration_subtypes/test5.xsl               |  59 +++++++++
 tests/xs_duration_subtypes/test6.xsl               |  57 +++++++++
 tests/xs_duration_subtypes/test7.xsl               |  57 +++++++++
 tests/xs_duration_subtypes/test8.xsl               |  55 ++++++++
 tests/xs_duration_subtypes/test9.xsl               |  55 ++++++++
 23 files changed, 675 insertions(+), 15 deletions(-)

diff --git a/src/org/apache/xalan/templates/ElemVariable.java b/src/org/apache/xalan/templates/ElemVariable.java
index 75d3940f..6de66016 100644
--- a/src/org/apache/xalan/templates/ElemVariable.java
+++ b/src/org/apache/xalan/templates/ElemVariable.java
@@ -332,12 +332,18 @@ public class ElemVariable extends ElemTemplateElement
     try {        
       if (m_selectPattern != null) {          
         selectExpression = m_selectPattern.getExpression();
+        
         if (selectExpression instanceof FuncExtFunction) {
             XObject evalResult = XSConstructorFunctionUtil.processFuncExtFunctionOrXPathOpn(xctxt, 
                                                                                       selectExpression, transformer);
             if (evalResult != null) {
                 if (m_asAttr != null) {
-                   evalResult = SequenceTypeSupport.convertXDMValueToAnotherType(evalResult, m_asAttr, null, xctxt);  
+                   evalResult = SequenceTypeSupport.convertXDMValueToAnotherType(evalResult, m_asAttr, null, xctxt);
+                   if (evalResult == null) {
+                	  String xpathPatternStr = m_selectPattern.getPatternString();
+                	  throw new TransformerException("XTTE0570 : The supplied value " + xpathPatternStr + ", doesn't "
+                	  		                                       + "match the expected sequence type " + m_asAttr + ".", srcLocator); 
+                   }
                 }
                 
                 return evalResult;    
diff --git a/src/org/apache/xpath/composite/SequenceTypeSupport.java b/src/org/apache/xpath/composite/SequenceTypeSupport.java
index 0cd6fb4a..e2c65a64 100644
--- a/src/org/apache/xpath/composite/SequenceTypeSupport.java
+++ b/src/org/apache/xpath/composite/SequenceTypeSupport.java
@@ -364,20 +364,10 @@ public class SequenceTypeSupport {
                   result = performXdmItemTypeNormalizationOnAtomicType(sequenceTypeKindTest, srcValue, srcStrVal, 
                                                                                                    "xs:time", sequenceTypeXPathExprStr);
                }
-            }
-            else if (srcValue instanceof XSDuration) {
-               String srcStrVal = ((XSDuration)srcValue).stringValue();
-               if (expectedType == XS_DURATION) {
-                  result = srcValue; 
-               }
-               else if (sequenceTypeKindTest != null) {
-                  result = performXdmItemTypeNormalizationOnAtomicType(sequenceTypeKindTest, srcValue, srcStrVal, 
-                                                                                                   "xs:duration", sequenceTypeXPathExprStr);
-               } 
-            }
+            }            
             else if (srcValue instanceof XSDayTimeDuration) {
                String srcStrVal = ((XSDayTimeDuration)srcValue).stringValue();     
-               if (expectedType == XS_DAYTIME_DURATION) {
+               if ((expectedType == XS_DAYTIME_DURATION) || (expectedType == XS_DURATION)) {
                   result = srcValue; 
                }
                else if (sequenceTypeKindTest != null) {
@@ -387,7 +377,7 @@ public class SequenceTypeSupport {
             }
             else if (srcValue instanceof XSYearMonthDuration) {
                String srcStrVal = ((XSYearMonthDuration)srcValue).stringValue();      
-               if (expectedType == XS_YEARMONTH_DURATION) {
+               if ((expectedType == XS_YEARMONTH_DURATION) || (expectedType == XS_DURATION)) {
                   result = srcValue; 
                }
                else if (sequenceTypeKindTest != null) {
@@ -395,6 +385,16 @@ public class SequenceTypeSupport {
                                                                                                    "xs:yearMonthDuration", sequenceTypeXPathExprStr);
                } 
             }
+            else if (srcValue instanceof XSDuration) {
+               String srcStrVal = ((XSDuration)srcValue).stringValue();
+               if (expectedType == XS_DURATION) {
+                  result = srcValue; 
+               }
+               else if (sequenceTypeKindTest != null) {
+                  result = performXdmItemTypeNormalizationOnAtomicType(sequenceTypeKindTest, srcValue, srcStrVal, 
+                                                                                                   "xs:duration", sequenceTypeXPathExprStr);
+               } 
+            }
             else if (srcValue instanceof XSUntyped) {
                String srcStrVal = ((XSUntyped)srcValue).stringValue();
                // Recursive call to this function
diff --git a/tests/org/apache/xalan/xpath3/XsDurationSubtypes.java b/tests/org/apache/xalan/xpath3/XsDurationSubtypes.java
new file mode 100644
index 00000000..175e58c0
--- /dev/null
+++ b/tests/org/apache/xalan/xpath3/XsDurationSubtypes.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.xalan.xpath3;
+
+import org.apache.xalan.util.XslTestsErrorHandler;
+import org.apache.xalan.util.XslTransformTestsUtil;
+import org.apache.xalan.xslt3.XSLConstants;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * XSLT stylesheet test cases, to test assignment of schema type
+ * xs:duration values and its subtypes.
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class XsDurationSubtypes extends XslTransformTestsUtil {        
+    
+    private static final String XSL_TRANSFORM_INPUT_DIRPATH = XSLConstants.XSL_TRANSFORM_INPUT_DIRPATH_PREFIX + "xs_duration_subtypes/";
+    
+    private static final String XSL_TRANSFORM_GOLD_DIRPATH = XSLConstants.XSL_TRANSFORM_GOLD_DIRPATH_PREFIX + "xs_duration_subtypes/gold/";
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+        // no op
+    }
+
+    @AfterClass
+    public static void tearDownAfterClass() throws Exception {        
+        xmlDocumentBuilderFactory = null;
+        xmlDocumentBuilder = null;
+        xslTransformerFactory = null;
+    }
+
+    @Test
+    public void XsDurationSubtypesTest1() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test1.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void XsDurationSubtypesTest2() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test2.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test2.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test2.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, new XslTestsErrorHandler());
+    }
+    
+    @Test
+    public void XsDurationSubtypesTest3() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_a.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test3.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void XsDurationSubtypesTest4() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_a.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test4.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test4.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, new XslTestsErrorHandler());
+    }
+    
+    @Test
+    public void XsDurationSubtypesTest5() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_a.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test5.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test5.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, new XslTestsErrorHandler());
+    }
+    
+    @Test
+    public void XsDurationSubtypesTest6() {
+        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 XsDurationSubtypesTest7() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test7.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test7.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test7.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, new XslTestsErrorHandler());
+    }
+    
+    @Test
+    public void XsDurationSubtypesTest8() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test8.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test8.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test8.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void XsDurationSubtypesTest9() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test9.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test9.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test9.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, new XslTestsErrorHandler());
+    }
+
+}
diff --git a/tests/org/apache/xalan/xslt3/Xsl3TestSuite1.java b/tests/org/apache/xalan/xslt3/Xsl3TestSuite1.java
index 27517705..57ac2338 100644
--- a/tests/org/apache/xalan/xslt3/Xsl3TestSuite1.java
+++ b/tests/org/apache/xalan/xslt3/Xsl3TestSuite1.java
@@ -26,6 +26,7 @@ import org.apache.xalan.xpath3.ValueComparisonTests;
 import org.apache.xalan.xpath3.XsConstructorFunctionTests;
 import org.apache.xalan.xpath3.XsDateTimeArithmeticTests;
 import org.apache.xalan.xpath3.XsDateTimeTests;
+import org.apache.xalan.xpath3.XsDurationSubtypes;
 import org.apache.xalan.xpath3.XsTimeWithArithmeticTests;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
@@ -44,7 +45,7 @@ import org.junit.runners.Suite.SuiteClasses;
                 ValueComparisonTests.class, InlineFunctionItemExprTests.class, 
                 FnForEachTests.class, XsConstructorFunctionTests.class,
                 FnAbsTests.class, StringTests.class, XsDateTimeArithmeticTests.class,
-                XsTimeWithArithmeticTests.class })
+                XsTimeWithArithmeticTests.class, XsDurationSubtypes.class })
 public class Xsl3TestSuite1 {
 
 }
diff --git a/tests/xs_duration_subtypes/gold/test1.out b/tests/xs_duration_subtypes/gold/test1.out
new file mode 100644
index 00000000..db612813
--- /dev/null
+++ b/tests/xs_duration_subtypes/gold/test1.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>P1DT16H</one>
+  <two>P1Y3M</two>
+</result>
diff --git a/tests/xs_duration_subtypes/gold/test2.out b/tests/xs_duration_subtypes/gold/test2.out
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/xs_duration_subtypes/gold/test3.out b/tests/xs_duration_subtypes/gold/test3.out
new file mode 100644
index 00000000..db612813
--- /dev/null
+++ b/tests/xs_duration_subtypes/gold/test3.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>P1DT16H</one>
+  <two>P1Y3M</two>
+</result>
diff --git a/tests/xs_duration_subtypes/gold/test4.out b/tests/xs_duration_subtypes/gold/test4.out
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/xs_duration_subtypes/gold/test5.out b/tests/xs_duration_subtypes/gold/test5.out
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/xs_duration_subtypes/gold/test6.out b/tests/xs_duration_subtypes/gold/test6.out
new file mode 100644
index 00000000..db612813
--- /dev/null
+++ b/tests/xs_duration_subtypes/gold/test6.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>P1DT16H</one>
+  <two>P1Y3M</two>
+</result>
diff --git a/tests/xs_duration_subtypes/gold/test7.out b/tests/xs_duration_subtypes/gold/test7.out
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/xs_duration_subtypes/gold/test8.out b/tests/xs_duration_subtypes/gold/test8.out
new file mode 100644
index 00000000..db612813
--- /dev/null
+++ b/tests/xs_duration_subtypes/gold/test8.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <one>P1DT16H</one>
+  <two>P1Y3M</two>
+</result>
diff --git a/tests/xs_duration_subtypes/gold/test9.out b/tests/xs_duration_subtypes/gold/test9.out
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/xs_duration_subtypes/test1.xsl b/tests/xs_duration_subtypes/test1.xsl
new file mode 100644
index 00000000..32a420a2
--- /dev/null
+++ b/tests/xs_duration_subtypes/test1.xsl
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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 3.1 sequence type 
+         expressions,
+         1) Where a value of schema type xs:dayTimeDuration is legitemately assigned 
+            to the type xs:duration.  
+         2) Where a value of schema type xs:yearMonthDuration is legitemately assigned 
+            to the type xs:duration.
+    -->                
+
+    <xsl:output method="xml" indent="yes"/>
+
+    <xsl:template match="/"> 
+      <result>
+        <xsl:variable name="dtdVal1" select="xs:dayTimeDuration('PT40H')" as="xs:duration"/>
+        <xsl:variable name="ymdVal1" select="xs:yearMonthDuration('P1Y3M')" as="xs:duration"/>
+        <one>
+           <xsl:copy-of select="$dtdVal1"/>
+        </one>
+        <two>
+	       <xsl:copy-of select="$ymdVal1"/>        
+        </two>
+      </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_duration_subtypes/test1_a.xml b/tests/xs_duration_subtypes/test1_a.xml
new file mode 100644
index 00000000..f1393460
--- /dev/null
+++ b/tests/xs_duration_subtypes/test1_a.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<info/>
diff --git a/tests/xs_duration_subtypes/test2.xsl b/tests/xs_duration_subtypes/test2.xsl
new file mode 100644
index 00000000..2dda855d
--- /dev/null
+++ b/tests/xs_duration_subtypes/test2.xsl
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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 3.1 sequence type 
+         expressions,
+         Where a value of schema type xs:duration is tried to be 
+         ill-legitemately assigned to the type xs:xs:dayTimeDuration.
+     -->                 
+
+    <xsl:output method="xml" indent="yes"/>
+
+    <xsl:template match="/"> 
+      <result>
+        <xsl:variable name="dtdVal1" select="xs:duration('PT40H')" as="xs:dayTimeDuration"/>
+        <xsl:copy-of select="$dtdVal1"/>
+      </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_duration_subtypes/test3.xsl b/tests/xs_duration_subtypes/test3.xsl
new file mode 100644
index 00000000..779e1f62
--- /dev/null
+++ b/tests/xs_duration_subtypes/test3.xsl
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                exclude-result-prefixes="xs"
+                version="3.0">
+                
+    <!-- Author: mukulg@apache.org -->
+    
+    <!-- use with test1_a.xml -->
+    
+    <!-- An XSLT stylesheet test case, to test XPath 3.1 sequence type 
+         expressions,
+         1) Where a value of schema type xs:dayTimeDuration is legitemately assigned 
+            to the type xs:duration.  
+         2) Where a value of schema type xs:yearMonthDuration is legitemately assigned 
+            to the type xs:duration.
+    -->                   
+
+    <xsl:output method="xml" indent="yes"/>
+
+    <xsl:template match="/"> 
+      <result>
+         <xsl:apply-templates select="info">
+            <xsl:with-param name="dtdVal1" select="xs:dayTimeDuration('PT40H')" as="xs:duration"/>
+            <xsl:with-param name="ymdVal1" select="xs:yearMonthDuration('P1Y3M')" as="xs:duration"/>
+         </xsl:apply-templates>
+      </result>
+    </xsl:template>
+    
+    <xsl:template match="info">
+       <xsl:param name="dtdVal1" as="xs:duration"/>
+       <xsl:param name="ymdVal1" as="xs:duration"/>
+       <one>
+          <xsl:copy-of select="$dtdVal1"/>
+       </one>
+       <two>
+          <xsl:copy-of select="$ymdVal1"/>
+       </two>
+    </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_duration_subtypes/test4.xsl b/tests/xs_duration_subtypes/test4.xsl
new file mode 100644
index 00000000..53e97925
--- /dev/null
+++ b/tests/xs_duration_subtypes/test4.xsl
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                exclude-result-prefixes="xs"
+                version="3.0">
+                
+    <!-- Author: mukulg@apache.org -->
+    
+    <!-- use with test1_a.xml -->
+    
+    <!-- An XSLT stylesheet test case, to test XPath 3.1 sequence type 
+         expressions,
+         1) Where a value of schema type xs:duration is tried to be 
+            ill-legitemately assigned to the type xs:dayTimeDuration.
+         2) Where a value of schema type xs:duration is tried to be 
+            ill-legitemately assigned to the type xs:yearMonthDuration.
+     -->                
+
+    <xsl:output method="xml" indent="yes"/>
+
+    <xsl:template match="/"> 
+      <result>
+        <xsl:apply-templates select="info">
+           <xsl:with-param name="dtdVal1" select="xs:duration('PT40H')" as="xs:dayTimeDuration"/>
+           <xsl:with-param name="ymdVal1" select="xs:duration('P1Y3M')" as="xs:yearMonthDuration"/>
+        </xsl:apply-templates>
+      </result>
+    </xsl:template>
+    
+    <xsl:template match="info">
+       <xsl:param name="dtdVal1" as="xs:dayTimeDuration"/>
+       <xsl:param name="ymdVal1" as="xs:yearMonthDuration"/>
+       <one>
+          <xsl:copy-of select="$dtdVal1"/>
+       </one>
+       <two>
+          <xsl:copy-of select="$ymdVal1"/>
+       </two>
+    </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_duration_subtypes/test5.xsl b/tests/xs_duration_subtypes/test5.xsl
new file mode 100644
index 00000000..f5b48652
--- /dev/null
+++ b/tests/xs_duration_subtypes/test5.xsl
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                exclude-result-prefixes="xs"
+                version="3.0">
+                
+    <!-- Author: mukulg@apache.org -->
+    
+    <!-- use with test1_a.xml -->
+    
+    <!-- An XSLT stylesheet test case, to test XPath 3.1 sequence type 
+         expressions,
+         1) Where a value of schema type xs:duration is tried to be 
+            ill-legitemately assigned to the type xs:dayTimeDuration.
+         2) Where a value of schema type xs:duration is tried to be 
+            ill-legitemately assigned to the type xs:yearMonthDuration.
+     -->                
+
+    <xsl:output method="xml" indent="yes"/>
+
+    <xsl:template match="/"> 
+      <result>
+         <xsl:apply-templates select="info">
+            <xsl:with-param name="dtdVal1" select="xs:duration('PT40H')"/>
+            <xsl:with-param name="ymdVal1" select="xs:duration('P1Y3M')"/>
+         </xsl:apply-templates>
+      </result>
+    </xsl:template>
+    
+    <xsl:template match="info">
+       <xsl:param name="dtdVal1" as="xs:dayTimeDuration"/>
+       <xsl:param name="ymdVal1" as="xs:yearMonthDuration"/>
+       <one>
+          <xsl:copy-of select="$dtdVal1"/>
+       </one>
+       <two>
+          <xsl:copy-of select="$ymdVal1"/>
+       </two>
+    </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_duration_subtypes/test6.xsl b/tests/xs_duration_subtypes/test6.xsl
new file mode 100644
index 00000000..34a166fa
--- /dev/null
+++ b/tests/xs_duration_subtypes/test6.xsl
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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 3.1 sequence type 
+         expressions,
+         1) Where a value of schema type xs:dayTimeDuration is legitemately assigned 
+            to the type xs:duration.  
+         2) Where a value of schema type xs:yearMonthDuration is legitemately assigned 
+            to the type xs:duration.
+    -->                
+
+    <xsl:output method="xml" indent="yes"/>
+
+    <xsl:template match="/"> 
+      <result>
+         <xsl:call-template name="process1">
+            <xsl:with-param name="dtdVal1" select="xs:dayTimeDuration('PT40H')" as="xs:duration"/>
+            <xsl:with-param name="ymdVal1" select="xs:yearMonthDuration('P1Y3M')" as="xs:duration"/>
+         </xsl:call-template>
+      </result>
+    </xsl:template>
+    
+    <xsl:template name="process1">
+       <xsl:param name="dtdVal1" as="xs:duration"/>
+       <xsl:param name="ymdVal1" as="xs:duration"/>
+       <one>
+          <xsl:copy-of select="$dtdVal1"/>
+       </one>
+       <two>
+          <xsl:copy-of select="$ymdVal1"/>
+       </two>
+    </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_duration_subtypes/test7.xsl b/tests/xs_duration_subtypes/test7.xsl
new file mode 100644
index 00000000..587eb37b
--- /dev/null
+++ b/tests/xs_duration_subtypes/test7.xsl
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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 3.1 sequence type 
+         expressions,
+         1) Where a value of schema type xs:duration is tried to be 
+            ill-legitemately assigned to the type xs:dayTimeDuration.
+         2) Where a value of schema type xs:duration is tried to be 
+            ill-legitemately assigned to the type xs:yearMonthDuration.
+    -->                
+
+    <xsl:output method="xml" indent="yes"/>
+
+    <xsl:template match="/"> 
+      <result>
+         <xsl:call-template name="process1">
+            <xsl:with-param name="dtdVal1" select="xs:duration('PT40H')" as="xs:dayTimeDuration"/>
+            <xsl:with-param name="ymdVal1" select="xs:duration('P1Y3M')" as="xs:yearMonthDuration"/>
+         </xsl:call-template>
+      </result>
+    </xsl:template>
+    
+    <xsl:template name="process1">
+       <xsl:param name="dtdVal1" as="xs:dayTimeDuration"/>
+       <xsl:param name="ymdVal1" as="xs:yearMonthDuration"/>
+       <one>
+          <xsl:copy-of select="$dtdVal1"/>
+       </one>
+       <two>
+          <xsl:copy-of select="$ymdVal1"/>
+       </two>
+    </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_duration_subtypes/test8.xsl b/tests/xs_duration_subtypes/test8.xsl
new file mode 100644
index 00000000..e5025dc8
--- /dev/null
+++ b/tests/xs_duration_subtypes/test8.xsl
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:fn0="http://fn0"
+                exclude-result-prefixes="xs fn0"
+                version="3.0">
+                
+    <!-- Author: mukulg@apache.org -->
+    
+    <!-- An XSLT stylesheet test case, to test XPath 3.1 sequence type 
+         expressions,
+         1) Where a value of schema type xs:dayTimeDuration is legitemately assigned 
+            to the type xs:duration.  
+         2) Where a value of schema type xs:yearMonthDuration is legitemately assigned 
+            to the type xs:duration.
+    -->                  
+
+    <xsl:output method="xml" indent="yes"/>
+
+    <xsl:template match="/"> 
+      <result>
+         <xsl:copy-of select="fn0:process1(xs:dayTimeDuration('PT40H'), xs:yearMonthDuration('P1Y3M'))"/>
+      </result>
+    </xsl:template>
+    
+    <xsl:function name="fn0:process1" as="element()*">
+       <xsl:param name="dtdVal1" as="xs:duration"/>
+       <xsl:param name="ymdVal1" as="xs:duration"/>
+       <one>
+          <xsl:sequence select="$dtdVal1"/>
+       </one>
+       <two>
+          <xsl:sequence select="$ymdVal1"/>
+       </two>
+    </xsl:function>
+    
+    <!--
+      * 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_duration_subtypes/test9.xsl b/tests/xs_duration_subtypes/test9.xsl
new file mode 100644
index 00000000..3ddfa682
--- /dev/null
+++ b/tests/xs_duration_subtypes/test9.xsl
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+                xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:fn0="http://fn0"
+                exclude-result-prefixes="xs fn0"
+                version="3.0">
+                
+    <!-- Author: mukulg@apache.org -->
+    
+    <!-- An XSLT stylesheet test case, to test XPath 3.1 sequence type 
+         expressions,
+         1) Where a value of schema type xs:duration is tried to be 
+            ill-legitemately assigned to the type xs:dayTimeDuration.
+         2) Where a value of schema type xs:duration is tried to be 
+            ill-legitemately assigned to the type xs:yearMonthDuration.
+     -->                
+
+    <xsl:output method="xml" indent="yes"/>
+
+    <xsl:template match="/"> 
+       <result>
+         <xsl:copy-of select="fn0:process1(xs:duration('PT40H'), xs:duration('P1Y3M'))"/>
+       </result>
+    </xsl:template>
+    
+    <xsl:function name="fn0:process1" as="element()*">
+       <xsl:param name="dtdVal1" as="xs:dayTimeDuration"/>
+       <xsl:param name="ymdVal1" as="xs:yearMonthDuration"/>
+       <one>
+          <xsl:sequence select="$dtdVal1"/>
+       </one>
+       <two>
+          <xsl:sequence select="$ymdVal1"/>
+       </two>
+    </xsl:function>
+    
+    <!--
+      * 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