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/06 14:59:07 UTC
[xalan-java] branch xalan-j_xslt3.0 updated: committing a new working test case, for xpath 3.1 dynamic function calls implementation
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 8191addc committing a new working test case, for xpath 3.1 dynamic function calls implementation
new 5748d7bc Merge pull request #20 from mukulga/xalan-j_xslt3.0_mukul
8191addc is described below
commit 8191addc6a8dfbc3f0134f473fa62f9041fdcbf6
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Thu Jul 6 20:23:01 2023 +0530
committing a new working test case, for xpath 3.1 dynamic function calls implementation
---
tests/dynamic_function_call/gold/test7.out | 26 ++++++++++
tests/dynamic_function_call/test7.xsl | 55 ++++++++++++++++++++++
.../xalan/xpath3/DynamicFunctionCallTests.java | 10 ++++
3 files changed, 91 insertions(+)
diff --git a/tests/dynamic_function_call/gold/test7.out b/tests/dynamic_function_call/gold/test7.out
new file mode 100644
index 00000000..a47378cd
--- /dev/null
+++ b/tests/dynamic_function_call/gold/test7.out
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <lessOrEqual count="2">
+ <item>
+ <a>1</a>
+ <b>5</b>
+ </item>
+ <item>
+ <a>2</a>
+ <b>7</b>
+ </item>
+ </lessOrEqual>
+ <greater count="3">
+ <item>
+ <a>5</a>
+ <b>2</b>
+ </item>
+ <item>
+ <a>3</a>
+ <b>1</b>
+ </item>
+ <item>
+ <a>7</a>
+ <b>4</b>
+ </item>
+ </greater>
+</result>
diff --git a/tests/dynamic_function_call/test7.xsl b/tests/dynamic_function_call/test7.xsl
new file mode 100644
index 00000000..6e9d1d2f
--- /dev/null
+++ b/tests/dynamic_function_call/test7.xsl
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- use with test1_c.xml -->
+
+ <!-- An XSLT stylesheet, to test the XPath 3.1 dynamic function
+ calls when used with xsl:for-each-group. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:variable name="gThan" select="function($x, $y) { $x gt $y }"/>
+
+ <xsl:template match="/list">
+ <result>
+ <xsl:for-each-group select="item" group-by="$gThan(a, b)">
+ <xsl:variable name="grtOrLess">
+ <xsl:choose>
+ <xsl:when test="string(current-grouping-key()) eq 'true'">
+ greater
+ </xsl:when>
+ <xsl:otherwise>
+ lessOrEqual
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:element name="{normalize-space($grtOrLess)}">
+ <xsl:attribute name="count" select="count(current-group())"/>
+ <xsl:copy-of select="current-group()"/>
+ </xsl:element>
+ </xsl:for-each-group>
+ </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/org/apache/xalan/xpath3/DynamicFunctionCallTests.java b/tests/org/apache/xalan/xpath3/DynamicFunctionCallTests.java
index a26fb91f..e7d2bb3c 100644
--- a/tests/org/apache/xalan/xpath3/DynamicFunctionCallTests.java
+++ b/tests/org/apache/xalan/xpath3/DynamicFunctionCallTests.java
@@ -106,5 +106,15 @@ public class DynamicFunctionCallTests extends XslTransformTestsUtil {
runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
}
+
+ @Test
+ public void xslDynamicFunctionCallTest7() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_c.xml";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test7.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test7.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org