--- XalanTransformer.hpp.orig	Thu Apr 21 12:00:20 2011
+++ XalanTransformer.hpp.new2	Fri Sep 16 16:44:05 2011
@@ -40,6 +40,7 @@
 
 
 #include <xalanc/XPath/XalanQNameByValue.hpp>
+#include <xalanc/XPath/XObject.hpp>
 
 
 
@@ -496,6 +497,18 @@
         m_params[qname] = expression;
     }
 
+	/**
+	 * Set a top-level stylesheet parameter.  This value can be evaluated via
+	 * xsl:param-variable.  These values are cleared after a call to transform().
+	 *
+	 * @param key name of the param
+	 * @param value a XObject that will be used
+	 */
+	void
+	setStylesheetParam(
+			const XalanDOMString&	key,
+			const XObjectPtr&		value);
+
     /**
      * Set a top-level parameter, which the stylesheet can access
      * with a top-level xsl:param.  Top-level params are "sticky,"
@@ -516,6 +529,7 @@
     clearStylesheetParams()
     {
         m_params.clear();
+		clearExtraStylesheetParams();
     }
 
     /**
@@ -934,6 +948,9 @@
     typedef XalanMap<XalanQNameByValue, Function*>  FunctionMapType;
     typedef XalanVector<TraceListener*>             TraceListenerVectorType;
 
+	typedef std::pair<XalanDOMString*, XObjectPtr>			XObjectParamPairType; 
+	typedef XalanVector<XObjectParamPairType>			XObjectParamPairVectorType;
+
     class EnsureFunctionsInstallation
     {
     public:
@@ -1074,6 +1091,8 @@
 
     ParamMapType                            m_params;
 
+	XObjectParamPairVectorType 				m_xobjectParamPairs;
+
     FunctionMapType                         m_functions;
 
     TraceListenerVectorType                 m_traceListeners;
@@ -1108,6 +1127,32 @@
     static const XSLTInputSource*           s_emptyInputSource;
 
     static const XSLTInit*                  s_xsltInit;
+
+
+public:
+
+	/**
+     * Clear any 'extra' stylesheet params (i.e., the ones introduced by fix 451).
+	 * (see: https://issues.apache.org/jira/browse/XALANC-451 )
+     */
+    void
+    clearExtraStylesheetParams()
+    {
+		XObjectParamPairVectorType::iterator
+			it = m_xobjectParamPairs.begin(),
+			itEnd = m_xobjectParamPairs.end();
+
+		for ( ; itEnd != it; ++it )
+		{
+			m_memoryManager.deallocate( (*it).first );
+		}
+		
+		m_xobjectParamPairs.clear();
+    }
+
+private:
+
+
 };
 
 
