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/02/06 11:44:29 UTC

(xalan-java) branch xalan-j_xslt3.0_mvn updated: committing xalan-j xslt 3.0 xsl:package instruction implementation

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 ad10d4aa6 committing xalan-j xslt 3.0 xsl:package instruction implementation
ad10d4aa6 is described below

commit ad10d4aa63237987a781cdab31803b853606c756
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Fri Feb 6 17:14:11 2026 +0530

    committing xalan-j xslt 3.0 xsl:package instruction implementation
---
 ...etElement.java => ProcessorPackageElement.java} | 147 ++++++++++-----------
 .../xalan/processor/ProcessorStylesheetDoc.java    |   8 +-
 .../processor/ProcessorStylesheetElement.java      |   5 +-
 .../org/apache/xalan/processor/XSLTSchema.java     |  35 ++++-
 .../org/apache/xalan/templates/ElemTemplate.java   |  12 ++
 .../org/apache/xalan/templates/Stylesheet.java     |  57 ++++++++
 .../apache/xalan/transformer/TransformerImpl.java  |  17 ++-
 .../xalan/tests/util/XslTransformTestsUtil.java    |  32 -----
 .../xalan/tests/w3c/xslt3/W3CXSLT3Tests.java       |   3 +-
 .../tests/w3c/xslt3/W3CXslTransformTestsUtil.java  |  36 +++--
 .../tests/w3c/xslt3/decl/XslPackageTests.java      |  54 ++++++++
 .../xslt3/result/attr/_mode-test-set_result.xml    |  99 ++++++++++----
 .../xslt3/result/decl/_package-test-set_result.xml |  13 ++
 .../result/w3c_xslt3_testsuite_xalan-j_result.xml  |   5 +-
 src/test/resources/xsl_function/gold/test28.out    |   2 +-
 src/test/resources/xsl_function/gold/test29.out    |   2 +-
 src/test/resources/xsl_function/gold/test30.out    |   4 +-
 src/test/resources/xsl_function/test28.xsl         |  25 ++--
 src/test/resources/xsl_function/test29.xsl         |  25 ++--
 src/test/resources/xsl_function/test30.xsl         |  27 ++--
 20 files changed, 395 insertions(+), 213 deletions(-)

diff --git a/src/main/java/org/apache/xalan/processor/ProcessorStylesheetElement.java b/src/main/java/org/apache/xalan/processor/ProcessorPackageElement.java
similarity index 50%
copy from src/main/java/org/apache/xalan/processor/ProcessorStylesheetElement.java
copy to src/main/java/org/apache/xalan/processor/ProcessorPackageElement.java
index bfc9f75f5..72d229755 100644
--- a/src/main/java/org/apache/xalan/processor/ProcessorStylesheetElement.java
+++ b/src/main/java/org/apache/xalan/processor/ProcessorPackageElement.java
@@ -15,9 +15,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id$
- */
 package org.apache.xalan.processor;
 
 import javax.xml.transform.TransformerConfigurationException;
@@ -29,15 +26,15 @@ import org.apache.xalan.templates.StylesheetRoot;
 import org.xml.sax.Attributes;
 
 /**
- * TransformerFactory for xsl:stylesheet or xsl:transform markup.
- * @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
- * @see <a href="http://www.w3.org/TR/xslt#stylesheet-element">stylesheet-element in XSLT Specification</a>
+ * TransformerFactory for xsl:package markup.
+ * @see <a href="https://www.w3.org/TR/xslt-30/#element-package">package-element within XSLT specification</a>
  * 
  * @xsl.usage internal
  */
