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/01/26 23:24:54 UTC
(xalan-java) branch xalan-j_xslt3.0_mvn updated: committing few working xsl3 test cases, for xsl:for-each-group instruction
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 413117682 committing few working xsl3 test cases, for xsl:for-each-group instruction
413117682 is described below
commit 413117682461b553c11921f7acc78a60469050c5
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Mon Jan 27 04:54:40 2025 +0530
committing few working xsl3 test cases, for xsl:for-each-group instruction
---
.../apache/xalan/tests/xslt3/XslGroupingTests.java | 20 +++++++++
src/test/resources/grouping/gold/test31.out | 16 ++++++++
src/test/resources/grouping/gold/test32.out | 4 ++
src/test/resources/grouping/test31.xsl | 48 ++++++++++++++++++++++
src/test/resources/grouping/test32.xsl | 48 ++++++++++++++++++++++
5 files changed, 136 insertions(+)
diff --git a/src/test/java/org/apache/xalan/tests/xslt3/XslGroupingTests.java b/src/test/java/org/apache/xalan/tests/xslt3/XslGroupingTests.java
index bcc0e32d0..7c27c24b7 100644
--- a/src/test/java/org/apache/xalan/tests/xslt3/XslGroupingTests.java
+++ b/src/test/java/org/apache/xalan/tests/xslt3/XslGroupingTests.java
@@ -350,5 +350,25 @@ public class XslGroupingTests extends XSLTransformTestsUtil {
runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
}
+
+ @Test
+ public void xslGroupingTest31() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test31.xsl";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test31.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test31.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
+
+ @Test
+ public void xslGroupingTest32() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test32.xsl";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test32.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test32.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
}
diff --git a/src/test/resources/grouping/gold/test31.out b/src/test/resources/grouping/gold/test31.out
new file mode 100644
index 000000000..785a55e20
--- /dev/null
+++ b/src/test/resources/grouping/gold/test31.out
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <group grpKey="false">
+ <val>1</val>
+ <val>2</val>
+ <val>3</val>
+ <val>4</val>
+ <val>5</val>
+ </group>
+ <group grpKey="true">
+ <val>6</val>
+ <val>7</val>
+ <val>8</val>
+ <val>9</val>
+ <val>10</val>
+ </group>
+</result>
diff --git a/src/test/resources/grouping/gold/test32.out b/src/test/resources/grouping/gold/test32.out
new file mode 100644
index 000000000..10c8d4af3
--- /dev/null
+++ b/src/test/resources/grouping/gold/test32.out
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <group grpKey="false">1,2,3,4,5</group>
+ <group grpKey="true">6,7,8,9,10</group>
+</result>
diff --git a/src/test/resources/grouping/test31.xsl b/src/test/resources/grouping/test31.xsl
new file mode 100644
index 000000000..d3cb71c94
--- /dev/null
+++ b/src/test/resources/grouping/test31.xsl
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- An XSL stylesheet grouping example for sequence of atomic
+ integer values. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/">
+ <result>
+ <xsl:variable name="seq1" select="(1,2,3,4,5,6,7,8,9,10)"/>
+ <xsl:variable name="temp1">
+ <xsl:for-each select="$seq1">
+ <val>
+ <xsl:value-of select="."/>
+ </val>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:for-each-group select="$temp1/val" group-by="number(.) gt 5">
+ <group grpKey="{current-grouping-key()}">
+ <xsl:copy-of select="current-group()"/>
+ </group>
+ </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>
diff --git a/src/test/resources/grouping/test32.xsl b/src/test/resources/grouping/test32.xsl
new file mode 100644
index 000000000..40f812bae
--- /dev/null
+++ b/src/test/resources/grouping/test32.xsl
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- An XSL stylesheet grouping example for sequence of atomic
+ integer values. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/">
+ <result>
+ <xsl:variable name="seq1" select="(1,2,3,4,5,6,7,8,9,10)"/>
+ <xsl:variable name="temp1">
+ <xsl:for-each select="$seq1">
+ <val>
+ <xsl:value-of select="."/>
+ </val>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:for-each-group select="$temp1/val" group-by="number(.) gt 5">
+ <group grpKey="{current-grouping-key()}">
+ <xsl:copy-of select="string-join(current-group()/text(), ',')"/>
+ </group>
+ </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>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org