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 2026/04/15 11:49:07 UTC

(xalan-java) branch xalan-j_xslt3.0_mvn updated: committing xalan-j xslt 3.0 implementation for invoking xsl transformation using an xsl initial function

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 696b579ba committing xalan-j xslt 3.0 implementation for invoking xsl transformation using an xsl initial function
696b579ba is described below

commit 696b579bab779503bf4beeb8bceabd5e3aa7e1e5
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Wed Apr 15 17:18:49 2026 +0530

    committing xalan-j xslt 3.0 implementation for invoking xsl transformation using an xsl initial function
---
 README                                             |   8 +-
 .../apache/xalan/processor/StylesheetHandler.java  |   3 +-
 .../processor/XSL3TransformerFactoryImpl.java      |  12 ++-
 .../apache/xalan/transformer/TransformerImpl.java  |  28 ++++-
 .../xalan/tests/main/XalanXsl3TestSuite2.java      |   3 +-
 .../xalan/tests/util/XslTransformTestsUtil.java    |  13 ++-
 .../xalan/tests/xslt3/XslInitialFunctionTests.java | 113 +++++++++++++++++++++
 .../resources/xsl_initial_function/gold/test1.out  |   1 +
 .../resources/xsl_initial_function/gold/test2.out  |  12 +++
 src/test/resources/xsl_initial_function/test1.xsl  |  36 +++++++
 src/test/resources/xsl_initial_function/test2.xsl  |  40 ++++++++
 src/test/resources/xsl_initial_function/test3.xsl  |  43 ++++++++
 src/test/resources/xsl_initial_function/test4.xsl  |  47 +++++++++
 src/test/resources/xsl_initial_function/test5.xsl  |  49 +++++++++
 14 files changed, 397 insertions(+), 11 deletions(-)

diff --git a/README b/README
index c0975edd1..df268005f 100644
--- a/README
+++ b/README
@@ -17,7 +17,7 @@
 
 Copyright 1999-2026 The Apache Software Foundation
 
-Document last modified : 2026-04-14
+Document last modified : 2026-04-15
 
 Authors:
         Gary Gregory <gg...@apache.org>
@@ -98,16 +98,16 @@ When this Maven build command is run, results like following shall be produced:
 [INFO]  T E S T S
 [INFO] -------------------------------------------------------
 [INFO] Running org.apache.xalan.tests.main.XalanXsl3TestSuite2
-[INFO] Tests run: 526, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 14.101 s - in org.apache.xalan.tests.main.XalanXsl3TestSuite2
+[INFO] Tests run: 531, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 17.777 s - in org.apache.xalan.tests.main.XalanXsl3TestSuite2
 [INFO]
 [INFO] Results:
 [INFO]
-[INFO] Tests run: 526, Failures: 0, Errors: 0, Skipped: 0
+[INFO] Tests run: 531, Failures: 0, Errors: 0, Skipped: 0
 
 [INFO] ------------------------------------------------------------------------
 [INFO] BUILD SUCCESS
 [INFO] ------------------------------------------------------------------------
-[INFO] Total time:  43.170 s
+[INFO] Total time:  47.006 s
 
 4) This code base repos branch also has Xalan Java's XSLT 3.0 test drivers for W3C XSLT 3.0 test suite (located at, 
 https://github.com/w3c/xslt30-test).
diff --git a/src/main/java/org/apache/xalan/processor/StylesheetHandler.java b/src/main/java/org/apache/xalan/processor/StylesheetHandler.java
index d82aee566..fb33e5569 100644
--- a/src/main/java/org/apache/xalan/processor/StylesheetHandler.java
+++ b/src/main/java/org/apache/xalan/processor/StylesheetHandler.java
@@ -1248,9 +1248,10 @@ public class StylesheetHandler extends DefaultHandler
 	  XslTransformData.m_stylesheetRoot = m_stylesheetRoot;
 	  XslTransformData.m_xslSystemId = getSystemId();
 	  
-	  m_stylesheetRoot.setInitTemplateName(m_init_template_name);
+	  m_stylesheetRoot.setInitTemplateName(m_init_template_name);	  
 	  m_stylesheetRoot.setInitModeName(m_init_mode_name);
 	  m_stylesheetRoot.setAssertEnabled(m_assert);
