You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@locus.apache.org on 2000/05/25 18:51:43 UTC

cvs commit: xml-xalan/c/src/XSLT StylesheetExecutionContext.hpp StylesheetExecutionContextDefault.cpp StylesheetExecutionContextDefault.hpp XSLTEngineImpl.cpp XSLTEngineImpl.hpp

dbertoni    00/05/25 09:51:41

  Modified:    c/src/XSLT StylesheetExecutionContext.hpp
                        StylesheetExecutionContextDefault.cpp
                        StylesheetExecutionContextDefault.hpp
                        XSLTEngineImpl.cpp XSLTEngineImpl.hpp
  Log:
  Further fixes for delaying output of document header.
  
  Revision  Changes    Path
  1.16      +104 -4    xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp
  
  Index: StylesheetExecutionContext.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- StylesheetExecutionContext.hpp	2000/05/24 19:38:49	1.15
  +++ StylesheetExecutionContext.hpp	2000/05/25 16:51:34	1.16
  @@ -301,10 +301,100 @@
   	virtual void
   	setFormatterListener(FormatterListener*		flistener) = 0;
   
  -	// These next four classes are used to save and restore
  +	/*
  +	 * See if there is a pending start document event waiting.
  +	 * @return true if there is a start document event waiting.
  +	 */
  +	virtual bool
  +	getHasPendingStartDocument() const = 0;
  +
  +	/**
  +	 * Set the pending start document event state.
  +	 * @param the new value
  +	 */
  +	virtual void
  +	setHasPendingStartDocument(bool	b) = 0;
  +
  +	/**
  +	 * See if a pending start document event must be flushed.
  +	 * @return true if the event must be flushed.
  +	 */
  +	virtual bool
  +	getMustFlushPendingStartDocument() const = 0;
  +
  +	/**
  +	 * Set the pending start document event flush state.
  +	 * @param the new value
  +	 */
  +	virtual void
  +	setMustFlushPendingStartDocument(bool	b) = 0;
  +
  +	// This next group of classes are used to save and restore
   	// the execution state in an automated, and exception-safe
   	// manner.
   
  +	class HasPendingStartDocumentSetAndRestore
  +	{
  +	public:
  +
  +		/**
  +		 * Construct an object to set and restore the current pending start.
  +		 * document state.
  +		 * @param theExecutionContext a reference to the current execution context
  +		 * @param theNewState the new state to set.
  +		 */
  +		HasPendingStartDocumentSetAndRestore(
  +			StylesheetExecutionContext&		theExecutionContext,
  +			bool							theNewState) :
  +				m_executionContext(theExecutionContext),
  +				m_savedState(theExecutionContext.getHasPendingStartDocument())
  +		{
  +			theExecutionContext.setHasPendingStartDocument(theNewState);
  +		}
  +
  +		~HasPendingStartDocumentSetAndRestore()
  +		{
  +			m_executionContext.setHasPendingStartDocument(m_savedState);
  +		}
  +
  +	private:
  +
  +		StylesheetExecutionContext&		m_executionContext;
  +
  +		const bool						m_savedState;
  +	};
  +
  +	class MustFlushPendingStartDocumentSetAndRestore
  +	{
  +	public:
  +
  +		/**
  +		 * Construct an object to set and restore the current flush pending start.
  +		 * document state.
  +		 * @param theExecutionContext a reference to the current execution context
  +		 * @param theNewState the new state to set.
  +		 */
  +		MustFlushPendingStartDocumentSetAndRestore(
  +			StylesheetExecutionContext&		theExecutionContext,
  +			bool							theNewState) :
  +				m_executionContext(theExecutionContext),
  +				m_savedState(theExecutionContext.getMustFlushPendingStartDocument())
  +		{
  +			theExecutionContext.setMustFlushPendingStartDocument(theNewState);
  +		}
  +
  +		~MustFlushPendingStartDocumentSetAndRestore()
  +		{
  +			m_executionContext.setMustFlushPendingStartDocument(m_savedState);
  +		}
  +
  +	private:
  +
  +		StylesheetExecutionContext&		m_executionContext;
  +
  +		const bool						m_savedState;
  +	};
  +
   	class FormatterListenerSetAndRestore
   	{
   	public:
  @@ -413,8 +503,14 @@
   		ExecutionStateSetAndRestore(
   			StylesheetExecutionContext&		theExecutionContext,
   			FormatterListener*				theNewListener = 0,
  +			bool							hasPendingStartDocument = false,
  +			bool							mustFlushPendingStartDocument = false,
   			const XalanDOMString&			theNewPendingElementName = XalanDOMString(),
   			const AttributeListImpl&		theNewPendingAttributes = AttributeListImpl()) :
  +				m_hasPendingSetAndRestore(theExecutionContext,
  +										  hasPendingStartDocument),
  +				m_flushPendingSetAndRestore(theExecutionContext,
  +											mustFlushPendingStartDocument),
   				m_formatterListenerSetAndRestore(theExecutionContext,
   												 theNewListener),
   				m_pendingElementNameSetAndRestore(theExecutionContext,
  @@ -429,12 +525,16 @@
   		}
   
   	private:
  +
  +		const HasPendingStartDocumentSetAndRestore			m_hasPendingSetAndRestore;
  +
  +		const MustFlushPendingStartDocumentSetAndRestore	m_flushPendingSetAndRestore;
   
  -		FormatterListenerSetAndRestore		m_formatterListenerSetAndRestore;
  +		const FormatterListenerSetAndRestore				m_formatterListenerSetAndRestore;
   
  -		PendingElementNameSetAndRestore		m_pendingElementNameSetAndRestore;
  +		const PendingElementNameSetAndRestore				m_pendingElementNameSetAndRestore;
   
  -		PendingAttributesSetAndRestore		m_pendingAttributesSetAndRestore;
  +		const PendingAttributesSetAndRestore				m_pendingAttributesSetAndRestore;
   	};
   
   	/**
  
  
  
  1.13      +32 -0     xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp
  
  Index: StylesheetExecutionContextDefault.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- StylesheetExecutionContextDefault.cpp	2000/05/24 19:38:49	1.12
  +++ StylesheetExecutionContextDefault.cpp	2000/05/25 16:51:35	1.13
  @@ -384,6 +384,38 @@
   
   
   
  +bool
  +StylesheetExecutionContextDefault::getHasPendingStartDocument() const
  +{
  +	return m_xsltProcessor.getHasPendingStartDocument();
  +}
  +
  +
  +
  +void
  +StylesheetExecutionContextDefault::setHasPendingStartDocument(bool	b)
  +{
  +	m_xsltProcessor.setHasPendingStartDocument(b);
  +}
  +
  +
  +
  +bool
  +StylesheetExecutionContextDefault::getMustFlushPendingStartDocument() const
  +{
  +	return m_xsltProcessor.getMustFlushPendingStartDocument();
  +}
  +
  +
  +
  +void
  +StylesheetExecutionContextDefault::setMustFlushPendingStartDocument(bool	b)
  +{
  +	m_xsltProcessor.setMustFlushPendingStartDocument(b);
  +}
  +
  +
  +
   int
   StylesheetExecutionContextDefault::getIndent() const
   {
  
  
  
  1.14      +12 -0     xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp
  
  Index: StylesheetExecutionContextDefault.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- StylesheetExecutionContextDefault.hpp	2000/05/24 19:38:49	1.13
  +++ StylesheetExecutionContextDefault.hpp	2000/05/25 16:51:36	1.14
  @@ -188,6 +188,18 @@
   	virtual void
   	setFormatterListener(FormatterListener*		flistener);
   
  +	virtual bool
  +	getHasPendingStartDocument() const;
  +
  +	virtual void
  +	setHasPendingStartDocument(bool	b);
  +
  +	virtual bool
  +	getMustFlushPendingStartDocument() const;
  +
  +	virtual void
  +	setMustFlushPendingStartDocument(bool	b);
  +
   	virtual int
   	getIndent() const;
   
  
  
  
  1.40      +71 -118   xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp
  
  Index: XSLTEngineImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- XSLTEngineImpl.cpp	2000/05/24 19:38:49	1.39
  +++ XSLTEngineImpl.cpp	2000/05/25 16:51:36	1.40
  @@ -192,7 +192,6 @@
   	m_rootDoc(),
   	m_outputCarriageReturns(false),
   	m_outputLinefeeds(false),
  -	m_formatter(0),
   	m_resultTreeFactory(0),
   	m_resultNameSpacePrefix(),
   	m_resultNameSpaceURL(),
  @@ -201,6 +200,7 @@
   	m_pendingElementName(),
   	m_pendingAttributes(),
   	m_hasPendingStartDocument(false),
  +	m_mustFlushStartDocument(false),
   	m_resultNameSpaces(),
   	m_emptyNamespace(),
   	m_xpathFactory(xpathFactory),
  @@ -270,6 +270,7 @@
   	m_needToCheckForInfiniteLoops = false;
   	m_variableStacks.reset();
   	m_hasPendingStartDocument = false;
  +	m_mustFlushStartDocument = false;
   
   	m_stackGuard.clear();
   	m_xpathSupport.reset();
  @@ -1407,12 +1408,13 @@
   	assert(m_flistener != 0);
   	assert(m_executionContext != 0);
   
  -//	if (m_hasPendingStartDocument == false)
  -//	{
  -//		m_hasPendingStartDocument = true;
  -//	}
  -//	else
  +	if (m_hasPendingStartDocument == false)
   	{
  +		m_hasPendingStartDocument = true;
  +		m_mustFlushStartDocument = false;
  +	}
  +	else if (m_mustFlushStartDocument == true)
  +	{
   		m_flistener->startDocument();
   
   		if(getTraceListeners() > 0)
  @@ -1422,6 +1424,8 @@
   			fireGenerateEvent(ge);
   		}
   
  +		// Reset this, but leave m_mustFlushStartDocument alone,
  +		// since it will still be needed.
   		m_hasPendingStartDocument = false;
   	}
   }
  @@ -1547,12 +1551,7 @@
   void
   XSLTEngineImpl::flushPending()
   {
  -	if (m_hasPendingStartDocument == true)
  -	{
  -		startDocument();
  -	}
  -
  -	if(0 != length(m_pendingElementName))
  +	if(m_hasPendingStartDocument == true && 0 != length(m_pendingElementName))
   	{
   		assert(m_flistener != 0);
   		assert(m_executionContext != 0);
  @@ -1561,7 +1560,6 @@
   		{
   			if (equalsIgnoreCase(m_pendingElementName,
   								 Constants::ELEMNAME_HTML_STRING) == true &&
  -//				m_hasPendingStartDocument == true &&
   				pendingAttributesHasDefaultNS() == false)
   			{
   				if (m_flistener->getOutputFormat() == FormatterListener::OUTPUT_METHOD_XML)
  @@ -1584,7 +1582,18 @@
   				}
   			}
   		}
  +	}
  +
  +	if(m_hasPendingStartDocument == true && m_mustFlushStartDocument == true)
  +	{
  +		startDocument();
  +	}
   
  +	if(0 != length(m_pendingElementName) && m_mustFlushStartDocument == true)
  +	{
  +		assert(m_flistener != 0);
  +		assert(m_executionContext != 0);
  +
   		m_cdataStack.push_back(isCDataResultElem(m_pendingElementName)? true : false);
   		m_flistener->startElement(c_wstr(m_pendingElementName), m_pendingAttributes);
   
  @@ -1617,6 +1626,8 @@
   	nsVector.push_back(m_emptyNamespace);
   	m_resultNameSpaces.push_back(nsVector);
   	m_pendingElementName = name;
  +
  +	m_mustFlushStartDocument = true;
   }
   
   
  @@ -1700,10 +1711,12 @@
   	assert(m_flistener != 0);
   	assert(ch != 0);
   
  +	m_mustFlushStartDocument = true;
  +
   	flushPending();
   
   	const Stylesheet::QNameVectorType&	cdataElems =
  -		m_stylesheetRoot->getCDATASectionElems();
  +			m_stylesheetRoot->getCDATASectionElems();
   
   	if(0 != cdataElems.size() && 0 != m_cdataStack.size())
   	{
  @@ -1722,7 +1735,7 @@
   		if(getTraceListeners() > 0)
   		{
   			GenerateEvent ge(this, GenerateEvent::EVENTTYPE_CHARACTERS, ch,
  -					start, length);
  +						start, length);
   			fireGenerateEvent(ge);
   		}
   	}
  @@ -1730,12 +1743,15 @@
   
   
   
  +
   void 
   XSLTEngineImpl::charactersRaw (
   			const XMLCh* const	ch,
   			const unsigned int	/* start */,
   			const unsigned int	length)
   {
  +	m_mustFlushStartDocument = true;
  +
   	flushPending();
   
   	m_flistener->charactersRaw(ch, length);
  @@ -1771,6 +1787,8 @@
   	assert(m_flistener != 0);
   	assert(ch != 0);
   
  +	m_mustFlushStartDocument = true;
  +
   	flushPending();
   
   	m_flistener->ignorableWhitespace(ch, length);
  @@ -1778,7 +1796,7 @@
   	if(getTraceListeners() > 0)
   	{
   		GenerateEvent ge(this, GenerateEvent::EVENTTYPE_IGNORABLEWHITESPACE,
  -				ch, 0, length);
  +					ch, 0, length);
   
   		fireGenerateEvent(ge);
   	}
  @@ -1795,6 +1813,8 @@
   	assert(target != 0);
   	assert(data != 0);
   
  +	m_mustFlushStartDocument = true;
  +
   	flushPending();
   
   	m_flistener->processingInstruction(target, data);
  @@ -1816,6 +1836,8 @@
   	assert(m_flistener != 0);
   	assert(data != 0);
   
  +	m_mustFlushStartDocument = true;
  +
   	flushPending();
   
   	m_flistener->comment(data);
  @@ -1835,6 +1857,8 @@
   	assert(m_flistener != 0);
   	assert(name != 0);
   
  +	m_mustFlushStartDocument = true;
  +
   	flushPending();
   
   	m_flistener->entityReference(name);
  @@ -1859,6 +1883,8 @@
   	assert(m_flistener != 0);
   	assert(ch != 0);
   
  +	m_mustFlushStartDocument = true;
  +
   	flushPending();
   
   	const Stylesheet::QNameVectorType&	cdataElems =
  @@ -1892,7 +1918,6 @@
   
   
   
  -
   void
   XSLTEngineImpl::cloneToResultTree(
   			XalanNode&			node, 
  @@ -2055,52 +2080,6 @@
   
   
   
  -class StatePushPop
  -{
  -public:
  -
  -	StatePushPop(
  -		FormatterListener*&		theCurrentListener,
  -		FormatterListener*		theNewListener,
  -		DOMString&				thePendingElementName,
  -		AttributeListImpl&		thePendingAttributes) :
  -			m_listener(theCurrentListener),
  -			m_savedListener(theCurrentListener),
  -			m_pendingElementName(thePendingElementName),
  -			m_savedPendingElementName(thePendingElementName),
  -			m_pendingAttributes(thePendingAttributes),
  -			m_savedPendingAttributes(thePendingAttributes)
  -	{
  -		theCurrentListener = theNewListener;
  -
  -		clear(m_pendingElementName);
  -
  -		m_pendingAttributes.clear();
  -	}
  -
  -	~StatePushPop()
  -	{
  -		m_listener = m_savedListener;
  -		m_pendingElementName = m_savedPendingElementName;
  -		m_pendingAttributes = m_savedPendingAttributes;
  -	}
  -
  -private:
  -
  -	FormatterListener*&			m_listener;
  -	FormatterListener* const	m_savedListener;
  -
  -	DOMString&					m_pendingElementName;
  -	const DOMString				m_savedPendingElementName;
  -
  -	AttributeListImpl&			m_pendingAttributes;
  -	const AttributeListImpl		m_savedPendingAttributes;
  -};
  -
  -
  -
  -
  -// @@ java: DocumentFragment
   ResultTreeFragBase*
   XSLTEngineImpl::createResultTreeFrag(
   			StylesheetExecutionContext&		executionContext,
  @@ -2117,41 +2096,18 @@
   
   	FormatterToDOM	tempFormatter(m_resultTreeFactory, 
   								  pfrag.get());
  -
  -	StatePushPop	theStateSaver(
  -						m_flistener,
  -						&tempFormatter,
  -						m_pendingElementName,
  -						m_pendingAttributes);
   
  -	templateChild.executeChildren(executionContext, sourceTree, sourceNode, mode);
  -
  -	return pfrag.release();
  -}
  +	m_mustFlushStartDocument = true;
   
  +	flushPending();
   
  +	StylesheetExecutionContext::ExecutionStateSetAndRestore		theStateSaveAndRestore(
  +			executionContext,
  +			&tempFormatter);
   
  -// $$$ ToDo: This is not called anywhere, can it be removed?
  -void
  -XSLTEngineImpl::writeChildren(
  -			FormatterListener*				flistener,
  -			StylesheetExecutionContext&		executionContext,
  -	        const ElemTemplateElement&		templateParent,
  -	        XalanNode&						sourceTree,
  -	        XalanNode&						sourceNode,
  -			const QName&					mode)
  -{
  -    flushPending();
  +	templateChild.executeChildren(executionContext, sourceTree, sourceNode, mode);
   
  -	StatePushPop	theStateSaver(
  -						m_flistener,
  -						flistener,
  -						m_pendingElementName,
  -						m_pendingAttributes);
  -
  -    templateParent.executeChildren(executionContext, &sourceTree, &sourceNode, mode);
  -    
  -    flushPending();
  +	return pfrag.release();
   }
   
   
  @@ -2161,8 +2117,6 @@
   {
   	const ResultTreeFragBase&	docFrag = theTree.rtree();
   
  -	// $$$ ToDo: We should optimize this so that we don't have
  -	// a node list.
   	const XalanNodeList*		nl = docFrag.getChildNodes();
   	assert(nl != 0);
   
  @@ -2256,7 +2210,6 @@
   			if(0 == length(elemNS))
   			{
   				error(XalanDOMString("Prefix must resolve to a namespace: ") + prefix);
  -			 // throw new RuntimeException(+prefix);
   			}
   
   			elemLocalName = substring(elementName, indexOfNSSep + 1);
  @@ -3601,25 +3554,6 @@
   
   
   
  -void
  -XSLTEngineImpl::setFormatter(Formatter*		formatter)
  -{
  -	flushPending();
  -
  -	m_formatter = formatter;
  -
  -	if(0 != formatter)
  -	{
  -		m_flistener = formatter->getFormatterListener();
  -	}
  -	else
  -	{
  -		m_flistener = 0;
  -	}
  -}
  -
  -
  -
   FormatterListener*
   XSLTEngineImpl::getFormatterListener() const
   {
  @@ -3631,6 +3565,13 @@
   void
   XSLTEngineImpl::setFormatterListener(FormatterListener*		flistener)
   {
  +	if (m_hasPendingStartDocument == true && m_flistener != 0)
  +	{
  +		m_mustFlushStartDocument = true;
  +
  +		flushPending();
  +	}
  +
   	m_flistener = flistener;
   }
   
  @@ -3990,9 +3931,7 @@
   
   	if (theStackEntry->getType() != StackEntry::eContextMarker)
   	{
  -		// @@ $$$ ToDo: Fix this!!!
  -		// throw InvalidStackContext();
  -		return;
  +		throw InvalidStackContextException();
   	}
   
   	VariableStackStackType		tempStack;
  @@ -4187,6 +4126,20 @@
   	}
   
   	return theResult;
  +}
  +
  +
  +
  +XSLTEngineImpl::VariableStack::InvalidStackContextException::InvalidStackContextException() :
  +	XSLTProcessorException(XALAN_STATIC_UCODE_STRING("Invalid stack context"),
  +						   XALAN_STATIC_UCODE_STRING("InvalidStackContextException"))
  +{
  +}
  +
  +
  +
  +XSLTEngineImpl::VariableStack::InvalidStackContextException::~InvalidStackContextException()
  +{
   }
   
   
  
  
  
  1.33      +67 -46    xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp
  
  Index: XSLTEngineImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- XSLTEngineImpl.hpp	2000/05/24 19:38:49	1.32
  +++ XSLTEngineImpl.hpp	2000/05/25 16:51:37	1.33
  @@ -192,23 +192,14 @@
      */
   	bool	m_outputCarriageReturns;
   
  -  /**
  -   * If true, output linefeeds.
  -   */
  +	/**
  +	 * If true, output linefeeds.
  +	 */
   	bool	m_outputLinefeeds;
   
   	/**
  -	 * The formatter interface, which has the toMarkup 
  -	 * method, and which will eventually hold other non-event 
  -	 * methods.  Not to be confused with the DocumentHandler
  -	 * interface.
  -	*/
  -	// @@ JMD: Temporarily public
  -	Formatter*			m_formatter;
  -  
  -  /**
  -   * The factory that will be used to create result tree fragments.
  -   */
  +	 * The factory that will be used to create result tree fragments.
  +	 */
   	mutable XalanDocument*	m_resultTreeFactory;
   
     /**
  @@ -1289,16 +1280,6 @@
   		return m_xpathEnvSupport;
   	}
   
  -	/**
  -	 * Set the formatter interface, which has the toMarkup method, and which
  -	 * will eventually hold other non-event methods.  Not to be confused with
  -	 * the DocumentHandler interface.
  -	 *
  -	 * @param formatter pointer to formatter
  -	 */
  -	void
  -	setFormatter(Formatter* 	formatter);
  -
   	// $$$ ToDo: why isn't this just a NodeRefListBase?
   	const MutableNodeRefList&
   	getContextNodeList() const
  @@ -1361,7 +1342,8 @@
   	 *
   	 * @param l pointer to ProblemListener interface
   	 */
  -	void setProblemListener(ProblemListener*		l)
  +	void
  +	setProblemListener(ProblemListener*		l)
   	{
   		m_problemListener = l;
   	}
  @@ -1374,11 +1356,52 @@
   	 *
   	 * @return pointer to ProblemListener interface
   	 */
  -	ProblemListener* getProblemListener() const
  +	ProblemListener*
  +	getProblemListener() const
   	{
   		return m_problemListener;
   	}
   
  +	/*
  +	 * See if there is a pending start document event waiting.
  +	 * @return true if there is a start document event waiting.
  +	 */
  +	bool
  +	getHasPendingStartDocument() const
  +	{
  +		return m_hasPendingStartDocument;
  +	}
  +
  +	/*
  +	 * Set the pending start document event state.
  +	 * @param the new value
  +	 */
  +	void
  +	setHasPendingStartDocument(bool	b)
  +	{
  +		m_hasPendingStartDocument = b;
  +	}
  +
  +	/*
  +	 * See if a pending start document event must be flushed.
  +	 * @return true if the event must be flushed.
  +	 */
  +	bool
  +	getMustFlushPendingStartDocument() const
  +	{
  +		return m_mustFlushStartDocument;
  +	}
  +
  +	/*
  +	 * Set the pending start document event flush state.
  +	 * @param the new value
  +	 */
  +	void
  +	setMustFlushPendingStartDocument(bool	b)
  +	{
  +		m_hasPendingStartDocument = b;
  +	}
  +
   	/**
   	 * An class for  exceptions that occur when a given stylesheet goes into an
   	 * infinite loop.
  @@ -1604,6 +1627,19 @@
   			return m_stack.back();
   		}
   
  +		class InvalidStackContextException : public XSLTProcessorException
  +		{
  +		public:
  +
  +			InvalidStackContextException();
  +
  +			virtual
  +			~InvalidStackContextException();
  +
  +		private:
  +
  +		};
  +
   	private:
   
   		XObject*
  @@ -1854,6 +1890,11 @@
   	 */
   	bool				m_hasPendingStartDocument;
   
  +	/*
  +	 * true if a pending startDocument() must be flushed.
  +	 */
  +	bool				m_mustFlushStartDocument;
  +
   	/**
   	 * NOTE: This replaces the ResultNameSpace class in java, since it is the
   	 * same as the NameSpace class
  @@ -2009,26 +2050,6 @@
   	 * be set by the caller.
   	 */
   	XalanDOMString m_outputFileName;
  -	
  -	/**
  -	 * Write the children of a stylesheet element to the given listener.
  -	 * @exception XSLProcessorException thrown if the active ProblemListener and XMLParserLiaison decide 
  -	 * the error condition is severe enough to halt processing.
  -	 * @param stylesheetTree The stylesheet object that holds the fragment.
  -	 * @param templateParent The template element that holds the fragment.
  -	 * @param sourceTree The source tree document context.
  -	 * @param sourceNode The current source context node.
  -	 * @param mode The mode under which the template is operating.
  -	 * @return An object that represents the result tree fragment.
  -	 */
  -	void
  -	writeChildren(
  -			FormatterListener*				flistener,
  -			StylesheetExecutionContext& 	executionContext,
  -			const ElemTemplateElement&		templateParent,
  -			XalanNode& 						sourceTree,
  -			XalanNode& 						sourceNode,
  -			const QName&					mode);
   
   
     //==========================================================