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/11 16:39:28 UTC

[xalan-java] branch xalan-j_xslt3.0 updated: improving the implementation of xpath 3.1 fn:filter and fn:for-each functions. also adding few new related working 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 1be96eee improving the implementation of xpath 3.1 fn:filter and fn:for-each functions. also adding few new related working test cases as well.
     new f147beb8 Merge pull request #25 from mukulga/xalan-j_xslt3.0_mukul
1be96eee is described below

commit 1be96eee58d5c316f7f1c5c6139cb69546d5ec9e
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Tue Jul 11 22:04:07 2023 +0530

    improving the implementation of xpath 3.1 fn:filter and fn:for-each functions. also adding few new related working test cases as well.
---
 src/org/apache/xpath/Expression.java              |  6 ++-
 src/org/apache/xpath/functions/FuncFilter.java    | 27 ++++++++++++-
 src/org/apache/xpath/functions/FuncForEach.java   | 38 ++++++++++++++++--
 src/org/apache/xpath/operations/Variable.java     | 11 +++++-
 tests/fn_filter/gold/test8.out                    |  5 +++
 tests/fn_filter/test1_c.xml                       | 13 +++++++
 tests/fn_filter/test8.xsl                         | 41 ++++++++++++++++++++
 tests/fn_filter/test9.xsl                         | 45 ++++++++++++++++++++++
 tests/fn_foreach/gold/test10.out                  | 11 ++++++
 tests/fn_foreach/gold/test11.out                  | 11 ++++++
 tests/fn_foreach/test11.xsl                       | 43 +++++++++++++++++++++
 tests/fn_foreach/test12.xsl                       | 47 +++++++++++++++++++++++
 tests/fn_foreach/test1_c.xml                      | 31 +++++++++++++++
 tests/inline_function_expr/test4.xsl              |  6 +--
 tests/org/apache/xalan/xpath3/FnFilterTests.java  | 20 ++++++++++
 tests/org/apache/xalan/xpath3/FnForEachTests.java | 20 ++++++++++
 16 files changed, 364 insertions(+), 11 deletions(-)

diff --git a/src/org/apache/xpath/Expression.java b/src/org/apache/xpath/Expression.java
index ac3ffa16..e13d63ca 100644
--- a/src/org/apache/xpath/Expression.java
+++ b/src/org/apache/xpath/Expression.java
@@ -26,11 +26,11 @@ import javax.xml.transform.TransformerException;
 import org.apache.xalan.res.XSLMessages;
 import org.apache.xml.dtm.DTM;
 import org.apache.xml.dtm.DTMIterator;
+import org.apache.xml.utils.QName;
 import org.apache.xml.utils.XMLString;
 import org.apache.xpath.objects.XNodeSet;
 import org.apache.xpath.objects.XObject;
 import org.apache.xpath.res.XPATHErrorResources;
-
 import org.xml.sax.ContentHandler;
 
 /**
@@ -52,6 +52,10 @@ public abstract class Expression implements java.io.Serializable, ExpressionNode
    *  @serial
    */
   private ExpressionNode m_parent;
+  
+  // to support, XPath.fixupVariables(..) action when done for XPath
+  // function item "inline function" body's XPath expression.
+  protected static QName m_inlineFnVariableName = null;
 
   /**
    * Tell if this expression or it's subexpressions can traverse outside
diff --git a/src/org/apache/xpath/functions/FuncFilter.java b/src/org/apache/xpath/functions/FuncFilter.java
index 995f47ed..c3152d3b 100644
--- a/src/org/apache/xpath/functions/FuncFilter.java
+++ b/src/org/apache/xpath/functions/FuncFilter.java
@@ -19,6 +19,7 @@ package org.apache.xpath.functions;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Vector;
 
 import javax.xml.transform.SourceLocator;
 import javax.xml.transform.TransformerException;
@@ -66,9 +67,15 @@ public class FuncFilter extends Function2Args {
 
    private static final long serialVersionUID = 2912594883291006421L;
    
-   private static final String FUNCTION_NAME = "filter()"; 
+   private static final String FUNCTION_NAME = "filter()";
+   
+   // the following two fields of this class, are used during 
+   // XPath.fixupVariables(..) action as performed within object of 
+   // this class.    
+   private Vector fVars;    
+   private int fGlobalsSize;
 
-  /**
+   /**
    * Execute the function. The function must return a valid object.
    * 
    * @param xctxt The current execution context.
@@ -154,6 +161,12 @@ public class FuncFilter extends Function2Args {
                                               XPATHErrorResources.ER_TWO, null)); //"2"
   }
   
+  public void fixupVariables(java.util.Vector vars, int globalsSize)
+  {
+      fVars = (Vector)(vars.clone());
+      fGlobalsSize = globalsSize; 
+  }
+  
   /*
    * Validate the, number of function parameters, that the inline function is allowed to have for fn:filter.
    */
