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/08/03 16:30:32 UTC
[xalan-java] branch xalan-j_xslt3.0 updated: committing improvements to, xslt 3.0 xsl:iterate instruction's evaluation where now with this enhancement, an xslt element xsl:iterate can process a sequence of atomic values as input. committing few new, related working xalanj 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 5255cde6 committing improvements to, xslt 3.0 xsl:iterate instruction's evaluation where now with this enhancement, an xslt element xsl:iterate can process a sequence of atomic values as input. committing few new, related working xalanj test cases as well.
new a01f3084 Merge pull request #42 from mukulga/xalan-j_xslt3.0_mukul
5255cde6 is described below
commit 5255cde65e9f30114e63f89a6dbe9b6521e27686
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Thu Aug 3 21:55:50 2023 +0530
committing improvements to, xslt 3.0 xsl:iterate instruction's evaluation where now with this enhancement, an xslt element xsl:iterate can process a sequence of atomic values as input. committing few new, related working xalanj test cases as well.
---
src/org/apache/xalan/templates/ElemIterate.java | 131 ++++++++++++++-------
.../xpath/functions/DynamicFunctionCall.java | 23 ++--
tests/org/apache/xalan/xslt3/XslIterateTests.java | 60 ++++++++++
tests/xsl_iterate/gold/test15.out | 12 ++
tests/xsl_iterate/gold/test16.out | 7 ++
tests/xsl_iterate/gold/test17.out | 15 +++
tests/xsl_iterate/gold/test18.out | 8 ++
tests/xsl_iterate/gold/test19.out | 13 ++
tests/xsl_iterate/gold/test20.out | 6 +
tests/xsl_iterate/test15.xsl | 39 ++++++
tests/xsl_iterate/test16.xsl | 46 ++++++++
tests/xsl_iterate/test17.xsl | 62 ++++++++++
tests/xsl_iterate/test18.xsl | 49 ++++++++
tests/xsl_iterate/test19.xsl | 44 +++++++
tests/xsl_iterate/test1_f.xml | 8 ++
tests/xsl_iterate/test20.xsl | 50 ++++++++
16 files changed, 519 insertions(+), 54 deletions(-)
diff --git a/src/org/apache/xalan/templates/ElemIterate.java b/src/org/apache/xalan/templates/ElemIterate.java
index 5b23c8e9..a713c796 100644
--- a/src/org/apache/xalan/templates/ElemIterate.java
+++ b/src/org/apache/xalan/templates/ElemIterate.java
@@ -32,6 +32,10 @@ import org.apache.xpath.Expression;
import org.apache.xpath.ExpressionOwner;
import org.apache.xpath.XPath;
import org.apache.xpath.XPathContext;
+import org.apache.xpath.objects.ResultSequence;
+import org.apache.xpath.objects.XObject;
+import org.apache.xpath.operations.Operation;
+import org.apache.xpath.operations.Variable;
/**
* XSLT 3.0 xsl:iterate element.
@@ -51,6 +55,8 @@ import org.apache.xpath.XPathContext;
<xsl:on-completion select? = expression>
<!-- Content: sequence-constructor -->
</xsl:on-completion>
+
+ Ref : https://www.w3.org/TR/xslt-30/#iterate
@author Mukul Gandhi <mu...@apache.org>
*
@@ -58,28 +64,6 @@ import org.apache.xpath.XPathContext;
*/
/*
* Implementation of the XSLT 3.0 xsl:iterate instruction.
- *
- * An xsl:iterate instruction, functions like a loop, with following main features,
- * 1) To be able to process a sequence of items in order, similar to how xsl:for-each
- * instruction shall do such processing.
- * 2) An xsl:iterate instruction has ability to exit from the loop prior to the
- * exhaustion of the input sequence when particular condition(s) become true,
- * using xsl:break instruction. xsl:break being the final instruction (if invoked)
- * processed by xsl:iterate, can also specify particular XSLT evaluation to be
- * done via xsl:break's "select" attribute or with XSLT contents within xsl:break.
- * 3) With xsl:iterate instruction, the stylesheet author could also specify,
- * particular XSLT processing to be done via xsl:on-completion instruction,
- * after input sequence is exhausted. xsl:on-completion instruction is not
- * invoked, when xsl:iterate processing is exited via xsl:break instruction.
- * xsl:on-completion instruction can specify certain XSLT processing to be done,
- * via its "select" attribute or via XSLT contents within xsl:on-completion.
- * 4) xsl:iterate can also have optional xsl:param elements, to allow passing
- * certain values as arguments to body of xsl:iterate (upon initial invocation of
- * xsl:iterate, or via xsl:next-iteration element just before a new iteration shall
- * start).
- * 5) The effect of xsl:iterate may also be achieved by XSLT 1.0 compatible named
- * templates. But using xsl:iterate likely makes writing such XSLT processing
- * simpler.
*/
public class ElemIterate extends ElemTemplateElement implements ExpressionOwner
{
@@ -88,10 +72,11 @@ public class ElemIterate extends ElemTemplateElement implements ExpressionOwner
private static final String OTHER_ELEM = "OTHER_ELEM";
- // revisit.
- // can we have better way to maintain xsl:iterate->xsl:param* state, instead of having this with
- // 'public static' visibility.
- public static List<XslIterateParamWithparamData> fParamList = new ArrayList<XslIterateParamWithparamData>();
+ // Can we have better way to maintain XSLT transformation xsl:iterate->xsl:param*
+ // run-time reference, instead of having this with 'public static' visibility?
+ // REVISIT
+ public static List<XslIterateParamWithparamData> fParamList = new
+ ArrayList<XslIterateParamWithparamData>();
/**
* Construct an element representing xsl:iterate.
@@ -147,8 +132,7 @@ public class ElemIterate extends ElemTemplateElement implements ExpressionOwner
java.util.Vector vnames = sroot.getComposeState().getVariableNames();
- if (m_selectExpression != null) {
-
+ if (m_selectExpression != null) {
m_selectExpression.fixupVariables(vnames, sroot.getComposeState().
getGlobalsSize());
}
@@ -214,12 +198,75 @@ public class ElemIterate extends ElemTemplateElement implements ExpressionOwner
final int sourceNode = xctxt.getCurrentNode();
- // clear the, xsl:iterate->xsl:param* list storage before this xsl:iterate
+ // Clear the, xsl:iterate->xsl:param* list storage before this xsl:iterate
// instruction's evaluation.
fParamList.clear();
validateXslElemIterateChildElementsSequence(xctxt);
-
+
+ // Evaluate xsl:iterate instruction, when value of its "select" attribute evaluates
+ // to a 'ResultSequence'.
+ if ((m_selectExpression instanceof Variable) ||
+ (m_selectExpression instanceof Operation)) {
+ XObject evalResult = m_selectExpression.execute(xctxt);
+ if (evalResult instanceof ResultSequence) {
+ ResultSequence resultSeq = (ResultSequence)evalResult;
+ List<XObject> resultSeqItems = resultSeq.getResultSequenceItems();
+
+ xctxt.setXPath3ContextSize(resultSeqItems.size());
+
+ ElemIterateOnCompletion xslOnCompletionTemplate = null;
+
+ for (int idx = 0; idx < resultSeqItems.size(); idx++) {
+ XObject resultSeqItem = resultSeqItems.get(idx);
+ xctxt.setXPath3ContextItem(resultSeqItem);
+ xctxt.setXPath3ContextPosition(idx + 1);
+
+ for (ElemTemplateElement elemTemplate = this.m_firstChild; elemTemplate != null;
+ elemTemplate = elemTemplate.m_nextSibling) {
+ if ((elemTemplate instanceof ElemIterateOnCompletion) && (xslOnCompletionTemplate == null)) {
+ xslOnCompletionTemplate = (ElemIterateOnCompletion)elemTemplate;
+ }
+
+ if (!(XslTransformSharedDatastore.isXslIterateBreakEvaluated).booleanValue()) {
+ xctxt.setSAXLocator(elemTemplate);
+ transformer.setCurrentElement(elemTemplate);
+ elemTemplate.execute(transformer);
+ }
+ else {
+ break;
+ }
+ }
+
+ if ((XslTransformSharedDatastore.isXslIterateBreakEvaluated).booleanValue()) {
+ break;
+ }
+ }
+
+ // Reset the, XPath context's size, item and position variables
+ xctxt.setXPath3ContextSize(-1);
+ xctxt.setXPath3ContextItem(null);
+ xctxt.setXPath3ContextPosition(-1);
+
+ if ((xslOnCompletionTemplate != null) && !(XslTransformSharedDatastore.
+ isXslIterateBreakEvaluated).booleanValue()) {
+ XslTransformSharedDatastore.isXslIterateOnCompletionActive = Boolean.TRUE;
+ xctxt.setSAXLocator(xslOnCompletionTemplate);
+ transformer.setCurrentElement(xslOnCompletionTemplate);
+ xslOnCompletionTemplate.execute(transformer);
+ XslTransformSharedDatastore.isXslIterateOnCompletionActive = Boolean.FALSE;
+ }
+
+ XslTransformSharedDatastore.isXslIterateBreakEvaluated = Boolean.FALSE;
+
+ transformer.setXPathContext(xctxtOriginal);
+
+ return; // return from this xsl:iterate instruction's evaluation
+ }
+ }
+
+ // Evaluate xsl:iterate instruction, when value of its "select" attribute evaluates
+ // to a node set.
DTMIterator sourceNodes = m_selectExpression.asIterator(xctxt, sourceNode);
try {
@@ -235,13 +282,13 @@ public class ElemIterate extends ElemTemplateElement implements ExpressionOwner
xctxt.pushContextNodeList(sourceNodes);
transformer.pushElemTemplateElement(null);
- int child;
+ int nextNode;
ElemIterateOnCompletion xslOnCompletionTemplate = null;
- while ((child = sourceNodes.nextNode()) != DTM.NULL) {
- currentNodes.setTop(child);
- currentExpressionNodes.setTop(child);
+ while ((nextNode = sourceNodes.nextNode()) != DTM.NULL) {
+ currentNodes.setTop(nextNode);
+ currentExpressionNodes.setTop(nextNode);
for (ElemTemplateElement elemTemplate = this.m_firstChild; elemTemplate != null;
elemTemplate = elemTemplate.m_nextSibling) {
@@ -285,16 +332,16 @@ public class ElemIterate extends ElemTemplateElement implements ExpressionOwner
sourceNodes.detach();
}
- // restore the xpath context, to where it was before this xsl:iterate
+ // Restore the xpath context, to where it was before this xsl:iterate
// instruction began an evaluation.
transformer.setXPathContext(xctxtOriginal);
}
- /*
- * The XSLT 3.0 spec specifies constraints, about what should be the order of XSLT elements
- * xsl:param and xsl:on-completion within the xsl:iterate element. This method ensures that,
- * these XSLT element constraints are validated during an XSLT stylesheet transformation.
- */
+ /**
+ * The XSLT 3.0 spec specifies constraints, about what should be the order of XSLT elements
+ * xsl:param and xsl:on-completion within the xsl:iterate element. This method ensures that,
+ * these XSLT element constraints are validated during an XSLT stylesheet transformation.
+ */
private void validateXslElemIterateChildElementsSequence(XPathContext xctxt)
throws TransformerException {
@@ -314,8 +361,8 @@ public class ElemIterate extends ElemTemplateElement implements ExpressionOwner
}
}
- // get index of specific XSLT stylesheet elements first occurrence with the list object
- // 'xslElemNamesList'. if a particular kind of XSLT stylesheet element that is checked is
+ // Get index of specific XSLT stylesheet elements first occurrence with the list object
+ // 'xslElemNamesList'. If a particular kind of XSLT stylesheet element that is checked is
// not present within the list object 'xslElemNamesList', its index is returned as -1.
int paramIdx = xslElemNamesList.indexOf(Constants.ELEMNAME_PARAMVARIABLE_STRING);
int onCompletionIdx = xslElemNamesList.indexOf(Constants.ELEMNAME_ITERATE_ONCOMPLETION_STRING);
diff --git a/src/org/apache/xpath/functions/DynamicFunctionCall.java b/src/org/apache/xpath/functions/DynamicFunctionCall.java
index 24e843e3..20a7c810 100644
--- a/src/org/apache/xpath/functions/DynamicFunctionCall.java
+++ b/src/org/apache/xpath/functions/DynamicFunctionCall.java
@@ -94,19 +94,18 @@ public class DynamicFunctionCall extends Expression {
Map<QName, XObject> inlineFunctionVarMap = xctxt.getXPathVarMap();
- // we get below reference of an XPath inline function, that this dynamic
- // function call refers to.
-
- XObject functionRef = inlineFunctionVarMap.get(new QName(funcRefVarName));
+ // We find below, reference of an XPath inline function, that this dynamic
+ // function call refers to.
+ XObject functionRef = inlineFunctionVarMap.get(new QName(funcRefVarName));
if (functionRef == null) {
- ExpressionContext exprContext = xctxt.getExpressionContext();
+ ExpressionContext exprContext = xctxt.getExpressionContext();
- try {
- functionRef = exprContext.getVariableOrParam(new QName(funcRefVarName));
- }
- catch (TransformerException ex) {
- // try to get an XPath inline function reference, within stylesheet's
+ try {
+ functionRef = exprContext.getVariableOrParam(new QName(funcRefVarName));
+ }
+ catch (TransformerException ex) {
+ // Try to get an XPath inline function reference, within stylesheet's
// global scope.
ExpressionNode expressionNode = getExpressionOwner();
ExpressionNode stylesheetRootNode = null;
@@ -118,7 +117,7 @@ public class DynamicFunctionCall extends Expression {
Map<QName, InlineFunction> globalInlineFunctionVarMap = stylesheetRoot.
getInlineFunctionVarMap();
functionRef = globalInlineFunctionVarMap.get(new QName(funcRefVarName));
- }
+ }
}
if ((functionRef != null) && (functionRef instanceof InlineFunction)) {
@@ -173,7 +172,7 @@ public class DynamicFunctionCall extends Expression {
}
else {
throw new javax.xml.transform.TransformerException("XPST0008 variable '" + funcRefVarName + "' has "
- + "not been declared (or its declaration is not in scope).",
+ + "not been declared, or its declaration is not in scope.",
xctxt.getSAXLocator());
}
diff --git a/tests/org/apache/xalan/xslt3/XslIterateTests.java b/tests/org/apache/xalan/xslt3/XslIterateTests.java
index d0be3be0..bd7d98fb 100644
--- a/tests/org/apache/xalan/xslt3/XslIterateTests.java
+++ b/tests/org/apache/xalan/xslt3/XslIterateTests.java
@@ -210,5 +210,65 @@ public class XslIterateTests extends XslTransformTestsUtil {
runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
}
+
+ @Test
+ public void xslIterateTest17() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test15.xsl";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test15.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test15.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
+
+ @Test
+ public void xslIterateTest18() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test16.xsl";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test16.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test16.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
+
+ @Test
+ public void xslIterateTest19() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_f.xml";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test17.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test17.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
+
+ @Test
+ public void xslIterateTest20() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_f.xml";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test18.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test18.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
+
+ @Test
+ public void xslIterateTest21() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_f.xml";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test19.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test19.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
+
+ @Test
+ public void xslIterateTest22() {
+ String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_f.xml";
+ String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test20.xsl";
+
+ String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test20.out";
+
+ runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+ }
}
diff --git a/tests/xsl_iterate/gold/test15.out b/tests/xsl_iterate/gold/test15.out
new file mode 100644
index 00000000..5722d96b
--- /dev/null
+++ b/tests/xsl_iterate/gold/test15.out
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <val>1</val>
+ <val>2</val>
+ <val>3</val>
+ <val>4</val>
+ <val>5</val>
+ <val>6</val>
+ <val>7</val>
+ <val>8</val>
+ <val>9</val>
+ <val>10</val>
+</result>
diff --git a/tests/xsl_iterate/gold/test16.out b/tests/xsl_iterate/gold/test16.out
new file mode 100644
index 00000000..8d974707
--- /dev/null
+++ b/tests/xsl_iterate/gold/test16.out
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <val>1</val>
+ <val>2</val>
+ <val>3</val>
+ <val>4</val>
+ <val>5</val>
+</result>
diff --git a/tests/xsl_iterate/gold/test17.out b/tests/xsl_iterate/gold/test17.out
new file mode 100644
index 00000000..cc7d2e5a
--- /dev/null
+++ b/tests/xsl_iterate/gold/test17.out
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <one>
+ <val>3</val>
+ <val>4</val>
+ <val>5</val>
+ </one>
+ <two>
+ <val>1</val>
+ <val>2</val>
+ <val>3</val>
+ <val>4</val>
+ <val>5</val>
+ <val>6</val>
+ </two>
+</result>
diff --git a/tests/xsl_iterate/gold/test18.out b/tests/xsl_iterate/gold/test18.out
new file mode 100644
index 00000000..97a198f9
--- /dev/null
+++ b/tests/xsl_iterate/gold/test18.out
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <val>1</val>
+ <val>2</val>
+ <val>3</val>
+ <val>4</val>
+ <val>5</val>
+ <exited_from_loop itemsProcessed="5"/>
+</result>
diff --git a/tests/xsl_iterate/gold/test19.out b/tests/xsl_iterate/gold/test19.out
new file mode 100644
index 00000000..0bc5b4c9
--- /dev/null
+++ b/tests/xsl_iterate/gold/test19.out
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <val>1</val>
+ <val>2</val>
+ <val>3</val>
+ <val>4</val>
+ <val>5</val>
+ <val>6</val>
+ <val>7</val>
+ <val>8</val>
+ <val>9</val>
+ <val>10</val>
+ <allItemsProcessedWithoutBreak/>
+</result>
diff --git a/tests/xsl_iterate/gold/test20.out b/tests/xsl_iterate/gold/test20.out
new file mode 100644
index 00000000..172d3eb1
--- /dev/null
+++ b/tests/xsl_iterate/gold/test20.out
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+ <val>9</val>
+ <val>4</val>
+ <val>28</val>
+ <val>1.75</val>
+</result>
diff --git a/tests/xsl_iterate/test15.xsl b/tests/xsl_iterate/test15.xsl
new file mode 100644
index 00000000..3d1a54ac
--- /dev/null
+++ b/tests/xsl_iterate/test15.xsl
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- An XSLT stylesheet, to test xsl:iterate instruction,
+ when xsl:iterate's select attribute evaluates to a
+ sequence of atomic values. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/">
+ <result>
+ <xsl:iterate select="1 to 10">
+ <val><xsl:value-of select="."/></val>
+ </xsl:iterate>
+ </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/xsl_iterate/test16.xsl b/tests/xsl_iterate/test16.xsl
new file mode 100644
index 00000000..1025f3a7
--- /dev/null
+++ b/tests/xsl_iterate/test16.xsl
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="3.0">
+
+ <!-- Author: mukulg@apache.org -->
+
+ <!-- An XSLT stylesheet, to test xsl:iterate instruction,
+ when xsl:iterate's select attribute evaluates to a
+ sequence of atomic values. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/">
+ <result>
+ <xsl:iterate select="1 to 10">
+ <xsl:choose>
+ <xsl:when test=". = 6">
+ <xsl:break/>
+ </xsl:when>
+ <xsl:otherwise>
+ <val><xsl:value-of select="."/></val>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:iterate>
+ </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/xsl_iterate/test17.xsl b/tests/xsl_iterate/test17.xsl
new file mode 100644
index 00000000..4dd1f71a
--- /dev/null
+++ b/tests/xsl_iterate/test17.xsl
@@ -0,0 +1,62 @@
+<?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_f.xml -->
+
+ <!-- An XSLT stylesheet, to test xsl:iterate instruction,
+ when xsl:iterate's select attribute evaluates to a
+ sequence of atomic values. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/temp">
+ <result>
+ <one>
+ <xsl:iterate select="loop[1]/from to loop[1]/to">
+ <xsl:choose>
+ <xsl:when test=". = 6">
+ <xsl:break/>
+ </xsl:when>
+ <xsl:otherwise>
+ <val><xsl:value-of select="."/></val>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:iterate>
+ </one>
+ <two>
+ <xsl:iterate select="loop[2]/@from to loop[2]/@to">
+ <xsl:choose>
+ <xsl:when test=". = 7">
+ <xsl:break/>
+ </xsl:when>
+ <xsl:otherwise>
+ <val><xsl:value-of select="."/></val>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:iterate>
+ </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/xsl_iterate/test18.xsl b/tests/xsl_iterate/test18.xsl
new file mode 100644
index 00000000..715d553e
--- /dev/null
+++ b/tests/xsl_iterate/test18.xsl
@@ -0,0 +1,49 @@
+<?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_f.xml -->
+
+ <!-- An XSLT stylesheet, to test xsl:iterate instruction,
+ when xsl:iterate's select attribute evaluates to a
+ sequence of atomic values. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/temp">
+ <result>
+ <xsl:iterate select="loop[2]/@from to loop[2]/@to">
+ <xsl:choose>
+ <xsl:when test=". = 6">
+ <exited_from_loop itemsProcessed="{position()-1}"/>
+ <xsl:break/>
+ </xsl:when>
+ <xsl:otherwise>
+ <val><xsl:value-of select="."/></val>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:iterate>
+ </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/xsl_iterate/test19.xsl b/tests/xsl_iterate/test19.xsl
new file mode 100644
index 00000000..1710849f
--- /dev/null
+++ b/tests/xsl_iterate/test19.xsl
@@ -0,0 +1,44 @@
+<?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_f.xml -->
+
+ <!-- An XSLT stylesheet, to test xsl:iterate instruction,
+ when xsl:iterate's select attribute evaluates to a
+ sequence of atomic values. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <xsl:template match="/temp">
+ <result>
+ <xsl:iterate select="loop[2]/@from to loop[2]/@to">
+ <xsl:on-completion>
+ <allItemsProcessedWithoutBreak/>
+ </xsl:on-completion>
+ <val><xsl:value-of select="."/></val>
+ </xsl:iterate>
+ </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/xsl_iterate/test1_f.xml b/tests/xsl_iterate/test1_f.xml
new file mode 100644
index 00000000..af5ca7a3
--- /dev/null
+++ b/tests/xsl_iterate/test1_f.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<temp>
+ <loop>
+ <from>3</from>
+ <to>10</to>
+ </loop>
+ <loop from="1" to="10"/>
+</temp>
\ No newline at end of file
diff --git a/tests/xsl_iterate/test20.xsl b/tests/xsl_iterate/test20.xsl
new file mode 100644
index 00000000..6820a6c8
--- /dev/null
+++ b/tests/xsl_iterate/test20.xsl
@@ -0,0 +1,50 @@
+<?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_f.xml -->
+
+ <!-- An XSLT stylesheet, to test xsl:iterate instruction,
+ when xsl:iterate's select attribute evaluates to a
+ sequence of atomic values. -->
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <!-- A variable, referring to an XPath sequence constructor having various function items. -->
+ <xsl:variable name="fnItemsSeq" select="(function($a) { $a + 2 }, function($a) { $a - 3 },
+ function($a) { $a * 4 }, function($a) { $a div 4 })"/>
+
+ <xsl:variable name="num" select="7"/>
+
+ <xsl:template match="/">
+ <result>
+ <xsl:iterate select="$fnItemsSeq">
+ <xsl:variable name="fnItem" select="."/>
+ <!-- make a dynamic function call to respective function item,
+ and pass an argument as well to function call. -->
+ <val><xsl:value-of select="$fnItem($num)"/></val>
+ </xsl:iterate>
+ </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
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org