-public class ProcessorStylesheetElement extends XSLTElementProcessor
+public class ProcessorPackageElement extends XSLTElementProcessor
 {
-    static final long serialVersionUID = -877798927447840792L;
+
+  private static final long serialVersionUID = 3952244172949248100L;
 
   /**
    * Receive notification of the start of an strip-space element.
@@ -55,79 +52,79 @@ public class ProcessorStylesheetElement extends XSLTElementProcessor
    *        there are no attributes, it shall be an empty
    *        Attributes object.
    */
-  public void startElement(
-          StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)
-            throws org.xml.sax.SAXException
+  public void startElement(StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)
+            																											throws org.xml.sax.SAXException
   {
 
-		super.startElement(handler, uri, localName, rawName, attributes);
-    try
-    {
-      int stylesheetType = handler.getStylesheetType();
-      Stylesheet stylesheet;
-
-      if (stylesheetType == StylesheetHandler.STYPE_ROOT)
-      {
-        try
-        {
-          stylesheet = getStylesheetRoot(handler);
-        }
-        catch(TransformerConfigurationException tfe)
-        {
-          throw new TransformerException(tfe);
-        }
-      }
-      else
-      {
-        Stylesheet parent = handler.getStylesheet();
-
-        if (stylesheetType == StylesheetHandler.STYPE_IMPORT)
-        {
-          StylesheetComposed sc = new StylesheetComposed(parent);
-
-          parent.setImport(sc);
-
-          stylesheet = sc;
-        }
-        else
-        {
-          stylesheet = new Stylesheet(parent);
-
-          parent.setInclude(stylesheet);
-        }
-      }
-
-      stylesheet.setDOMBackPointer(handler.getOriginatingNode());
-      stylesheet.setLocaterInfo(handler.getLocator());
-
-      stylesheet.setPrefixes(handler.getNamespaceSupport());
-      handler.pushStylesheet(stylesheet);
-      setPropertiesFromAttributes(handler, rawName, attributes,
-                                  handler.getStylesheet());
-      handler.pushElemTemplateElement(handler.getStylesheet());
-    }
-    catch(TransformerException te)
-    {
-      throw new org.xml.sax.SAXException(te);
-    }
+	  super.startElement(handler, uri, localName, rawName, attributes);
+	  
+	  try
+	  {
+		  int stylesheetType = handler.getStylesheetType();
+		  Stylesheet stylesheet;
+
+		  if (stylesheetType == StylesheetHandler.STYPE_ROOT)
+		  {
+			  try
+			  {
+				  stylesheet = getStylesheetRoot(handler);
+			  }
+			  catch(TransformerConfigurationException tfe)
+			  {
+				  throw new TransformerException(tfe);
+			  }
+		  }
+		  else
+		  {
+			  Stylesheet parent = handler.getStylesheet();
+
+			  if (stylesheetType == StylesheetHandler.STYPE_IMPORT)
+			  {
+				  StylesheetComposed sc = new StylesheetComposed(parent);
+
+				  parent.setImport(sc);
+
+				  stylesheet = sc;
+			  }
+			  else
+			  {
+				  stylesheet = new Stylesheet(parent);
+
+				  parent.setInclude(stylesheet);
+			  }
+		  }
+
+		  stylesheet.setDOMBackPointer(handler.getOriginatingNode());
+		  stylesheet.setLocaterInfo(handler.getLocator());
+
+		  stylesheet.setPrefixes(handler.getNamespaceSupport());
+		  handler.pushStylesheet(stylesheet);
+		  setPropertiesFromAttributes(handler, rawName, attributes, handler.getStylesheet());
+		  handler.pushElemTemplateElement(handler.getStylesheet());
+	  }
+	  catch(TransformerException te)
+	  {
+		  throw new org.xml.sax.SAXException(te);
+	  }
   }
 
   /**
    * This method can be over-ridden by a class that extends this one.
+   * 
    * @param handler The calling StylesheetHandler/TemplatesBuilder.
    */
   protected Stylesheet getStylesheetRoot(StylesheetHandler handler) throws TransformerConfigurationException
   {
-    StylesheetRoot stylesheet;
-    stylesheet = new StylesheetRoot(handler.getSchema(), handler.getStylesheetProcessor().getErrorListener());
-    
-    if (handler.getStylesheetProcessor().isSecureProcessing())
-      stylesheet.setSecureProcessing(true);
-    
-    return stylesheet;
+	  StylesheetRoot stylesheet;
+	  stylesheet = new StylesheetRoot(handler.getSchema(), handler.getStylesheetProcessor().getErrorListener());
+
+	  if (handler.getStylesheetProcessor().isSecureProcessing())
+		  stylesheet.setSecureProcessing(true);
+
+	  return stylesheet;
   }
 
-/**
+ /**
    * Receive notification of the end of an element.
    *
    * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@@ -135,12 +132,12 @@ public class ProcessorStylesheetElement extends XSLTElementProcessor
    * @param localName The local name (without prefix), or empty string if not namespace processing.
    * @param rawName The qualified name (with prefix).
    */
-  public void endElement(
-          StylesheetHandler handler, String uri, String localName, String rawName)
-            throws org.xml.sax.SAXException
+  public void endElement(StylesheetHandler handler, String uri, String localName, String rawName)
+            																					throws org.xml.sax.SAXException
   {
-		super.endElement(handler, uri, localName, rawName);
-    handler.popElemTemplateElement();
-    handler.popStylesheet();
+	  super.endElement(handler, uri, localName, rawName);
+	  
+	  handler.popElemTemplateElement();
+	  handler.popStylesheet();
   }
 }
diff --git a/src/main/java/org/apache/xalan/processor/ProcessorStylesheetDoc.java b/src/main/java/org/apache/xalan/processor/ProcessorStylesheetDoc.java
index 4a941fd4f..6e432f978 100644
--- a/src/main/java/org/apache/xalan/processor/ProcessorStylesheetDoc.java
+++ b/src/main/java/org/apache/xalan/processor/ProcessorStylesheetDoc.java
@@ -15,14 +15,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id$
- */
 package org.apache.xalan.processor;
 
 /**
- * This class processes the xsl:stylesheet element.  At the 
- * moment, it defers all methods to it's superclass.
+ * This class processes the xsl:stylesheet, xsl:transform and xsl:package elements. 
+ * As of now, this class defers all methods to it's superclass.
+ * 
  * @xsl.usage internal
  */
 public class ProcessorStylesheetDoc extends XSLTElementProcessor
diff --git a/src/main/java/org/apache/xalan/processor/ProcessorStylesheetElement.java b/src/main/java/org/apache/xalan/processor/ProcessorStylesheetElement.java
index bfc9f75f5..728e8e937 100644
--- a/src/main/java/org/apache/xalan/processor/ProcessorStylesheetElement.java
+++ b/src/main/java/org/apache/xalan/processor/ProcessorStylesheetElement.java
@@ -15,9 +15,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id$
- */
 package org.apache.xalan.processor;
 
 import javax.xml.transform.TransformerConfigurationException;
@@ -31,7 +28,7 @@ import org.xml.sax.Attributes;
 /**
  * TransformerFactory for xsl:stylesheet or xsl:transform markup.
  * @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
- * @see <a href="http://www.w3.org/TR/xslt#stylesheet-element">stylesheet-element in XSLT Specification</a>
+ * @see <a href="http://www.w3.org/TR/xslt#stylesheet-element">stylesheet-element within XSLT specification</a>
  * 
  * @xsl.usage internal
  */
diff --git a/src/main/java/org/apache/xalan/processor/XSLTSchema.java b/src/main/java/org/apache/xalan/processor/XSLTSchema.java
index 8762961a4..2d5cafe0d 100644
--- a/src/main/java/org/apache/xalan/processor/XSLTSchema.java
+++ b/src/main/java/org/apache/xalan/processor/XSLTSchema.java
@@ -225,7 +225,13 @@ public class XSLTSchema extends XSLTElementDef
                                      XSLTAttributeDef.T_QNAME, false, false, XSLTAttributeDef.ERROR);
     
     // Optional