@@ -222,10 +235,20 @@ public class FuncFilter extends Function2Args {
            
            while (DTM.NULL != (dtmNodeHandle = arg0DtmIterator.nextNode())) {               
                XNodeSet inpSeqItem = new XNodeSet(dtmNodeHandle, xctxt.getDTMManager());
+               
                if (varQname != null) {
                   inlineFunctionVarMap.put(varQname, inpSeqItem);
                }
                
+               if (fVars != null) {
+                  // this is used so that, 'fixupVariables' action performed below
+                  // shall work fine for function item parameter references within 
+                  // XPath expression denoted by 'inlineFnXpath'.
+                  m_inlineFnVariableName = varQname;               
+                  inlineFnXpath.fixupVariables(fVars, fGlobalsSize);               
+                  m_inlineFnVariableName = null;
+               }
+               
                XObject resultObj = inlineFnXpath.execute(xctxt, contextNode, null);
                if (resultObj instanceof XBoolean) {
                    if (((XBoolean)resultObj).bool()) {                       
diff --git a/src/org/apache/xpath/functions/FuncForEach.java b/src/org/apache/xpath/functions/FuncForEach.java
index 53b03167..72dda086 100644
--- a/src/org/apache/xpath/functions/FuncForEach.java
+++ b/src/org/apache/xpath/functions/FuncForEach.java
@@ -19,6 +19,7 @@ package org.apache.xpath.functions;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Vector;
 
 import javax.xml.transform.SourceLocator;
 import javax.xml.transform.TransformerException;
@@ -61,9 +62,15 @@ public class FuncForEach extends Function2Args {
 
    private static final long serialVersionUID = 2912594883291006421L;
    
-   private static final String FUNCTION_NAME = "for-each()"; 
+   private static final String FUNCTION_NAME = "for-each()";
+   
+   // the following two fields of this class, are used during 
+   // XPath.fixupVariables(..) action as performed within object of 
+   // this class.    
+   private Vector fVars;    
+   private int fGlobalsSize;
 
-  /**
+   /**
    * Execute the function. The function must return a valid object.
    * 
    * @param xctxt The current execution context.
@@ -87,11 +94,15 @@ public class FuncForEach extends Function2Args {
         DTMIterator arg0DtmIterator = null;
         
         XObject arg0XsObject = null;
+        
+        if (fVars != null) {
+           arg0.fixupVariables(fVars, fGlobalsSize);
+        }
                   
         if (arg0 instanceof LocPathIterator) {
             arg0DtmIterator = arg0.asIterator(xctxt, contextNode);               
         }
-        else {
+        else {            
             arg0XsObject = arg0.execute(xctxt, contextNode);
         }
         
@@ -103,6 +114,10 @@ public class FuncForEach extends Function2Args {
             resultSeq = evaluateFnForEach(xctxt, arg0XsObject, arg0DtmIterator, inlineFuncArg); 
         }
         else if (arg1 instanceof Variable) {
+            if (fVars != null) {
+               arg1.fixupVariables(fVars, fGlobalsSize);
+            }
+            
             XObject arg1VarValue = arg1.execute(xctxt);
             if (arg1VarValue instanceof InlineFunction) {
                 InlineFunction inlineFuncArg = (InlineFunction)arg1VarValue;
@@ -149,6 +164,12 @@ public class FuncForEach extends Function2Args {
                                               XPATHErrorResources.ER_TWO, null)); //"2"
   }
   
+  public void fixupVariables(java.util.Vector vars, int globalsSize)
+  {
+      fVars = (Vector)(vars.clone());
+      fGlobalsSize = globalsSize; 
+  }
+  
   /*
    * Validate the, number of function parameters, that the inline function is allowed to have for fn:for-each.
    */
@@ -193,7 +214,7 @@ public class FuncForEach extends Function2Args {
                if (varQname != null) {
                   inlineFunctionVarMap.put(varQname, inpSeqItem);
                }
-        
+               
                XObject resultObj = inlineFnXpath.execute(xpathContextNew, DTM.NULL, null);
                resultSeq.add(resultObj);
            }
@@ -213,6 +234,15 @@ public class FuncForEach extends Function2Args {
                   inlineFunctionVarMap.put(varQname, inpSeqItem);
                }
                
+               if (fVars != null) {
+                  // this is used so that, 'fixupVariables' action performed below
+                  // shall work fine for function item parameter references within 
+                  // XPath expression denoted by 'inlineFnXpath'.
+                  m_inlineFnVariableName = varQname;
+                  inlineFnXpath.fixupVariables(fVars, fGlobalsSize);               
+                  m_inlineFnVariableName = null;
+               }
+               
                XObject resultObj = inlineFnXpath.execute(xctxt, contextNode, null);
                
                resultSeq.add(resultObj);
diff --git a/src/org/apache/xpath/operations/Variable.java b/src/org/apache/xpath/operations/Variable.java
index eb8b1b47..248c5f0c 100644
--- a/src/org/apache/xpath/operations/Variable.java
+++ b/src/org/apache/xpath/operations/Variable.java
@@ -142,6 +142,15 @@ public class Variable extends Expression implements PathComponent
       }
     }
     
+    if (m_qname.equals(m_inlineFnVariableName)) {
+       // the variable reference denoted by m_qname within XPath expression,
+       // when it refers to the function item's parameter name, is not stored
+       // within XPath context's variable stack, but this action still needs
+       // to be done so that, function item's parameter reference within XPath
+       // expression is not treated as unrecognized variable. 
+       return;    
+    }
+    
     java.lang.String msg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_COULD_NOT_FIND_VAR, 
                                              new Object[]{m_qname.toString()});
                                              
@@ -213,7 +222,7 @@ public class Variable extends Expression implements PathComponent
     XObject inlineFuncVarValue = inlineFunctionVarMap.get(m_qname);
     
     if (inlineFuncVarValue != null) {
-        // dereferencing, XPath 3.1 function item "inline function" 
+        // dereference, XPath 3.1 function item "inline function" 
         // parameter reference within "inline function" body.
         if (inlineFuncVarValue instanceof XNodeSet) {
            result = ((XNodeSet)inlineFuncVarValue).getFresh();    
diff --git a/tests/fn_filter/gold/test8.out b/tests/fn_filter/gold/test8.out
new file mode 100644
index 00000000..9b160c2d
--- /dev/null
+++ b/tests/fn_filter/gold/test8.out
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <item ok="yes" weight="7">G</item>
+  <item ok="yes" weight="9">I</item>
+  <item ok="yes" weight="10">J</item>
+</result>
diff --git a/tests/fn_filter/test1_c.xml b/tests/fn_filter/test1_c.xml
new file mode 100644
index 00000000..632f025e
--- /dev/null
+++ b/tests/fn_filter/test1_c.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<elem>
+   <item weight="1" ok="yes">A</item>
+   <item weight="2" ok="yes">B</item>
+   <item weight="3" ok="yes">C</item>
+   <item weight="4" ok="no">D</item>
+   <item weight="5" ok="yes">E</item>
+   <item weight="6" ok="no">F</item>
+   <item weight="7" ok="yes">G</item>
+   <item weight="8" ok="no">H</item>
+   <item weight="9" ok="yes">I</item>
+   <item weight="10" ok="yes">J</item>
+</elem>
\ No newline at end of file
diff --git a/tests/fn_filter/test8.xsl b/tests/fn_filter/test8.xsl
new file mode 100644
index 00000000..8376a740
--- /dev/null
+++ b/tests/fn_filter/test8.xsl
@@ -0,0 +1,41 @@
+<?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 -->
+   
+   <!-- Test for the XPath 3.1 fn:filter() function. Within this 
+        stylesheet example, we're passing XML element node with a sub 
+        structure, as an argument to an XPath function item. -->                
+
+   <xsl:output method="xml" indent="yes"/>   
+
+   <xsl:template match="/elem">
+      <result>
+        <xsl:variable name="filteredElems" select="filter(item, function($item) { (number($item/@weight) gt 5) and 
+                                                                                                    ($item/@ok eq 'yes') })"/>
+        <xsl:copy-of select="$filteredElems"/>
+      </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/fn_filter/test9.xsl b/tests/fn_filter/test9.xsl
new file mode 100644
index 00000000..db79dc2b
--- /dev/null
+++ b/tests/fn_filter/test9.xsl
@@ -0,0 +1,45 @@
+<?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 -->
+   
+   <!-- Test for the XPath 3.1 fn:filter() function. Within this 
+        stylesheet example, we're passing XML element node with a sub 
+        structure, as an argument to an XPath function item. The
+        function item's XPath expression also refers to a stylesheet
+        variable defined with XSLT xsl:variable instruction. -->                
+
+   <xsl:output method="xml" indent="yes"/>
+   
+   <xsl:variable name="wtThreshold" select="5"/>   
+
+   <xsl:template match="/elem">
+      <result>        
+        <xsl:variable name="filteredElems" select="filter(item, function($item) { (number($item/@weight) gt $wtThreshold) and 
+                                                                                       ($item/@ok eq 'yes') })"/>
+        <xsl:copy-of select="$filteredElems"/>
+      </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/fn_foreach/gold/test10.out b/tests/fn_foreach/gold/test10.out
new file mode 100644
index 00000000..143bdc4d
--- /dev/null
+++ b/tests/fn_foreach/gold/test10.out
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <trfItems>
+    <item>hello 1_there 1</item>
+    <item>hello 2_there 2</item>
+    <item>hello 3_there 3</item>
+    <item>hello 4_there 4</item>
+    <item>hello 5_there 5</item>
+    <item>hello 6_there 6</item>
+    <item>hello 7_there 7</item>
+  </trfItems>
+</result>
diff --git a/tests/fn_foreach/gold/test11.out b/tests/fn_foreach/gold/test11.out
new file mode 100644
index 00000000..adcb24f2
--- /dev/null
+++ b/tests/fn_foreach/gold/test11.out
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <trfItems>
+    <item>xslt : hello 1_there 1</item>
+    <item>xslt : hello 2_there 2</item>
+    <item>xslt : hello 3_there 3</item>
+    <item>xslt : hello 4_there 4</item>
+    <item>xslt : hello 5_there 5</item>
+    <item>xslt : hello 6_there 6</item>
+    <item>xslt : hello 7_there 7</item>
+  </trfItems>
+</result>
diff --git a/tests/fn_foreach/test11.xsl b/tests/fn_foreach/test11.xsl
new file mode 100644
index 00000000..fae8cec8
--- /dev/null
+++ b/tests/fn_foreach/test11.xsl
@@ -0,0 +1,43 @@
+<?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 -->
+   
+   <!-- Test for the XPath 3.1 fn:for-each() function. Within this 
+        stylesheet example, we're passing XML element node with a sub 
+        structure, as an argument to an XPath function item. -->
+   
+   <xsl:output method="xml" indent="yes"/>
+
+   <xsl:template match="/elem">
+      <result>
+        <trfItems>
+	       <xsl:for-each select="for-each(item, function($item) { concat($item/a, '_', $item/b) })">
+	          <item><xsl:value-of select="."/></item>
+	       </xsl:for-each>
+        </trfItems>
+      </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/fn_foreach/test12.xsl b/tests/fn_foreach/test12.xsl
new file mode 100644
index 00000000..b3275022
--- /dev/null
+++ b/tests/fn_foreach/test12.xsl
@@ -0,0 +1,47 @@
+<?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 -->
+   
+   <!-- Test for the XPath 3.1 fn:for-each() function. Within this 
+        stylesheet example, we're passing XML element node with a sub 
+        structure, as an argument to an XPath function item. The
+        function item's XPath expression also refers to a stylesheet
+        variable defined with XSLT xsl:variable instruction. -->
+   
+   <xsl:output method="xml" indent="yes"/>
+   
+   <xsl:variable name="id" select="'xslt'"/>
+
+   <xsl:template match="/elem">
+      <result>
+        <trfItems>
+	       <xsl:for-each select="for-each(item, function($item) { concat($id, ' : ', $item/a, '_', $item/b) })">
+	          <item><xsl:value-of select="."/></item>
+	       </xsl:for-each>
+        </trfItems>
+      </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/fn_foreach/test1_c.xml b/tests/fn_foreach/test1_c.xml
new file mode 100644
index 00000000..01a97550
--- /dev/null
+++ b/tests/fn_foreach/test1_c.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<elem>
+   <item>
+     <a>hello 1</a>
+     <b>there 1</b>
+   </item>
+   <item>
+     <a>hello 2</a>
+     <b>there 2</b>
+   </item>
+   <item>
+     <a>hello 3</a>
+     <b>there 3</b>
+   </item>
+   <item>
+     <a>hello 4</a>
+     <b>there 4</b>
+   </item>
+   <item>
+     <a>hello 5</a>
+     <b>there 5</b>
+   </item>
+   <item>
+     <a>hello 6</a>
+     <b>there 6</b>
+   </item>
+   <item>
+     <a>hello 7</a>
+     <b>there 7</b>
+   </item>
+</elem>
\ No newline at end of file
diff --git a/tests/inline_function_expr/test4.xsl b/tests/inline_function_expr/test4.xsl
index ae0766bc..150ddde9 100644
--- a/tests/inline_function_expr/test4.xsl
+++ b/tests/inline_function_expr/test4.xsl
@@ -43,9 +43,9 @@
 	        <xsl:copy-of select="for-each(filter(list/idx, $func5), function($x) { $x * 2 })"/>
 	     </six>
 	     <seven>