+	  m_stylesheetRoot.setInitFunctionName(m_init_function_name);
 	  m_stylesheetRoot.setInitialContextNode(m_initial_context_node);
 
 	  return m_stylesheetRoot;
diff --git a/src/main/java/org/apache/xalan/processor/XSL3TransformerFactoryImpl.java b/src/main/java/org/apache/xalan/processor/XSL3TransformerFactoryImpl.java
index 3da8b5a70..7012f643b 100644
--- a/src/main/java/org/apache/xalan/processor/XSL3TransformerFactoryImpl.java
+++ b/src/main/java/org/apache/xalan/processor/XSL3TransformerFactoryImpl.java
@@ -616,7 +616,17 @@ public class XSL3TransformerFactoryImpl extends SAXTransformerFactory
 	  }
 	  else if (name.equals(FEATURE_INIT_FUNCTION))
 	  {
-		  m_init_function_name = (QName)value; 
+		  if (value != null) {
+			  String init_func_name = (String)value;
+			  int i1 = init_func_name.indexOf('{');
+			  int i2 = init_func_name.indexOf('}');
+			  int length1 = init_func_name.length(); 
+			  if ((i1 == 0) && (i2 > i1) && (length1 > (i2 + 1))) {
+				  String namespace = init_func_name.substring(i1 + 1, i2);
+				  String localName = init_func_name.substring(i2 + 1);			 
+				  m_init_function_name = new QName(namespace, localName);
+			  }
+		  }
 	  }
 	  else if (name.equals("initial-context-node")) {
 		  m_initial_context_node_available = (Boolean)value; 
diff --git a/src/main/java/org/apache/xalan/transformer/TransformerImpl.java b/src/main/java/org/apache/xalan/transformer/TransformerImpl.java
index 09d93bb2d..490842d4a 100644
--- a/src/main/java/org/apache/xalan/transformer/TransformerImpl.java
+++ b/src/main/java/org/apache/xalan/transformer/TransformerImpl.java
@@ -933,8 +933,8 @@ public class TransformerImpl extends Transformer implements Runnable, DTMWSFilte
     	  }
     	  else if ((m_init_template_name != null) || (m_init_mode_name != null) || (m_init_function_name != null)) {
     		  /**
-    		   * An XSL stylesheet 'initial template' or 'mode' name is 
-    		   * available, but context node is not available.
+    		   * An XSL stylesheet 'initial template', 'mode' name or 'initial function' is 
+    		   * available, but XSL transformation initial context node is not available.
     		   */
     		  this.transformNode(DTM.NULL);
     	  }
@@ -2541,6 +2541,8 @@ public class TransformerImpl extends Transformer implements Runnable, DTMWSFilte
     
     String initTemplateName = m_stylesheetRoot.getInitTemplateName();
     