-    // xsl:merge-source
+    // Static error if invalid
+    // xsl:template
+    XSLTAttributeDef visibilityAttrOpt = new XSLTAttributeDef(null, "visibility",
+                                     XSLTAttributeDef.T_STRING, false, false, XSLTAttributeDef.ERROR);
+    
+    // Optional
+    // xsl:merge-source, xsl:package
     XSLTAttributeDef nameAttrOpt = new XSLTAttributeDef(null, "name",
                                      XSLTAttributeDef.T_STRING, false, false, XSLTAttributeDef.WARNING);
     
@@ -1340,6 +1346,7 @@ public class XSLTSchema extends XSLTElementDef
                                                    priorityAttr,
                                                    modeAttr,
                                                    asAttrOpt,
+                                                   visibilityAttrOpt,
                                                    xpathDefaultNamespaceAttrOpt,
                                                    expandTextAttrOpt,
                                                    spaceAttr }, 
@@ -1417,6 +1424,11 @@ public class XSLTSchema extends XSLTElementDef
                                              XSLTAttributeDef.T_NMTOKEN,
                                              true,false, XSLTAttributeDef.WARNING);
     
+    XSLTAttributeDef packageVersionAttrOpt = new XSLTAttributeDef(null,
+								             "package-version",
+								             XSLTAttributeDef.T_NMTOKEN,
+								             true,false, XSLTAttributeDef.WARNING);
+    
     XSLTAttributeDef xslInputTypeAnnotationsAttrOpt = new XSLTAttributeDef(null, "input-type-annotations",
                                 XSLTAttributeDef.T_STRING, false, false, XSLTAttributeDef.WARNING);
     
@@ -1436,6 +1448,25 @@ public class XSLTSchema extends XSLTElementDef
                                            spaceAttr }, new ProcessorStylesheetElement(),  /* ContentHandler */
                                          null  /* class object */,
                                          true, -1, false);
