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 2025/03/07 11:43:00 UTC

(xalan-java) branch xalan-j_xslt3.0_mvn updated: committing xsl 3 xalan-j test cases to test comparison of xdm gregorian values

This is an automated email from the ASF dual-hosted git repository.

mukulg pushed a commit to branch xalan-j_xslt3.0_mvn
in repository https://gitbox.apache.org/repos/asf/xalan-java.git


The following commit(s) were added to refs/heads/xalan-j_xslt3.0_mvn by this push:
     new ac6629057 committing xsl 3 xalan-j test cases to test comparison of xdm gregorian values
ac6629057 is described below

commit ac6629057cdf0576ca862b7d2d540aa7b15f05be
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Fri Mar 7 17:12:51 2025 +0530

    committing xsl 3 xalan-j test cases to test comparison of xdm gregorian values
---
 .../xalan/tests/xpath3/XsGregorianTypeTests.java   | 10 +++
 .../resources/xs_gregorianTypes/gold/test4.out     | 32 +++++++++
 src/test/resources/xs_gregorianTypes/test4.xsl     | 77 ++++++++++++++++++++++
 3 files changed, 119 insertions(+)

diff --git a/src/test/java/org/apache/xalan/tests/xpath3/XsGregorianTypeTests.java b/src/test/java/org/apache/xalan/tests/xpath3/XsGregorianTypeTests.java
index cf2b01c8e..19342c157 100644
--- a/src/test/java/org/apache/xalan/tests/xpath3/XsGregorianTypeTests.java
+++ b/src/test/java/org/apache/xalan/tests/xpath3/XsGregorianTypeTests.java
@@ -76,5 +76,15 @@ public class XsGregorianTypeTests extends XSLTransformTestsUtil {
         
         runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
     }
+    
+    @Test
+    public void xslGregorianTypeTest4() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test4.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test4.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test4.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
 
 }
diff --git a/src/test/resources/xs_gregorianTypes/gold/test4.out b/src/test/resources/xs_gregorianTypes/gold/test4.out
new file mode 100644
index 000000000..51ce9a604
--- /dev/null
+++ b/src/test/resources/xs_gregorianTypes/gold/test4.out
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <test1 reason="comparison of xs:gYearMonth values">
+    <one>true</one>
+    <two>false</two>
+    <three>false</three>
+    <four>true</four>
+  </test1>
+  <test2 reason="comparison of xs:gYear values">
+    <one>true</one>
+    <two>false</two>
+    <three>false</three>
+    <four>true</four>
+  </test2>
+  <test3 reason="comparison of xs:gMonthDay values">
+    <one>true</one>
+    <two>false</two>
+    <three>false</three>
+    <four>true</four>
+  </test3>
+  <test4 reason="comparison of xs:gDay values">
+    <one>true</one>
+    <two>false</two>
+    <three>false</three>
+    <four>true</four>
+  </test4>
+  <test5 reason="comparison of xs:gMonth values">
+    <one>true</one>
+    <two>false</two>
+    <three>false</three>
+    <four>true</four>
+  </test5>
+</result>
diff --git a/src/test/resources/xs_gregorianTypes/test4.xsl b/src/test/resources/xs_gregorianTypes/test4.xsl
new file mode 100644
index 000000000..0a1e00ec7
--- /dev/null
+++ b/src/test/resources/xs_gregorianTypes/test4.xsl
@@ -0,0 +1,77 @@
+<?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 XSL stylesheet test case, to test comparison of XDM 
+         gregorian values using XPath eq and ne operators. -->				
+
+	<xsl:output method="xml" indent="yes"/>
+
+	<xsl:template match="/">
+	   <result>
+	      <test1 reason="comparison of xs:gYearMonth values">
+			  <xsl:variable name="val1" select="xs:gYearMonth('2005-10')" as="xs:gYearMonth"/>
+			  <xsl:variable name="val2" select="xs:gYearMonth('2007-10')" as="xs:gYearMonth"/>
+			  <one><xsl:value-of select="$val1 eq $val1"/></one>
+			  <two><xsl:value-of select="$val1 ne $val1"/></two>
+			  <three><xsl:value-of select="$val1 eq $val2"/></three>
+			  <four><xsl:value-of select="$val1 ne $val2"/></four>
+		  </test1>
+		  <test2 reason="comparison of xs:gYear values">
+			  <xsl:variable name="val1" select="xs:gYear('2005')" as="xs:gYear"/>
+			  <xsl:variable name="val2" select="xs:gYear('2007')" as="xs:gYear"/>
+			  <one><xsl:value-of select="$val1 eq $val1"/></one>
+			  <two><xsl:value-of select="$val1 ne $val1"/></two>
+			  <three><xsl:value-of select="$val1 eq $val2"/></three>
+			  <four><xsl:value-of select="$val1 ne $val2"/></four>
+		  </test2>
+		  <test3 reason="comparison of xs:gMonthDay values">
+			  <xsl:variable name="val1" select="xs:gMonthDay('--05-10')" as="xs:gMonthDay"/>
+			  <xsl:variable name="val2" select="xs:gMonthDay('--10-10')" as="xs:gMonthDay"/>
+			  <one><xsl:value-of select="$val1 eq $val1"/></one>
+			  <two><xsl:value-of select="$val1 ne $val1"/></two>
+			  <three><xsl:value-of select="$val1 eq $val2"/></three>
+			  <four><xsl:value-of select="$val1 ne $val2"/></four>
+		  </test3>
+		  <test4 reason="comparison of xs:gDay values">
+			  <xsl:variable name="val1" select="xs:gDay('---05')" as="xs:gDay"/>
+			  <xsl:variable name="val2" select="xs:gDay('---10')" as="xs:gDay"/>
+			  <one><xsl:value-of select="$val1 eq $val1"/></one>
+			  <two><xsl:value-of select="$val1 ne $val1"/></two>
+			  <three><xsl:value-of select="$val1 eq $val2"/></three>
+			  <four><xsl:value-of select="$val1 ne $val2"/></four>
+		  </test4>
+		  <test5 reason="comparison of xs:gMonth values">
+			  <xsl:variable name="val1" select="xs:gMonth('--05')" as="xs:gMonth"/>
+			  <xsl:variable name="val2" select="xs:gMonth('--10')" as="xs:gMonth"/>
+			  <one><xsl:value-of select="$val1 eq $val1"/></one>
+			  <two><xsl:value-of select="$val1 ne $val1"/></two>
+			  <three><xsl:value-of select="$val1 eq $val2"/></three>
+			  <four><xsl:value-of select="$val1 ne $val2"/></four>
+		  </test5>
+	   </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>


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