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/06/28 16:06:56 UTC
(xalan-java) branch xalan-j_xslt3.0_mvn updated: adding few xpath named function reference test cases
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 545596703 adding few xpath named function reference test cases
545596703 is described below
commit 545596703919031ad72ade7804134e665d705a10
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Sat Jun 28 21:36:36 2025 +0530
adding few xpath named function reference test cases
---
README | 6 +--
.../xpath3/XPathNamedFunctionReferenceTests.java | 24 +++++++++
.../resources/xpath_named_func_ref/gold/test11.out | 12 +++++
.../resources/xpath_named_func_ref/gold/test12.out | 4 ++
src/test/resources/xpath_named_func_ref/test11.xsl | 61 ++++++++++++++++++++++
src/test/resources/xpath_named_func_ref/test12.xsl | 45 ++++++++++++++++
6 files changed, 149 insertions(+), 3 deletions(-)
diff --git a/README b/README
index 392b63ab4..7fbd4afbd 100644
--- a/README
+++ b/README
@@ -59,16 +59,16 @@ The Maven build results like following shall be produced:
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.apache.xalan.tests.main.AllXalanXSLT3Tests
-[INFO] Tests run: 1108, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 41.92 s - in org.apache.xalan.tests.main.AllXalanXSLT3Tests
+[INFO] Tests run: 1110, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 90.855 s - in org.apache.xalan.tests.main.AllXalanXSLT3Tests
[INFO]
[INFO] Results:
[INFO]
-[INFO] Tests run: 1108, Failures: 0, Errors: 0, Skipped: 0
+[INFO] Tests run: 1110, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
-[INFO] Total time: 01:31 min
+[INFO] Total time: 02:44 min
If the user needs to run Xalan-J's XSLT 3.0 implementation via Java code, the value of JVM's system property
diff --git a/src/test/java/org/apache/xalan/tests/xpath3/XPathNamedFunctionReferenceTests.java b/src/test/java/org/apache/xalan/tests/xpath3/XPathNamedFunctionReferenceTests.java
index 4ef1ac52c..0516d5686 100644
--- a/src/test/java/org/apache/xalan/tests/xpath3/XPathNamedFunctionReferenceTests.java
+++ b/src/test/java/org/apache/xalan/tests/xpath3/XPathNamedFunctionReferenceTests.java
@@ -146,5 +146,29 @@ public class XPathNamedFunctionReferenceTests extends XslTransformTestsUtil {
runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
}
+
+ @Test
+ public void xslNamedFunctionReferenceTest11() {
+ String xmlFilePath = null;
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test11.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test11.out";
+
+ m_initTemplateName = "main";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
+
+ @Test
+ public void xslNamedFunctionReferenceTest12() {
+ String xmlFilePath = null;
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test12.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test12.out";
+
+ m_initTemplateName = "main";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
}
diff --git a/src/test/resources/xpath_named_func_ref/gold/test11.out b/src/test/resources/xpath_named_func_ref/gold/test11.out
new file mode 100644
index 000000000..0d9543740
--- /dev/null
+++ b/src/test/resources/xpath_named_func_ref/gold/test11.out
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <one>
+ <a>true</a>
+ <b>false</b>
+ <c>2005-10-07</c>
+ </one>
+ <two>
+ <a>true</a>
+ <b>false</b>
+ <c>2005-10-07</c>
+ </two>
+</result>
diff --git a/src/test/resources/xpath_named_func_ref/gold/test12.out b/src/test/resources/xpath_named_func_ref/gold/test12.out
new file mode 100644
index 000000000..35ff8f586
--- /dev/null
+++ b/src/test/resources/xpath_named_func_ref/gold/test12.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <one>7</one>
+ <two>7</two>
+</result>
diff --git a/src/test/resources/xpath_named_func_ref/test11.xsl b/src/test/resources/xpath_named_func_ref/test11.xsl
new file mode 100644
index 000000000..3fd2ed4bb
--- /dev/null
+++ b/src/test/resources/xpath_named_func_ref/test11.xsl
@@ -0,0 +1,61 @@
+<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 XML Schema constructor functions
+ for schema built-in types used in two different ways. One as XPath named
+ function reference and called via XPath dynamic function call syntax,
+ and second with usual XML Schema constructor function call syntax. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template name="main">
+ <result>
+ <one>
+ <xsl:variable name="dateFunc" select="xs:date#1" as="function(*)"/>
+ <a>
+ <xsl:value-of select="current-date() gt $dateFunc('2005-10-05')"/>
+ </a>
+ <b>
+ <xsl:value-of select="current-date() lt $dateFunc('2005-10-05')"/>
+ </b>
+ <c>
+ <xsl:value-of select="$dateFunc('2005-10-05') + xs:dayTimeDuration('P2DT2H30M0S')"/>
+ </c>
+ </one>
+ <two>
+ <a>
+ <xsl:value-of select="current-date() gt xs:date('2005-10-05')"/>
+ </a>
+ <b>
+ <xsl:value-of select="current-date() lt xs:date('2005-10-05')"/>
+ </b>
+ <c>
+ <xsl:value-of select="xs:date('2005-10-05') + xs:dayTimeDuration('P2DT2H30M0S')"/>
+ </c>
+ </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>
diff --git a/src/test/resources/xpath_named_func_ref/test12.xsl b/src/test/resources/xpath_named_func_ref/test12.xsl
new file mode 100644
index 000000000..7bde250aa
--- /dev/null
+++ b/src/test/resources/xpath_named_func_ref/test12.xsl
@@ -0,0 +1,45 @@
+<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 XML Schema constructor functions
+ for schema built-in types used in two different ways. One as XPath named
+ function reference and called via XPath dynamic function call syntax,
+ and second with usual XML Schema constructor function call syntax. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template name="main">
+ <result>
+ <one>
+ <xsl:variable name="decimal" select="xs:decimal#1" as="function(*)"/>
+ <xsl:value-of select="$decimal(5) + 2"/>
+ </one>
+ <two>
+ <xsl:value-of select="xs:decimal(5) + 2"/>
+ </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>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org