+    QName initFunctionName = m_stylesheetRoot.getInitFunctionName();
+    
     isApplyImports = ((xslInstruction == null)
                                 ? false
                                 : xslInstruction.getXSLToken()
@@ -2674,7 +2676,27 @@ public class TransformerImpl extends Transformer implements Runnable, DTMWSFilte
              else {
             	 throw new TransformerException("XTDE0040 : An XSL template named '" + initTemplateName + "' doesn't exist."); 
              }                          
-          }          
+          }
+          else if (initFunctionName != null) {
+        	 ElemFunction elemFunction = m_stylesheetRoot.getXslFunction(initFunctionName, 0);
+        	 ResultSequence argSequence = new ResultSequence();
+        	 XObject funcResult = elemFunction.evaluateXslFunction(this, argSequence);
+        	 ResultSequence seqForResult = new ResultSequence();
+        	 seqForResult.add(funcResult);
+        	 try {
+				ElemCopyOf.copyOfActionOnResultSequence(seqForResult, this, m_serializationHandler, xctxt, false, template);
+			 } 
+        	 catch (TransformerException ex) {
+                throw ex;
+			 } 
+        	 catch (SAXException ex) {
+                String errMesg = ex.getMessage();
+                SourceLocator srcLocator = xctxt.getSAXLocator();
+                throw new TransformerException(errMesg, srcLocator); 
+			 }
+        	 
+        	 return true;
+          }
           else {
         	  QName mode = null;        	  
         	  if (m_init_mode_name != null) {
diff --git a/src/test/java/org/apache/xalan/tests/main/XalanXsl3TestSuite2.java b/src/test/java/org/apache/xalan/tests/main/XalanXsl3TestSuite2.java
index 19c903ce3..297426167 100644
--- a/src/test/java/org/apache/xalan/tests/main/XalanXsl3TestSuite2.java
+++ b/src/test/java/org/apache/xalan/tests/main/XalanXsl3TestSuite2.java
@@ -79,6 +79,7 @@ import org.apache.xalan.tests.xslt3.XslForkTests;
 import org.apache.xalan.tests.xslt3.XslFunctionMiscTests;
 import org.apache.xalan.tests.xslt3.XslIncludeMiscTests;
 import org.apache.xalan.tests.xslt3.XslIncludeTests;
+import org.apache.xalan.tests.xslt3.XslInitialFunctionTests;
 import org.apache.xalan.tests.xslt3.XslInitialTemplateTests;
 import org.apache.xalan.tests.xslt3.XslJsonValidationTests;
 import org.apache.xalan.tests.xslt3.XslLinearRegressionTests;
@@ -136,7 +137,7 @@ import org.junit.runners.Suite.SuiteClasses;
                 XslDisableOutputEscapingAttrTests.class, FnAdjustDatetimeToTimezoneTests.class,
                 FnAdjustDateToTimezoneTests.class, FnAdjustTimeToTimezoneTests.class, FnFormatIntegerTests.class, XslPerformSortTests.class,
                 XslPackageTests.class, XslUseWhenTests.class, XslLinearRegressionTests.class, XslNextMatchTests.class,
-                XslUseAttributeSetsTests.class })
+                XslUseAttributeSetsTests.class, XslInitialFunctionTests.class })
 public class XalanXsl3TestSuite2 {
 
 }