-	         <xsl:apply-templates select="list/idx">
-	            <xsl:with-param name="funcA" select="function($x) { $x * 2 }"/>
-	         </xsl:apply-templates>
+	        <xsl:apply-templates select="list/idx">
+	           <xsl:with-param name="funcA" select="function($x) { $x * 2 }"/>
+	        </xsl:apply-templates>
 	     </seven>
       </result>
    </xsl:template>
diff --git a/tests/org/apache/xalan/xpath3/FnFilterTests.java b/tests/org/apache/xalan/xpath3/FnFilterTests.java
index c322935f..c0271472 100644
--- a/tests/org/apache/xalan/xpath3/FnFilterTests.java
+++ b/tests/org/apache/xalan/xpath3/FnFilterTests.java
@@ -119,5 +119,25 @@ public class FnFilterTests extends XslTransformTestsUtil {
         
         runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
     }
+    
+    @Test
+    public void xslFnFilterTest8() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_c.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test8.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test8.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslFnFilterTest9() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_c.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test9.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test8.out";                
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
 
 }
diff --git a/tests/org/apache/xalan/xpath3/FnForEachTests.java b/tests/org/apache/xalan/xpath3/FnForEachTests.java
index 9ecd7584..e59e62a5 100644
--- a/tests/org/apache/xalan/xpath3/FnForEachTests.java
+++ b/tests/org/apache/xalan/xpath3/FnForEachTests.java
@@ -149,5 +149,25 @@ public class FnForEachTests extends XslTransformTestsUtil {
         runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, 
                                                             new XslTestsErrorHandler());
     }
+    
+    @Test
+    public void xslFnForEachTest11() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_c.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test11.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test10.out";
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslFnForEachTest12() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1_c.xml"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test12.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test11.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