+    
+    XSLTElementDef packageElemDef = new XSLTElementDef(this,
+            Constants.S_XSLNAMESPACEURL,
+            "package", null,
+            topLevelElements,
+            new XSLTAttributeDef[]{
+              extensionElementPrefixesAttr,
+              excludeResultPrefixesAttr,
+              idAttr,
+              nameAttrOpt,
+              packageVersionAttrOpt,
+              versionAttrRequired,
+              xpathDefaultNamespaceAttrOpt,
+              expandTextAttrOpt,
+              defaultModeAttr,
+              xslInputTypeAnnotationsAttrOpt,
+              spaceAttr }, new ProcessorPackageElement(),  /* ContentHandler */
+            null  /* class object */,
+            true, -1, false);
 
     importDef.setElements(new XSLTElementDef[]{ stylesheetElemDef,
                                                 resultElement,
@@ -1443,7 +1474,9 @@ public class XSLTSchema extends XSLTElementDef
     includeDef.setElements(new XSLTElementDef[]{ stylesheetElemDef,
                                                  resultElement,
                                                  unknownElement });
+    
     build(null, null, null, new XSLTElementDef[]{ stylesheetElemDef,
+    		                                      packageElemDef,
                                                   whiteSpaceOnly,
                                                   resultElement,
                                                   unknownElement }, null,
diff --git a/src/main/java/org/apache/xalan/templates/ElemTemplate.java b/src/main/java/org/apache/xalan/templates/ElemTemplate.java
index b27bbdc0b..f407e4f05 100644
--- a/src/main/java/org/apache/xalan/templates/ElemTemplate.java
+++ b/src/main/java/org/apache/xalan/templates/ElemTemplate.java
@@ -218,6 +218,18 @@ public class ElemTemplate extends ElemTemplateElement
   {
 	  return m_name;
   }
+  
+  protected String m_visibility = null;
+  
+  public void setVisibility(String v)
+  {
+	  m_visibility = v;
+  }
+  
+  public String getVisibility()
+  {
+	  return m_visibility;
+  }
 
   /**
    * Modes allow an element to be processed multiple times,
diff --git a/src/main/java/org/apache/xalan/templates/Stylesheet.java b/src/main/java/org/apache/xalan/templates/Stylesheet.java
index 1fbcbe99b..d8d70bef2 100644
--- a/src/main/java/org/apache/xalan/templates/Stylesheet.java
+++ b/src/main/java/org/apache/xalan/templates/Stylesheet.java
@@ -358,6 +358,31 @@ public class Stylesheet extends ElemTemplateElement implements java.io.Serializa
 		return m_Id;
 	}
 	
+	/**
+	 * The "name" property.
+	 */
+	private String m_name;
+
+	/**
+	 * Set the "name" property.
+	 *
+	 * @param v Value for the "name" property.
+	 */
+	public void setName(String name)
+	{
+		m_name = name;
+	}
+
+	/**
+	 * Get the "name" property.
+	 *
+	 * @return The value of the "name" property.
+	 */
+	public String getName()
+	{
+		return m_name;
+	}
+	
 	/**
 	 * Class field, that represents the value of "xpath-default-namespace" 
 	 * attribute.
@@ -441,6 +466,11 @@ public class Stylesheet extends ElemTemplateElement implements java.io.Serializa
 	 * Whether or not the stylesheet is in "Forward Compatibility Mode".
 	 */
 	private boolean m_isCompatibleMode = false;
+	
+	/**
+	 * The "package-version" property.
+	 */
+	private String m_package_version;
 
 	/**
 	 * Set the "version" property.
@@ -452,6 +482,23 @@ public class Stylesheet extends ElemTemplateElement implements java.io.Serializa
 		m_Version = v;
 		m_isCompatibleMode = (Double.valueOf(v).doubleValue() > Constants.XSLTVERSUPPORTED);
 	}
+	
+	private boolean m_is_xsl_package = false;
+	
+	/**
+	 * Set the "package-version" property.
+	 *
+	 * @param v Value for the "package-version" property.
+	 */
+	public void setPackageVersion(String v)
+	{
+		m_package_version = v;		
+		m_is_xsl_package = true;
+	}
+	
+	public boolean isXslPackage() {
+		return m_is_xsl_package;
+	}
 
 	/**
 	 * Get whether or not the stylesheet is in "Forward Compatibility Mode"
@@ -472,6 +519,16 @@ public class Stylesheet extends ElemTemplateElement implements java.io.Serializa
 	{
 		return m_Version;
 	}
+	
+	/**
+	 * Get the "package-version" property.
+	 *
+	 * @return The value of the "package-version" property.
+	 */
+	public String getPackageVersion()
+	{
+		return m_package_version;
+	}
 
 	/**
 	 * The "xsl:import" list.
diff --git a/src/main/java/org/apache/xalan/transformer/TransformerImpl.java b/src/main/java/org/apache/xalan/transformer/TransformerImpl.java
index 7503f3b63..a189bf828 100644
--- a/src/main/java/org/apache/xalan/transformer/TransformerImpl.java
+++ b/src/main/java/org/apache/xalan/transformer/TransformerImpl.java
@@ -128,9 +128,8 @@ import org.apache.xpath.Expression;
 import org.apache.xpath.ExtensionsProvider;
 import org.apache.xpath.VariableStack;
 import org.apache.xpath.XPath;
-import org.apache.xpath.XPathStaticContext;
 import org.apache.xpath.XPathContext;
-import org.apache.xpath.compiler.FunctionTable;
+import org.apache.xpath.XPathStaticContext;
 import org.apache.xpath.compiler.SharedLexerState;
 import org.apache.xpath.functions.XSL3ConstructorOrExtensionFunction;
 import org.apache.xpath.objects.ResultSequence;
@@ -2513,7 +2512,7 @@ public class TransformerImpl extends Transformer
                                 : xslInstruction.getXSLToken()
                                   == Constants.ELEMNAME_APPLY_IMPORTS);        
 
-    if (null == template || isApplyImports)
+    if ((template == null) || isApplyImports)
     {
       int maxImportLevel, endImportLevel=0;
 
@@ -2560,11 +2559,21 @@ public class TransformerImpl extends Transformer
         	 
              template = m_stylesheetRoot.getTemplateComposed(initTemplateQName);
              
-             if (template != null) {
+             if (template != null) {            	             	             	 
             	 m_xcontext.pushNamespaceContext(template);
             	 pushElemTemplateElement(template);
                  m_xcontext.pushCurrentNode(child);
                  pushPairCurrentMatched(template, child);
+                                                   
+                 Stylesheet xslStylesheet = (Stylesheet)(template.getParentElem());
+                 
+                 if (xslStylesheet.isXslPackage()) {
+                	 // An xsl:template element is child of xsl:package element
+                	 String xslTemplateVisibility = template.getVisibility();
+                	 if (!"public".equals(xslTemplateVisibility)) {
+                		 throw new TransformerException("XTDE0040 : An XSL stylesheet initial template must be 'public'.", template); 
+                	 }
+                 }
                  
                  DTMCursorIterator cnl = new org.apache.xpath.NodeSetDTM(child, m_xcontext.getDTMManager());
                  m_xcontext.pushContextNodeList(cnl);
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 1022969ab..5048d1afb 100644
--- a/src/test/java/org/apache/xalan/tests/util/XslTransformTestsUtil.java
+++ b/src/test/java/org/apache/xalan/tests/util/XslTransformTestsUtil.java
@@ -700,38 +700,6 @@ public class XslTransformTestsUtil extends FileComparisonUtil {
     	return result;
     }
     
-    /**
-     * When running W3C XSLT 3.0 test suite, check whether the test case 
-     * is written for xsl:package feature.
-     *  
-     * @param testCaseNode
-     * @return						Boolean value true or false						
-     */
-    protected boolean isXslt3PackageFeatureTestCase(Node testCaseNode) {
-    	
-        boolean result = false;
-        
-        NodeList nodeList = testCaseNode.getChildNodes();
-        int nodeListLength = nodeList.getLength();
-        for (int idx = 0; idx < nodeListLength; idx++) {
-     	  Node node = nodeList.item(idx);
-     	  if (node.getNodeType() == Node.ELEMENT_NODE) {
-     		 Element elemNode = (Element)node;
-     		 String elemName = elemNode.getLocalName();
-     		 if ("test".equals(elemName)) {
-     			 NodeList nodeList1 = elemNode.getElementsByTagName("package");
-     			 if (nodeList1.getLength() > 0) {
-     				 result = true;
-
-     				 break; 
-     			 }
-     		 }
-     	  }
-        }
-        
-        return result;
-    }
-    
     /**
      * Set XML Schema validation and xsl:evaluate XSL transformation properties, on 
      * Xalan-J's TransformerImpl object. 
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/W3CXSLT3Tests.java b/src/test/java/org/apache/xalan/tests/w3c/xslt3/W3CXSLT3Tests.java
index 3fccd59c3..7a59ad9f3 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/W3CXSLT3Tests.java
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/W3CXSLT3Tests.java
@@ -28,6 +28,7 @@ import org.apache.xalan.tests.w3c.xslt3.attr.XslXPathDefaultNamespaceAttrTests;
 import org.apache.xalan.tests.w3c.xslt3.decl.XslAttributeSetTests;
 import org.apache.xalan.tests.w3c.xslt3.decl.XslCharacterMapTests;
 import org.apache.xalan.tests.w3c.xslt3.decl.XslFunctionTests;
+import org.apache.xalan.tests.w3c.xslt3.decl.XslPackageTests;
 import org.apache.xalan.tests.w3c.xslt3.decl.XslParamTests;
 import org.apache.xalan.tests.w3c.xslt3.decl.XslStripSpaceTests;
 import org.apache.xalan.tests.w3c.xslt3.decl.XslTemplateTests;
@@ -96,7 +97,7 @@ import org.junit.runners.Suite.SuiteClasses;
 	            XslDocumentTests.class, XslXPathDefaultNamespaceAttrTests.class, XslExpandTextAttrTests.class, XslFnJsonToXmlTests.class,
 	            XslBuiltInTemplateTests.class, XslModeTests.class, XslDisableOutputEscapingAttrTests.class, XslTunnelAttrTests.class,
 	            XslParamTests.class, XslStripSpaceTests.class, XslTemplateTests.class, XslFnXmlToJsonTests.class, XslMessageTests.class,
-	            XslConstructNodeTests.class, XslWhitespaceTests.class })
+	            XslConstructNodeTests.class, XslWhitespaceTests.class, XslPackageTests.class })
 public class W3CXSLT3Tests {
 
 }
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/W3CXslTransformTestsUtil.java b/src/test/java/org/apache/xalan/tests/w3c/xslt3/W3CXslTransformTestsUtil.java
index 3dcb692f0..31ff702e4 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/W3CXslTransformTestsUtil.java
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/W3CXslTransformTestsUtil.java
@@ -218,16 +218,6 @@ public class W3CXslTransformTestsUtil extends XslTransformTestsUtil {
        			  
        			  continue; 
      		   }
-    		   else if (isXslt3PackageFeatureTestCase(xslTestCaseNode)) {
-    			   // We skip running XSLT 3.0 xsl:package feature test cases, for now
-    			   Element elemTestResult = testResultDoc.createElement("testResult");
-    			   elemTestResult.setAttribute("testName", testCaseName);
-    			   elemTestResult.setAttribute("status", "skipped");
-    			   elemTestResult.setAttribute("feature", "xsl:package test case");
-    			   elemTestRun.appendChild(elemTestResult);
-
-    			   continue; 
-      		   }
     		   else if (m_skipped_tests_list.contains(testCaseName)) {
     			   /**
     			    * We skip running XSLT 3.0 test cases available within this
@@ -264,6 +254,10 @@ public class W3CXslTransformTestsUtil extends XslTransformTestsUtil {
     							   if (envName.equals(xslTestCaseEnvObj)) {
     								   xmlDocInpStr = getXMLInputDocStr(elemNode);    							   
     								   NodeList nodeList1 = elemNode.getElementsByTagName("stylesheet");
+    								   if (nodeList1.getLength() == 0) {
+    									   nodeList1 = elemNode.getElementsByTagName("package"); 
+    								   }
+    								   
     								   Element elemNode1 = (Element)(nodeList1.item(0));
     								   if (elemNode1 != null) {
     									   String fileName = elemNode1.getAttribute(FILE_ATTR);
@@ -276,6 +270,9 @@ public class W3CXslTransformTestsUtil extends XslTransformTestsUtil {
     									   NodeList nodeList3 = elem1.getElementsByTagName("test");
     									   Element elem2 = (Element)(nodeList3.item(0));
     									   NodeList nodeList4 = elem2.getElementsByTagName("stylesheet");
+    									   if (nodeList4.getLength() == 0) {
+    										   nodeList4 = elem2.getElementsByTagName("package"); 
+    									   }
 
     									   Element elemNode2 = (Element)(nodeList4.item(0));				   
     									   String fileName = elemNode2.getAttribute(FILE_ATTR);
@@ -308,6 +305,9 @@ public class W3CXslTransformTestsUtil extends XslTransformTestsUtil {
     				   NodeList nodeList1 = elem1.getElementsByTagName("test");
     				   Element elem2 = (Element)(nodeList1.item(0));
     				   NodeList nodeList3 = elem2.getElementsByTagName("stylesheet");
+    				   if (nodeList3.getLength() == 0) {
+    					  nodeList3 = elem2.getElementsByTagName("package"); 
+    				   }
 
     				   Element elemNode1 = (Element)(nodeList3.item(0));				   
     				   String fileName = elemNode1.getAttribute(FILE_ATTR);
@@ -328,6 +328,10 @@ public class W3CXslTransformTestsUtil extends XslTransformTestsUtil {
     				   if (ELEM_NODE_NAME_TEST.equals(elemNode.getLocalName())) {
     					   if (xslStylesheetUriStr == null) {
     						   NodeList nodeList3 = elemNode.getElementsByTagName("stylesheet");
+    						   if (nodeList3.getLength() == 0) {
+    							   nodeList3 = elemNode.getElementsByTagName("package");  
+    						   }
+    						   
     						   Element elemNode2 = (Element)(nodeList3.item(0));    					   
     						   String fileName = elemNode2.getAttribute(FILE_ATTR);
     						   URI uri = new URI(m_xslTransformTestSetFilePath);
@@ -542,17 +546,7 @@ public class W3CXslTransformTestsUtil extends XslTransformTestsUtil {
      			   elemTestRun.appendChild(elemTestResult);
 
      			   continue; 
-      		   }
-     		   else if (isXslt3PackageFeatureTestCase(node)) {
-     			   // We skip running XSLT 3.0 package feature test cases
-     			   Element elemTestResult = testResultDoc.createElement("testResult");
-     			   elemTestResult.setAttribute("testName", testCaseName);
-     			   elemTestResult.setAttribute("status", "skipped");
-     			   elemTestResult.setAttribute("feature", "xsl:package test case");
-     			   elemTestRun.appendChild(elemTestResult);
-
-     			   continue; 
-       		   }
+      		   }     		   
      		   else if (m_skipped_tests_list.contains(testCaseName)) {
      			   /**
      			    * We skip running XSLT 3.0 test cases available within this
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/decl/XslPackageTests.java b/src/test/java/org/apache/xalan/tests/w3c/xslt3/decl/XslPackageTests.java
new file mode 100644
index 000000000..c6acbebbe
--- /dev/null
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/decl/XslPackageTests.java
@@ -0,0 +1,54 @@
+/*
+ * 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.w3c.xslt3.decl;
+
+import org.apache.xalan.tests.w3c.xslt3.W3CXslTransformTestsUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Xalan-J XSL 3 test driver, to run W3C XSL 3.0 transformation 
+ * tests for xsl:package instruction.
+ * 
+ * @author Mukul Gandhi <mu...@apache.org>
+ * 
+ * @xsl.usage advanced
+ */
+public class XslPackageTests extends W3CXslTransformTestsUtil {     
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+    	m_xslTransformTestSetFilePath = W3C_XSLT3_TESTS_META_DATA_DIR_HOME + "decl/package/_package-test-set.xml";
+    	m_resultSubFolderName = "decl";
+    	
+    	m_testResultFileName = "_package-test-set_result.xml";
+    }
+
+    @AfterClass
+    public static void tearDownAfterClass() throws Exception {
+        m_xmlDocumentBuilderFactory = null;
+        m_xmlDocumentBuilder = null;
+        m_xslTransformerFactory = null;
+    }
+
+    @Test
+    public void runXslFunctionTests() {    	
+       runXslTestSet();
+    }
+
+}
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_mode-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_mode-test-set_result.xml
index c1b6fb01d..3725af33d 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_mode-test-set_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/attr/_mode-test-set_result.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2026-01-09T16:41:27Z" fail="59" name="mode" pass="64" run="123" skipped="46" statusUnknown="0">
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2026-02-06T11:40:48Z" fail="73" name="mode" pass="68" run="141" skipped="28" statusUnknown="0">
    <testResult status="pass" testName="mode-0001"/>
    <testResult feature="streaming" status="skipped" testName="mode-0002"/>
    <testResult status="pass" testName="mode-0003"/>
@@ -366,14 +366,10 @@ Z&#13;#unnamed used for QNAME attribute: mode</errTrace>
    <testResult status="pass" testName="mode-1505"/>
    <testResult feature="streaming" status="skipped" testName="mode-1506"/>
    <testResult status="fail" testName="mode-1507">
-      <outResult>
-         <errTrace>java.lang.IndexOutOfBoundsException: Index: 0, Size: 0</errTrace>
-      </outResult>
+      <outResult>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</outResult>
    </testResult>
    <testResult status="fail" testName="mode-1508">
-      <outResult>
-         <errTrace>java.lang.IndexOutOfBoundsException: Index: 0, Size: 0</errTrace>
-      </outResult>
+      <outResult>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</outResult>
    </testResult>
    <testResult status="fail" testName="mode-1509">
       <outResult>
@@ -424,24 +420,73 @@ Z&#13;#unnamed used for QNAME attribute: mode</errTrace>
    <testResult status="fail" testName="mode-1617"/>
    <testResult status="fail" testName="mode-1618"/>
    <testResult status="fail" testName="mode-1619"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1701"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1701a"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1702"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1702a"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1703"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1704"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1705"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1705a"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1705b"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1706"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1707"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1708"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1709"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1710"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1711"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1712"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1713"/>
-   <testResult feature="xsl:package test case" status="skipped" testName="mode-1714err"/>
+   <testResult status="pass" testName="mode-1701"/>
+   <testResult status="pass" testName="mode-1701a"/>
+   <testResult status="fail" testName="mode-1702">
+      <outResult>
+         <errTrace>"declared-modes" attribute is not allowed on the xsl:package element!</errTrace>
+         <errTrace>Illegal value: #unnamed used for QNAME attribute: mode</errTrace>
+      </outResult>
+   </testResult>
+   <testResult status="fail" testName="mode-1702a">
+      <outResult>
+         <errTrace>"declared-modes" attribute is not allowed on the xsl:package element!</errTrace>
+      </outResult>
+   </testResult>
+   <testResult status="fail" testName="mode-1703">
+      <outResult>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</outResult>
+   </testResult>
+   <testResult status="fail" testName="mode-1704">
+      <outResult>
+         <errTrace>Illegal value: #unnamed used for QNAME attribute: default-mode</errTrace>
+      </outResult>
+   </testResult>
+   <testResult status="fail" testName="mode-1705">
+      <outResult>
+         <errTrace>"declared-modes" attribute is not allowed on the xsl:package element!</errTrace>
+         <errTrace>Illegal value: #unnamed used for QNAME attribute: mode</errTrace>
+      </outResult>
+   </testResult>
+   <testResult status="fail" testName="mode-1705a">
+      <outResult>
+         <errTrace>"declared-modes" attribute is not allowed on the xsl:package element!</errTrace>
+         <errTrace>Illegal value: #unnamed used for QNAME attribute: mode</errTrace>
+      </outResult>
+   </testResult>
+   <testResult status="fail" testName="mode-1705b">
+      <outResult>
+         <errTrace>"declared-modes" attribute is not allowed on the xsl:package element!</errTrace>
+         <errTrace>Illegal value: #unnamed used for QNAME attribute: mode</errTrace>
+      </outResult>
+   </testResult>
+   <testResult status="fail" testName="mode-1706">
+      <outResult>
+         <errTrace>"declared-modes" attribute is not allowed on the xsl:package element!</errTrace>
+         <errTrace>Illegal value: #unnamed used for QNAME attribute: mode</errTrace>
+      </outResult>
+   </testResult>
+   <testResult status="fail" testName="mode-1707">
+      <outResult/>
+   </testResult>
+   <testResult status="pass" testName="mode-1708"/>
+   <testResult status="fail" testName="mode-1709"/>
+   <testResult status="fail" testName="mode-1710">
+      <outResult>
+         <errTrace>Illegal value: #unnamed used for QNAME attribute: mode</errTrace>
+      </outResult>
+   </testResult>
+   <testResult status="fail" testName="mode-1711"/>
+   <testResult status="fail" testName="mode-1712">
+      <outResult>
+         <errTrace>Illegal value: #unnamed used for QNAME attribute: mode</errTrace>
+      </outResult>
+   </testResult>
+   <testResult status="pass" testName="mode-1713"/>
+   <testResult status="fail" testName="mode-1714err">
+      <outResult>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&#13;
+  a-text&#13;
+</outResult>
+   </testResult>
    <testResult status="fail" testName="mode-1801">
       <outResult/>
    </testResult>
@@ -450,8 +495,8 @@ Z&#13;#unnamed used for QNAME attribute: mode</errTrace>
    </testResult>
    <testResult status="fail" testName="mode-1803">
       <outResult>
-         <errTrace>XTSE0010 : xsl:package is not allowed in this position in the stylesheet</errTrace>
-         <errTrace>java.lang.NullPointerException</errTrace>
+         <errTrace>"declared-modes" attribute is not allowed on the xsl:package element!</errTrace>
+         <errTrace>Illegal value: #unnamed used for QNAME attribute: mode</errTrace>
       </outResult>
    </testResult>
    <testResult status="pass" testName="mode-1901"/>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_package-test-set_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_package-test-set_result.xml
new file mode 100644
index 000000000..f945362d0
--- /dev/null
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/decl/_package-test-set_result.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?><testrun dateTime="2026-02-06T11:40:59Z" fail="2" name="package" pass="1" run="3" skipped="0" statusUnknown="0">
+   <testResult status="pass" testName="package-001"/>
+   <testResult status="fail" testName="package-001a">
+      <outResult>
+         <errTrace>XTSE0010 : xsl:package requires attribute: package-version</errTrace>
+      </outResult>
+   </testResult>
+   <testResult status="fail" testName="package-001b">
+      <outResult>
+         <errTrace>XTSE0010 : xsl:package requires attribute: package-version</errTrace>
+      </outResult>
+   </testResult>
+</testrun>
diff --git a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/w3c_xslt3_testsuite_xalan-j_result.xml b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/w3c_xslt3_testsuite_xalan-j_result.xml
index eca2466d9..df09b5894 100644
--- a/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/w3c_xslt3_testsuite_xalan-j_result.xml
+++ b/src/test/java/org/apache/xalan/tests/w3c/xslt3/result/w3c_xslt3_testsuite_xalan-j_result.xml
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<testResult dateTime="2026-02-05T17:53:09Z" desc="W3C XSLT 3.0 test suite results" fail="1333" pass="3327" run="4666" skipped="598" success="71.3%" xslt_processor="Apache Xalan XSLT 3.0 development code">
+<testResult dateTime="2026-02-06T11:41:10Z" desc="W3C XSLT 3.0 test suite results" fail="1349" pass="3332" run="4687" skipped="580" success="71.09%" xslt_processor="Apache Xalan XSLT 3.0 development code">
   <attr>
     <as fail="29" pass="82" run="111" skipped="93" success="73.87%"/>
     <avt fail="1" pass="33" run="34" skipped="1" success="97.06%"/>
     <disable-output-escaping fail="5" pass="22" run="27" skipped="5" success="81.48%"/>
     <expand-text fail="8" pass="51" run="59" skipped="3" success="86.44%"/>
     <match fail="82" pass="100" run="182" skipped="112" success="54.95%"/>
-    <mode fail="59" pass="64" run="123" skipped="46" success="52.03%"/>
+    <mode fail="73" pass="68" run="141" skipped="28" success="48.23%"/>
     <select fail="27" pass="104" run="132" skipped="26" success="78.79%"/>
     <tunnel fail="40" pass="18" run="58" skipped="0" success="31.03%"/>
     <xpath-default-namespace fail="11" pass="11" run="22" skipped="4" success="50.0%"/>
@@ -15,6 +15,7 @@
     <attribute-set fail="7" pass="42" run="49" skipped="1" success="85.71%"/>
     <character-map fail="14" pass="13" run="28" skipped="1" success="46.43%"/>
     <function fail="28" pass="59" run="87" skipped="23" success="67.82%"/>
+    <package fail="2" pass="1" run="3" skipped="0" success="33.33%"/>
     <param fail="17" pass="13" run="30" skipped="1" success="43.33%"/>
     <strip-space fail="14" pass="13" run="27" skipped="3" success="48.15%"/>
     <template fail="0" pass="6" run="6" skipped="0" success="100.0%"/>
diff --git a/src/test/resources/xsl_function/gold/test28.out b/src/test/resources/xsl_function/gold/test28.out
index ff07c088b..f1e75f5a6 100644
--- a/src/test/resources/xsl_function/gold/test28.out
+++ b/src/test/resources/xsl_function/gold/test28.out
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><output>MAN BITES DOG</output>
+<?xml version="1.0" encoding="UTF-8"?><result>man bites dog</result>
diff --git a/src/test/resources/xsl_function/gold/test29.out b/src/test/resources/xsl_function/gold/test29.out
index ff07c088b..f1e75f5a6 100644
--- a/src/test/resources/xsl_function/gold/test29.out
+++ b/src/test/resources/xsl_function/gold/test29.out
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><output>MAN BITES DOG</output>
+<?xml version="1.0" encoding="UTF-8"?><result>man bites dog</result>
diff --git a/src/test/resources/xsl_function/gold/test30.out b/src/test/resources/xsl_function/gold/test30.out
index ad02e7e5d..b7c49c44c 100644
--- a/src/test/resources/xsl_function/gold/test30.out
+++ b/src/test/resources/xsl_function/gold/test30.out
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?><output>
+<?xml version="1.0" encoding="UTF-8"?><result>
   <value num="1">i</value>
   <value num="2">ii</value>
   <value num="3">iii</value>
@@ -9,4 +9,4 @@
   <value num="8">viii</value>
   <value num="9">ix</value>
   <value num="10">x</value>
-</output>
+</result>
diff --git a/src/test/resources/xsl_function/test28.xsl b/src/test/resources/xsl_function/test28.xsl
index b9f5e9927..7110a5a81 100644
--- a/src/test/resources/xsl_function/test28.xsl
+++ b/src/test/resources/xsl_function/test28.xsl
@@ -2,18 +2,25 @@
 <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:str="http://example.com/namespace"               
-               exclude-result-prefixes="#all"
+               exclude-result-prefixes="xs str"
 			   version="3.0">
 			   
    <!-- Author: mukulg@apache.org -->			   
 			   
-   <!-- An XSL stylesheet example, to test stylesheet function. 
-        Ref : XSLT 3.0 specification, section 10.3.9 Examples of Stylesheet Functions. -->			   
+   <!-- An XSL 3 stylesheet example, to test stylesheet function. 
+        Ref : XSLT 3.0 specification, section 10.3.9 Examples of 
+        Stylesheet Functions. -->			   
 			   
-   <xsl:output method="xml" indent="yes"/>			   
+   <xsl:output method="xml" indent="yes"/>
+   
+   <xsl:template match="/">
+      <result>
+        <xsl:value-of select="str:reverse('dog bites man')"/>
+      </result>
+   </xsl:template>			   
 
-   <!-- An XSL stylesheet recursive function named str:reverse 
-        that reverses the words in a supplied sentence. -->
+   <!-- An XSL stylesheet function that, reverses the words 
+        from a supplied English sentence. -->
    <xsl:function name="str:reverse" as="xs:string">
       <xsl:param name="sentence" as="xs:string"/>
       <xsl:sequence select="if (contains($sentence, ' '))
@@ -22,12 +29,6 @@
                                     substring-before($sentence, ' '))
                                   else $sentence"/>
    </xsl:function>
-
-   <xsl:template match="/">
-      <output>
-        <xsl:value-of select="str:reverse('DOG BITES MAN')"/>
-      </output>
-   </xsl:template>
    
    <!--
       * Licensed to the Apache Software Foundation (ASF) under one
diff --git a/src/test/resources/xsl_function/test29.xsl b/src/test/resources/xsl_function/test29.xsl
index c8f42ebb1..86491f9f1 100644
--- a/src/test/resources/xsl_function/test29.xsl
+++ b/src/test/resources/xsl_function/test29.xsl
@@ -2,18 +2,25 @@
 <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:str="http://example.com/namespace"               
-               exclude-result-prefixes="#all"
+               exclude-result-prefixes="xs str"
 			   version="3.0">
 			   
    <!-- Author: mukulg@apache.org -->			   
 			   
-   <!-- An XSL stylesheet example, to test stylesheet function. 
-        Ref : XSLT 3.0 specification, section 10.3.9 Examples of Stylesheet Functions. -->			   
+   <!-- An XSL 3 stylesheet example, to test stylesheet function. 
+        Ref : XSLT 3.0 specification, section 10.3.9 Examples of 
+        Stylesheet Functions. -->			   
 			   
-   <xsl:output method="xml" indent="yes"/>			   
+   <xsl:output method="xml" indent="yes"/>
+   
+   <xsl:template match="/">
+      <result>
+        <xsl:value-of select="str:reverse('dog bites man')"/>
+      </result>
+   </xsl:template>			   
 
-   <!-- An XSL stylesheet recursive function named str:reverse 
-        that reverses the words in a supplied sentence. -->
+   <!-- An XSL stylesheet function that, reverses the words 
+        from a supplied English sentence. -->
    <xsl:function name="str:reverse" as="xs:string">
       <xsl:param name="sentence" as="xs:string"/>
       <xsl:choose>
@@ -28,12 +35,6 @@
           </xsl:otherwise>
        </xsl:choose>
    </xsl:function>
-
-   <xsl:template match="/">
-      <output>
-        <xsl:value-of select="str:reverse('DOG BITES MAN')"/>
-      </output>
-   </xsl:template>
    
    <!--
       * Licensed to the Apache Software Foundation (ASF) under one
diff --git a/src/test/resources/xsl_function/test30.xsl b/src/test/resources/xsl_function/test30.xsl
index 7430b329d..601327722 100644
--- a/src/test/resources/xsl_function/test30.xsl
+++ b/src/test/resources/xsl_function/test30.xsl
@@ -2,31 +2,32 @@
 <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:num="http://example.com/namespace"               
-               exclude-result-prefixes="#all"
+               exclude-result-prefixes="xs num"
 			   version="3.0">
 			   
    <!-- Author: mukulg@apache.org -->			   
 			   
-   <!-- An XSL stylesheet example, to test stylesheet function. 
-        Ref : XSLT 3.0 specification, section 10.3.9 Examples of Stylesheet Functions. -->			   
+   <!-- An XSL 3 stylesheet example, to test stylesheet function. 
+        Ref : XSLT 3.0 specification, section 10.3.9 Examples of 
+        Stylesheet Functions. -->		   
 			   
-   <xsl:output method="xml" indent="yes"/>			   
+   <xsl:output method="xml" indent="yes"/>
+   
+   <xsl:template match="/">
+      <result>
+        <xsl:iterate select="1 to 10">
+		   <value num="{.}"><xsl:value-of select="num:roman(.)"/></value>
+		</xsl:iterate>
+      </result>
+   </xsl:template>			   
 
    <!-- An XSL stylesheet function, that transforms a supplied 
         decimal integer value to a numeric value with roman 
-		alphabets. -->
+		numerals. -->
    <xsl:function name="num:roman" as="xs:string">
       <xsl:param name="value" as="xs:integer"/>
       <xsl:number value="$value" format="i"/>
    </xsl:function>
-
-   <xsl:template match="/">
-      <output>
-        <xsl:iterate select="1 to 10">
-		   <value num="{.}"><xsl:value-of select="num:roman(.)"/></value>
-		</xsl:iterate>
-      </output>
-   </xsl:template>
    
    <!--
       * Licensed to the Apache Software Foundation (ASF) under one


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org