diff --git a/src/test/java/org/apache/xalan/tests/util/XslTransformTestsUtil.java b/src/test/java/org/apache/xalan/tests/util/XslTransformTestsUtil.java
index 4dc845149..3588b04e9 100644
--- a/src/test/java/org/apache/xalan/tests/util/XslTransformTestsUtil.java
+++ b/src/test/java/org/apache/xalan/tests/util/XslTransformTestsUtil.java
@@ -107,7 +107,9 @@ public class XslTransformTestsUtil extends FileComparisonUtil {
     
     protected static String m_initTemplateName = null;
     
-    protected static String m_initModeName = null;
+    protected static String m_initFunctionName = null;
+    
+    protected static String m_initModeName = null;        
     
     protected static String m_xsl_test_dir_base_uri = null;
     
@@ -137,6 +139,10 @@ public class XslTransformTestsUtil extends FileComparisonUtil {
         	   m_xslTransformerFactory.setAttribute(XalanProperties.INIT_TEMPLATE, m_initTemplateName); 
            }
            
+           if (m_initFunctionName != null) {
+        	   m_xslTransformerFactory.setAttribute(XalanProperties.INIT_FUNCTION, m_initFunctionName); 
+           }
+           
            if (m_initModeName != null) {
         	   m_xslTransformerFactory.setAttribute(XalanProperties.INIT_MODE, m_initModeName); 
            }
@@ -246,6 +252,11 @@ public class XslTransformTestsUtil extends FileComparisonUtil {
         		m_initTemplateName = null;
         	}
         	
+        	if (m_initFunctionName != null) {
+        		m_xslTransformerFactory.setAttribute(XalanProperties.INIT_FUNCTION, null);
+        		m_initFunctionName = null;
+        	}
+        	
         	if (m_initModeName != null) {
         		m_xslTransformerFactory.setAttribute(XalanProperties.INIT_MODE, null);
         		m_initModeName = null;
diff --git a/src/test/java/org/apache/xalan/tests/xslt3/XslInitialFunctionTests.java b/src/test/java/org/apache/xalan/tests/xslt3/XslInitialFunctionTests.java
new file mode 100644
index 000000000..59709919a
--- /dev/null
+++ b/src/test/java/org/apache/xalan/tests/xslt3/XslInitialFunctionTests.java
@@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+package org.apache.xalan.tests.xslt3;
+
+import org.apache.xalan.tests.util.XSLTestConstants;
+import org.apache.xalan.tests.util.XslTransformTestsUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * XSL 3 stylesheet test cases, to test XSL transformation with 
+ * specified initial function.
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class XslInitialFunctionTests extends XslTransformTestsUtil {        
+    
+    private static final String XSL_TRANSFORM_INPUT_DIRPATH = XSLTestConstants.XSL_TRANSFORM_INPUT_DIRPATH_PREFIX + "xsl_initial_function/";
+    
+    private static final String XSL_TRANSFORM_GOLD_DIRPATH = XSLTestConstants.XSL_TRANSFORM_GOLD_DIRPATH_PREFIX + "xsl_initial_function/gold/";
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+        // no op
+    }
+
+    @AfterClass
+    public static void tearDownAfterClass() throws Exception {        
+        m_xmlDocumentBuilderFactory = null;
+        m_xmlDocumentBuilder = null;
+        m_xslTransformerFactory = null;
+    }
+
+    @Test
+    public void xslInitialFunctionTest1() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test1.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test1.out";
+        
+        m_fileComparisonType = XSLTestConstants.TEXT;
+        
+        m_initFunctionName = "{http://fn0}func1";
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslInitialFunctionTest2() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test2.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test2.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test2.out";
+        
+        m_initFunctionName = "{http://fn0}func1";
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslInitialFunctionTest3() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test3.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test3.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test2.out";
+        
+        m_initFunctionName = "{http://fn0}func1";
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslInitialFunctionTest4() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test4.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test4.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test2.out";
+        
+        m_initFunctionName = "{http://fn0}func1";
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+    
+    @Test
+    public void xslInitialFunctionTest5() {
+        String xmlFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test5.xsl"; 
+        String xslFilePath = XSL_TRANSFORM_INPUT_DIRPATH + "test5.xsl";
+        
+        String goldFilePath = XSL_TRANSFORM_GOLD_DIRPATH + "test2.out";
+        
+        m_initFunctionName = "{http://fn0}func1";
+        
+        runXslTransformAndAssertOutput(xmlFilePath, xslFilePath, goldFilePath, null);
+    }
+
+}
diff --git a/src/test/resources/xsl_initial_function/gold/test1.out b/src/test/resources/xsl_initial_function/gold/test1.out
new file mode 100644
index 000000000..b6fc4c620
--- /dev/null
+++ b/src/test/resources/xsl_initial_function/gold/test1.out
@@ -0,0 +1 @@
+hello
\ No newline at end of file
diff --git a/src/test/resources/xsl_initial_function/gold/test2.out b/src/test/resources/xsl_initial_function/gold/test2.out
new file mode 100644
index 000000000..cc9efb2fb
--- /dev/null
+++ b/src/test/resources/xsl_initial_function/gold/test2.out
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?><result>
+  <hello id="1"/>
+  <hello id="2"/>
+  <hello id="3"/>
+  <hello id="4"/>
+  <hello id="5"/>
+  <hello id="6"/>
+  <hello id="7"/>
+  <hello id="8"/>
+  <hello id="9"/>
+  <hello id="10"/>
+</result>
diff --git a/src/test/resources/xsl_initial_function/test1.xsl b/src/test/resources/xsl_initial_function/test1.xsl
new file mode 100644
index 000000000..9db382424
--- /dev/null
+++ b/src/test/resources/xsl_initial_function/test1.xsl
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="3.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+				xmlns:fn0="http://fn0"
+				exclude-result-prefixes="fn0">
+				
+    <!-- Author: mukulg@apache.org -->                
+   
+    <!-- An XSL 3 stylesheet test case, to test XSL transformation with 
+         an initial named function. -->				
+
+	<xsl:output method="text"/>
+
+	<xsl:function name="fn0:func1">
+       <xsl:sequence select="'hello'"/>	   
+	</xsl:function>
+	
+	<!--
+      * 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/src/test/resources/xsl_initial_function/test2.xsl b/src/test/resources/xsl_initial_function/test2.xsl
new file mode 100644
index 000000000..91bd79cbd
--- /dev/null
+++ b/src/test/resources/xsl_initial_function/test2.xsl
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="3.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+				xmlns:fn0="http://fn0"
+				exclude-result-prefixes="fn0">
+				
+    <!-- Author: mukulg@apache.org -->                
+   
+    <!-- An XSL 3 stylesheet test case, to test XSL transformation with 
+         an initial named function. -->					
+
+	<xsl:output method="xml" indent="yes"/>
+
+	<xsl:function name="fn0:func1">
+	   <result>
+          <xsl:for-each select="1 to 10">
+             <hello id="{position()}"/>
+          </xsl:for-each>
+       </result>	   
+	</xsl:function>
+	
+	<!--
+      * 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/src/test/resources/xsl_initial_function/test3.xsl b/src/test/resources/xsl_initial_function/test3.xsl
new file mode 100644
index 000000000..2fdf7627a
--- /dev/null
+++ b/src/test/resources/xsl_initial_function/test3.xsl
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="3.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+				xmlns:fn0="http://fn0"
+				exclude-result-prefixes="fn0">
+				
+    <!-- Author: mukulg@apache.org -->                
+   
+    <!-- An XSL 3 stylesheet test case, to test XSL transformation with 
+         an initial named function. -->					
+
+	<xsl:output method="xml" indent="yes"/>
+	
+	<xsl:variable name="n0" select="1"/>
+	<xsl:variable name="n1" select="10"/>
+
+	<xsl:function name="fn0:func1">       	
+	   <result>
+          <xsl:for-each select="$n0 to $n1">
+             <hello id="{position()}"/>
+          </xsl:for-each>
+       </result>	   
+	</xsl:function>
+	
+	<!--
+      * 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/src/test/resources/xsl_initial_function/test4.xsl b/src/test/resources/xsl_initial_function/test4.xsl
new file mode 100644
index 000000000..2b7f44067
--- /dev/null
+++ b/src/test/resources/xsl_initial_function/test4.xsl
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="3.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+				xmlns:fn0="http://fn0"
+				exclude-result-prefixes="fn0">
+				
+    <!-- Author: mukulg@apache.org -->                
+   
+    <!-- An XSL 3 stylesheet test case, to test XSL transformation with 
+         an initial named function. -->				
+
+	<xsl:output method="xml" indent="yes"/>
+	
+	<xsl:variable name="n0" select="1"/>
+	<xsl:variable name="n1" select="10"/>
+
+	<xsl:function name="fn0:func1">       	
+	   <result>
+          <xsl:call-template name="XmlFragmentResult"/>
+       </result>	   
+	</xsl:function>
+	
+	<xsl:template name="XmlFragmentResult">
+	   <xsl:for-each select="$n0 to $n1">
+          <hello id="{position()}"/>
+       </xsl:for-each>
+	</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/src/test/resources/xsl_initial_function/test5.xsl b/src/test/resources/xsl_initial_function/test5.xsl
new file mode 100644
index 000000000..d277c3a9f
--- /dev/null
+++ b/src/test/resources/xsl_initial_function/test5.xsl
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="3.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+				xmlns:fn0="http://fn0"
+				exclude-result-prefixes="fn0">
+				
+    <!-- Author: mukulg@apache.org -->                
+   
+    <!-- An XSL 3 stylesheet test case, to test XSL transformation with 
+         an initial named function. -->				
+
+	<xsl:output method="xml" indent="yes"/>
+
+	<xsl:function name="fn0:func1">       	
+	   <result>
+          <xsl:call-template name="XmlFragmentResult">
+		     <xsl:with-param name="n0" select="1"/>
+			 <xsl:with-param name="n1" select="10"/>
+		  </xsl:call-template>
+       </result>	   
+	</xsl:function>
+	
+	<xsl:template name="XmlFragmentResult">
+	   <xsl:param name="n0"/>
+	   <xsl:param name="n1"/>
+	   <xsl:for-each select="$n0 to $n1">
+          <hello id="{position()}"/>
+       </xsl:for-each>
+	</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