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/02/17 21:30:53 UTC

cvs commit: xml-xalan/c/src/XSLT ElemTemplateElement.cpp ElemTemplateElement.hpp Stylesheet.hpp StylesheetExecutionContextDefault.cpp StylesheetExecutionContextDefault.hpp StylesheetHandler.cpp XSLTEngineImpl.cpp XSLTEngineImpl.hpp

dbertoni    00/02/17 12:30:52

  Modified:    c/src/XSLT ElemTemplateElement.cpp ElemTemplateElement.hpp
                        Stylesheet.hpp
                        StylesheetExecutionContextDefault.cpp
                        StylesheetExecutionContextDefault.hpp
                        StylesheetHandler.cpp XSLTEngineImpl.cpp
                        XSLTEngineImpl.hpp
  Log:
  Changes for Linux build, and to match latest Xerces DOM signatures.
  
  Revision  Changes    Path
  1.6       +13 -4     xml-xalan/c/src/XSLT/ElemTemplateElement.cpp
  
  Index: ElemTemplateElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ElemTemplateElement.cpp	2000/02/04 19:07:48	1.5
  +++ ElemTemplateElement.cpp	2000/02/17 20:30:49	1.6
  @@ -190,7 +190,8 @@
   
   
   
  -DOMString ElemTemplateElement::getNamespaceForPrefix(const DOMString& prefix) const
  +DOMString
  +ElemTemplateElement::getNamespaceForPrefix(const DOMString& prefix) const
   {
       DOMString nameSpace;
       if(m_finishedConstruction == true)
  @@ -222,6 +223,14 @@
   
   
   
  +DOMString
  +ElemTemplateElement::getURI() const
  +{
  +	return getStylesheet().getBaseIdentifier();
  +}
  +
  +
  +
   /** 
    * See if this is a xmlns attribute, and, if so, process it.
    * 
  @@ -586,7 +595,7 @@
   		sourceNodes = sourceNodeContext.getChildNodes();
   	}
   
  -	int nNodes = sourceNodes.getLength();
  +	const int	nNodes = sourceNodes.getLength();
   
   	if(nNodes > 0)
   	{
  @@ -980,14 +989,14 @@
    * @param index 
    * @return org.w3c.dom.Node
    */
  -NodeImpl* ElemTemplateElement::item(unsigned long	index) 
  +NodeImpl* ElemTemplateElement::item(unsigned int	index) 
   {
       // It is assumed that the getChildNodes call synchronized
       // the children. Therefore, we can access the first child
       // reference directly.
       ElemTemplateElement*	node = m_firstChild;
   
  -    for (int i = 0; i < index && node != 0; i++) 
  +    for (unsigned int i = 0; i < index && node != 0; i++) 
       {
   		node = node->m_nextSibling;
       }
  
  
  
  1.5       +14 -5     xml-xalan/c/src/XSLT/ElemTemplateElement.hpp
  
  Index: ElemTemplateElement.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ElemTemplateElement.hpp	2000/02/04 19:07:49	1.4
  +++ ElemTemplateElement.hpp	2000/02/17 20:30:49	1.5
  @@ -58,7 +58,7 @@
   #define XALAN_ELEMTEMPLATEELEMENT_HEADER_GUARD 
   
   /**
  - * $Id: ElemTemplateElement.hpp,v 1.4 2000/02/04 19:07:49 jdonohue Exp $
  + * $Id: ElemTemplateElement.hpp,v 1.5 2000/02/17 20:30:49 dbertoni Exp $
    * 
    * $State: Exp $
    * 
  @@ -123,10 +123,19 @@
   	~ElemTemplateElement();
   
   
  +	// These interfaces are inherited from PrefixResolver...
  +
   	/** 
  -	* Given a namespace, get the corresponding prefix.
  -	*/
  -	DOMString getNamespaceForPrefix(const DOMString& prefix) const;
  +	 * Given a namespace, get the corresponding prefix.
  +	 */
  +	virtual DOMString
  +	getNamespaceForPrefix(const DOMString& prefix) const;
  +
  +
  +	virtual DOMString
  +	getURI() const;
  +
  +	// These interfaces are new to ElemTemplateElement...
   
   	/** 
   	* See if this is a xmlns attribute, and, if so, process it.
  @@ -420,7 +429,7 @@
   #else
   	virtual ElemTemplateElement*
   #endif
  -	item(unsigned long	i);
  +	item(unsigned int	i);
   
   	const Stylesheet&
   	getStylesheet() const
  
  
  
  1.4       +14 -5     xml-xalan/c/src/XSLT/Stylesheet.hpp
  
  Index: Stylesheet.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Stylesheet.hpp	2000/01/26 14:29:12	1.3
  +++ Stylesheet.hpp	2000/02/17 20:30:50	1.4
  @@ -405,13 +405,22 @@
   // JMD added Thu Sep 30 08:20:29 EDT 1999
   
      // Get the base identifier with which this stylesheet is associated.
  -	const DOMString getBaseIdentifier() { return m_baseIdent; }
  -	void setBaseIdentifier(const DOMString& str) { m_baseIdent = str; }
  +	const DOMString
  +	getBaseIdentifier() const
  +	{
  +		return m_baseIdent;
  +	}
  +
  +	void
  +	setBaseIdentifier(const DOMString& str)
  +	{
  +		m_baseIdent = str;
  +	}
   
   	/**
   	 * Add an attribute set to the list.
   	 *
  -	*/
  +	 */
   	void addAttributeSet(
   		const QName&		qname, 
   		ElemAttributeSet*	attrSet);
  @@ -497,7 +506,7 @@
   //		  throws XSLProcessorException
   private:
   
  -#if OUT
  +#if defined(OUT)
   	/**
   	 * Process imports, includes, macros, templates, etc.
   	 * into tables of various types.
  @@ -510,7 +519,7 @@
   			const DOM_Element&	stylesheet,
   			const DOMString&	base);
   
  -	@@ OUT ?
  +	//@@ OUT ?
   	/**
   	 * Get a list of the included documents into a vector.
   	 */
  
  
  
  1.2       +2 -2      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StylesheetExecutionContextDefault.cpp	2000/01/26 14:29:44	1.1
  +++ StylesheetExecutionContextDefault.cpp	2000/02/17 20:30:50	1.2
  @@ -146,14 +146,14 @@
   const NodeRefListBase&
   StylesheetExecutionContextDefault::getContextNodeList() const
   {
  -	return m_contextNodeList;
  +	return m_xpathExecutionContext.getContextNodeList();
   }
   
   
   void
   StylesheetExecutionContextDefault::setContextNodeList(const NodeRefListBase&	theContextNodeList)
   {
  -	m_contextNodeList = theContextNodeList;
  +	m_xpathExecutionContext.setContextNodeList(theContextNodeList);
   }
   
   
  
  
  
  1.2       +0 -6      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StylesheetExecutionContextDefault.hpp	2000/01/26 14:29:44	1.1
  +++ StylesheetExecutionContextDefault.hpp	2000/02/17 20:30:50	1.2
  @@ -69,10 +69,6 @@
   
   
   
  -#include <XPath/MutableNodeRefList.hpp>
  -
  -
  -
   class XPathProcessor;
   class XPathSupport;
   class XObjectFactory;
  @@ -406,8 +402,6 @@
   	const PrefixResolver*			m_prefixResolver;
   
   	StylesheetRoot*					m_stylesheetRoot;
  -
  -	MutableNodeRefList				m_contextNodeList;
   };
   
   
  
  
  
  1.6       +690 -673  xml-xalan/c/src/XSLT/StylesheetHandler.cpp
  
  Index: StylesheetHandler.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StylesheetHandler.cpp	2000/02/03 20:13:21	1.5
  +++ StylesheetHandler.cpp	2000/02/17 20:30:50	1.6
  @@ -246,7 +246,7 @@
    */
   bool StylesheetHandler::processSpaceAttr(const DOMString& aname, const AttributeList& atts, int which)
   {
  -	bool isSpaceAttr = equals(aname, "xml:space");
  +	const bool	isSpaceAttr = equals(aname, "xml:space");
   
   	if(isSpaceAttr)
   	{
  @@ -299,696 +299,713 @@
   
   	try
   	{
  +		m_whiteSpaceElems.erase(m_whiteSpaceElems.begin(),m_whiteSpaceElems.end());
   
  -	m_whiteSpaceElems.erase(m_whiteSpaceElems.begin(),m_whiteSpaceElems.end());
  -
  -	Locator* locator = m_processor.m_stylesheetLocatorStack.empty() ? 0 : 
  -		(m_processor.m_stylesheetLocatorStack.back());
  -	
  -	int lineNumber = (0 != locator) ? locator->getLineNumber() : 0;
  -	int columnNumber = (0 != locator) ? locator->getColumnNumber() : 0;
  -	
  -	if(false)
  -	{
  -		DOMString id;
  +		Locator* locator = m_processor.m_stylesheetLocatorStack.empty() ? 0 : 
  +			(m_processor.m_stylesheetLocatorStack.back());
  +		
  +		int lineNumber = (0 != locator) ? locator->getLineNumber() : 0;
  +		int columnNumber = (0 != locator) ? locator->getColumnNumber() : 0;
  +		
  +		if(false)
  +		{
  +			DOMString id;
   
  -		if (locator)
  -			if (locator->getPublicId())
  -				id = locator->getPublicId();
  -			else 
  -				id = locator->getSystemId();
  +			if (locator)
  +				if (locator->getPublicId())
  +					id = locator->getPublicId();
  +				else 
  +					id = locator->getSystemId();
   
  -		assert(locator);
  +			assert(locator);
  +			
  +	//		if(0 != locator)
  +	//			System.out.println(id + "; line " + lineNumber + 	"; "+columnNumber);
  +		}
   		
  -//		if(0 != locator)
  -//			System.out.println(id + "; line " + lineNumber + 	"; "+columnNumber);
  -	}
  -	
  -	// First push namespaces
  -	m_stylesheet.pushNamespaces(atts);
  +		// First push namespaces
  +		m_stylesheet.pushNamespaces(atts);
   
  -	DOMString ns = m_stylesheet.getNamespaceFromStack(name);
  +		DOMString ns = m_stylesheet.getNamespaceFromStack(name);
   
  -	int index = indexOf(name,':');
  +		int index = indexOf(name,':');
   
  -	DOMString localName = (index < 0) ? DOMString(name) : substring(name,index+1);
  +		DOMString localName = (index < 0) ? DOMString(name) : substring(name,index+1);
   
  -	ElemTemplateElement* elem = 0;
  +		ElemTemplateElement* elem = 0;
   
  -	const unsigned	origStackSize = m_elemStack.size();
  -
  -	if(startsWith(ns,m_processor.getXSLNameSpaceURLPre()))
  -	{
  -		if(!isEmpty(m_processor.getXSLNameSpaceURL()))
  -	        m_processor.setXSLNameSpaceURL(ns);
  +		const unsigned	origStackSize = m_elemStack.size();
   
  -		if(false == m_foundStylesheet)
  +		if(startsWith(ns,m_processor.getXSLNameSpaceURLPre()))
   		{
  -			m_stylesheet.getStylesheetRoot().initDefaultRule(m_constructionContext);
  -			m_stylesheet.setWrapperless(false);
  +			if(!isEmpty(m_processor.getXSLNameSpaceURL()))
  +				m_processor.setXSLNameSpaceURL(ns);
  +
  +			if(false == m_foundStylesheet)
  +			{
  +				m_stylesheet.getStylesheetRoot().initDefaultRule(m_constructionContext);
  +				m_stylesheet.setWrapperless(false);
  +			}
  +
  +			XSLTEngineImpl::AttributeKeysMapType::const_iterator iter=
  +				XSLTEngineImpl::getElementKeys().find(localName);
  +
  +			int xslToken = (iter!= XSLTEngineImpl::getElementKeys().end()) ? (*iter).second : -2;
  +
  +			if(!m_inTemplate)
  +			{
  +				if(m_foundStylesheet && (Constants::ELEMNAME_IMPORT != xslToken))
  +				{
  +					m_foundNotImport = true;
  +				}
  +
  +				switch(xslToken)
  +				{
  +				case Constants::ELEMNAME_TEMPLATE:
  +					m_pTemplate = new ElemTemplate(m_constructionContext,
  +												m_stylesheet,
  +												name, atts, lineNumber, columnNumber);
  +					m_elemStack.push_back(m_pTemplate);
  +					m_inTemplate = true;
  +					m_stylesheet.addTemplate(m_pTemplate);
  +					break;
  +
  +				case Constants::ELEMNAME_CSSSTYLECONVERSION:
  +					m_processor.setTranslateCSS(true);
  +					break;
  +
  +				case Constants::ELEMNAME_EXTENSION:
  +					if(!equalsIgnoreCase(ns,m_processor.getXSLT4JNameSpaceURL()))
  +					{
  +						m_processor.warn("Old syntax: the functions instruction should use a url of "+m_processor.getXSLT4JNameSpaceURL());
  +					}
  +					// m_processor.handleFunctionsInstruction((Element)child);
  +				break;
  +
  +				case Constants::ELEMNAME_VARIABLE:
  +				case Constants::ELEMNAME_PARAMVARIABLE:
  +				{
  +					ElemVariable* varelem = (Constants::ELEMNAME_PARAMVARIABLE == xslToken) 
  +									   ? new ElemParam(m_constructionContext,
  +													   m_stylesheet,
  +													   name, atts, 
  +													   lineNumber, columnNumber)
  +										 : new ElemVariable(m_constructionContext,
  +															m_stylesheet,
  +															name, atts, 
  +															lineNumber, columnNumber);
  +
  +					m_elemStack.push_back(varelem);
  +					m_inTemplate = true; // fake it out
  +					m_stylesheet.setTopLevelVariable(varelem);
  +					varelem->setTopLevel(true);
  +				}
  +				break;
  +
  +				case Constants::ELEMNAME_LOCALE:
  +					m_processor.warn("xsl:locale not yet supported!");
  +					break;
  +
  +				case Constants::ELEMNAME_PRESERVESPACE:
  +				case Constants::ELEMNAME_STRIPSPACE:
  +				{
  +					ElemEmpty nsNode(m_constructionContext, m_stylesheet, name, lineNumber, columnNumber);
  +
  +					const int nAttrs = atts.getLength();
  +
  +					bool foundIt = false;
  +
  +					for(int i = 0; i < nAttrs; i++)
  +					{
  +						const DOMString aname = atts.getName(i);
  +
  +						if(equals(aname, Constants::ATTRNAME_ELEMENTS))
  +						{
  +							foundIt = true;
  +							StringTokenizer tokenizer(atts.getValue(i), " \t\n\r");
  +							while(tokenizer.hasMoreTokens())
  +							{
  +								// Use only the root, at least for right now.
  +								const DOMString wildcardName = tokenizer.nextToken();
  +
  +								/**
  +								 * Creating a match pattern is too much overhead, but it's a reasonably 
  +								 * easy and safe way to do this right now.  TODO: Validate the pattern 
  +								 * to make sure it's a WildcardName.
  +								 */
  +								const XPath* const	matchPat =
  +										m_constructionContext.createMatchPattern(wildcardName, nsNode);
  +
  +								if(Constants::ELEMNAME_PRESERVESPACE == xslToken)
  +								{
  +									m_stylesheet.getStylesheetRoot().m_whitespacePreservingElements.push_back(matchPat);
  +								}
  +								else
  +								{
  +									m_stylesheet.getStylesheetRoot().m_whitespaceStrippingElements.push_back(matchPat);
  +								}
  +							}
  +						}
  +						else if(!isAttrOK(aname, atts, i))
  +						{
  +								m_constructionContext.error(DOMString(name) + " has an illegal attribute: " + aname);
  +						}
  +					}
  +
  +					if(!foundIt)
  +					{
  +						DOMString msg("(StylesheetHandler) " + DOMString(name) +
  +						" requires a " + Constants::ATTRNAME_ELEMENTS + " attribute!");
  +
  +						throw SAXException(toCharArray(msg));
  +					}
  +				}
  +				break;
  +
  +				case Constants::ELEMNAME_KEY:
  +				{
  +					ElemEmpty nsContext(m_constructionContext, m_stylesheet, name, lineNumber, columnNumber);
  +
  +					m_stylesheet.processKeyElement(&nsContext, atts, m_constructionContext);
  +				}
  +				break;
  +
  +				case Constants::ELEMNAME_DEFINEATTRIBUTESET:
  +				{
  +					m_inTemplate = true; // fake it out
  +
  +					ElemAttributeSet* attrSet = new ElemAttributeSet(m_constructionContext,
  +															   m_stylesheet,
  +															   name,
  +															   atts,
  +															   lineNumber,
  +															   columnNumber);
  +					m_elemStack.push_back(attrSet);
  +				}
  +				break;
  +
  +				case Constants::ELEMNAME_INCLUDE:
  +					processInclude(name, atts);
  +					break;
  +
  +				case Constants::ELEMNAME_IMPORT:
  +					processImport(name, atts);
  +					break;
  +
  +				case Constants::ELEMNAME_OUTPUT:
  +					m_stylesheet.getStylesheetRoot().processOutputSpec(name, atts, m_constructionContext);
  +					break;
  +
  +				case Constants::ELEMNAME_WITHPARAM:
  +				case Constants::ELEMNAME_ATTRIBUTE:
  +				case Constants::ELEMNAME_APPLY_TEMPLATES:
  +				case Constants::ELEMNAME_USE:
  +				case Constants::ELEMNAME_CHILDREN:
  +				case Constants::ELEMNAME_CHOOSE:
  +				case Constants::ELEMNAME_COMMENT:
  +				case Constants::ELEMNAME_CONSTRUCT:
  +				case Constants::ELEMNAME_CONTENTS:
  +				case Constants::ELEMNAME_COPY:
  +				case Constants::ELEMNAME_COPY_OF:
  +				case Constants::ELEMNAME_DISPLAYIF:
  +				case Constants::ELEMNAME_EVAL:
  +				case Constants::ELEMNAME_EXPECTEDCHILDREN:
  +				case Constants::ELEMNAME_FOREACH:
  +				case Constants::ELEMNAME_IF:
  +				case Constants::ELEMNAME_CALLTEMPLATE:
  +				case Constants::ELEMNAME_MESSAGE:
  +				case Constants::ELEMNAME_NUMBER:
  +				case Constants::ELEMNAME_OTHERWISE:
  +				case Constants::ELEMNAME_PI:
  +				case Constants::ELEMNAME_REMOVEATTRIBUTE:
  +				case Constants::ELEMNAME_SORT:
  +				case Constants::ELEMNAME_TEXT:
  +				case Constants::ELEMNAME_VALUEOF:
  +				case Constants::ELEMNAME_WHEN:
  +				case Constants::ELEMNAME_ELEMENT:
  +				case Constants::ELEMNAME_COUNTER:
  +				case Constants::ELEMNAME_COUNTERS:
  +				case Constants::ELEMNAME_COUNTERINCREMENT:
  +				case Constants::ELEMNAME_COUNTERRESET:
  +				case Constants::ELEMNAME_COUNTERSCOPE:
  +				case Constants::ELEMNAME_APPLY_IMPORTS:
  +				{
  +					DOMString msg("(StylesheetHandler) " + DOMString(name) + " not allowed inside a stylesheet!");
  +
  +					throw SAXException(toCharArray(msg));
  +				}
  +				// break;
  +
  +				case Constants::ELEMNAME_STYLESHEET:
  +				{
  +					m_stylesheet.setWrapperless(false);
  +					m_foundStylesheet = true;
  +					const int	nAttrs = atts.getLength();
  +					bool		fVersionFound = false;
  +
  +					// bool didSpecifiyIndent = false;	//doesn't seem to be used
  +
  +					for(int i = 0; i < nAttrs; i++)
  +					{
  +						const DOMString	aname = atts.getName(i);
  +
  +						if(equals(aname, "result-ns"))
  +						{
  +							throw SAXException("result-ns no longer supported!  Use xsl:output instead.");
  +						}
  +						else if(equals(aname, Constants::ATTRNAME_DEFAULTSPACE))
  +						{
  +							throw SAXException("default-space no longer supported!  Use xsl:strip-space or xsl:preserve-space instead.");
  +						}
  +						else if(equals(aname, Constants::ATTRNAME_EXTENSIONELEMENTPREFIXES))
  +						{
  +							// BEGIN SANJIVA CODE
  +							StringTokenizer tokenizer(atts.getValue (i), " \t\n\r", false);
  +
  +							while(tokenizer.hasMoreTokens ()) 
  +							{
  +								const DOMString prefix = tokenizer.nextToken ();
  +								// SANJIVA: ask Scott: is the line below correct?
  +
  +								const DOMString extns = m_stylesheet.getNamespaceForPrefixFromStack(prefix);
  +
  +								ExtensionNSHandler* const	nsh = new ExtensionNSHandler (m_processor, extns);
  +								m_stylesheet.addExtensionNamespace(extns, nsh);
  +							}
  +							// END SANJIVA CODE
  +						}
  +						else if(equals(aname, "id"))
  +						{
  +							//
  +						}
  +						else if(equals(aname, "indent-result"))
  +						{
  +							throw SAXException("indent-result no longer supported!  Use xsl:output instead.");
  +						}
  +						else if(equals(aname, "version"))
  +						{
  +							const DOMString versionStr = atts.getValue(i);
  +
  +							m_stylesheet.setXSLTVerDeclared(DOMStringToDouble(versionStr));
  +
  +							fVersionFound = true;
  +						}
  +						else if(!(isAttrOK(aname, atts, i) || processSpaceAttr(aname, atts, i)))
  +						{
  +							if(false == m_stylesheet.isWrapperless())
  +							{
  +								DOMString msg("(StylesheetHandler) " + DOMString(name) + 
  +											  " has an illegal attribute: " + aname);
  +
  +								throw SAXException(toCharArray(msg));
  +							}
  +						}
  +
  +						if(!m_stylesheet.getNamespaces().empty())
  +						{
  +							m_stylesheet.setNamespaceDecls(m_stylesheet.getNamespaces().back());
  +						}
  +					}
  +
  +					if (fVersionFound == false)
  +					{
  +						const DOMString		msg("The stylesheet element did not specify a version attribute!");
  +
  +						throw SAXException(toCharArray(msg));
  +					}
  +				}
  +				break;
  +
  +				default:
  +				{
  +					DOMString msg("Unknown XSL element: " + localName);
  +
  +					throw SAXException(toCharArray(msg));
  +				}
  +				break;
  +
  +			}
   		}
  -      
  -		XSLTEngineImpl::AttributeKeysMapType::const_iterator iter=
  -			XSLTEngineImpl::getElementKeys().find(localName);
  -
  -		int xslToken = (iter!= XSLTEngineImpl::getElementKeys().end()) ? (*iter).second : -2;
  -
  -      if(!m_inTemplate)
  -      {
  -		  if(m_foundStylesheet && (Constants::ELEMNAME_IMPORT != xslToken))
  -        {
  -          m_foundNotImport = true;
  -        }
  -        
  -        switch(xslToken)
  -        {            
  -        case Constants::ELEMNAME_TEMPLATE:
  -          m_pTemplate = new ElemTemplate(m_constructionContext,
  -                                        m_stylesheet,
  -                                        name, atts, lineNumber, columnNumber);
  -          m_elemStack.push_back(m_pTemplate);
  -          m_inTemplate = true;
  -          m_stylesheet.addTemplate(m_pTemplate);
  -          break;
  -
  -        case Constants::ELEMNAME_CSSSTYLECONVERSION:
  -          m_processor.setTranslateCSS(true);
  -          break;
  -
  -        case Constants::ELEMNAME_EXTENSION:
  -          {
  -            if(!equalsIgnoreCase(ns,m_processor.getXSLT4JNameSpaceURL()))
  -            {
  -              m_processor.warn("Old syntax: the functions instruction should use a url of "+m_processor.getXSLT4JNameSpaceURL());
  -            }
  -            // m_processor.handleFunctionsInstruction((Element)child);
  -          }
  -          break;
  -
  -        case Constants::ELEMNAME_VARIABLE:
  -        case Constants::ELEMNAME_PARAMVARIABLE:
  -          {
  -			  ElemVariable* varelem = (Constants::ELEMNAME_PARAMVARIABLE == xslToken) 
  -                                   ? new ElemParam(m_constructionContext,
  -                                                   m_stylesheet,
  -                                                   name, atts, 
  -                                                   lineNumber, columnNumber)
  -                                     : new ElemVariable(m_constructionContext,
  -                                                        m_stylesheet,
  -                                                        name, atts, 
  -                                                        lineNumber, columnNumber);
  -            m_elemStack.push_back(varelem);
  -            m_inTemplate = true; // fake it out
  -            m_stylesheet.setTopLevelVariable(varelem);
  -            varelem->setTopLevel(true);
  -          }
  -          break;
  -          
  -        case Constants::ELEMNAME_LOCALE:
  -          m_processor.warn("xsl:locale not yet supported!");
  -          break;
  -
  -        case Constants::ELEMNAME_PRESERVESPACE:
  -        case Constants::ELEMNAME_STRIPSPACE:
  -          {
  -            ElemEmpty nsNode(m_constructionContext, m_stylesheet, name, lineNumber, columnNumber);
  +		else
  +		{
  +			switch(xslToken)
  +			{            
  +			case Constants::ELEMNAME_APPLY_TEMPLATES:
  +				elem = new ElemApplyTemplates(m_constructionContext,
  +											m_stylesheet,
  +											name, atts, lineNumber, columnNumber);
  +				break;
  +          
  +			case Constants::ELEMNAME_CALLTEMPLATE:
  +				elem = new ElemCallTemplate(m_constructionContext,
  +										  m_stylesheet,
  +										  name, atts, lineNumber, columnNumber);
  +				break;
  +          
  +			case Constants::ELEMNAME_WITHPARAM:
  +				elem = new ElemWithParam(m_constructionContext,
  +									   m_stylesheet,
  +									   name, atts, lineNumber, columnNumber);
  +				break;
  +          
  +			case Constants::ELEMNAME_FOREACH:
  +				elem = new ElemForEach(m_constructionContext,
  +									 m_stylesheet,
  +									 name, atts, lineNumber, columnNumber, true);
  +				break;
  +          
  +			case Constants::ELEMNAME_SORT:
  +				{
  +					ElemForEach* foreach = dynamic_cast<ElemForEach*>(m_elemStack.back());
  +
  +					ElemSort* sortElem = new ElemSort(m_constructionContext,
  +												 m_stylesheet,
  +												 name, atts, lineNumber, columnNumber);
               
  -            const int nAttrs = atts.getLength();
  +					foreach->getSortElems().push_back(sortElem);
  +					sortElem->setParentNode(foreach);
  +				}
  +				break;
   
  -            bool foundIt = false;
  +			case Constants::ELEMNAME_APPLY_IMPORTS:
  +				elem = new ElemApplyImport(m_constructionContext,
  +										 m_stylesheet,
  +										 name, atts, lineNumber, columnNumber);
  +				break;
  +          
  +			case Constants::ELEMNAME_VALUEOF:
  +				elem = new ElemValueOf(m_constructionContext,
  +									 m_stylesheet,
  +									 name, atts, lineNumber, columnNumber);
  +				break;
  +
  +			case Constants::ELEMNAME_NUMBER:
  +				elem = new ElemNumber(m_constructionContext,
  +									m_stylesheet,
  +									name, atts, lineNumber, columnNumber);
  +				break;
  +          
  +			case Constants::ELEMNAME_VARIABLE:
  +				elem = new ElemVariable(m_constructionContext,
  +									  m_stylesheet,
  +									  name, atts, lineNumber, columnNumber);
  +				break;
  +
  +			case Constants::ELEMNAME_PARAMVARIABLE:
  +				elem = new ElemParam(m_constructionContext,
  +								   m_stylesheet,
  +								   name, atts, lineNumber, columnNumber);
  +				break;
  +          
  +			case Constants::ELEMNAME_IF:
  +				elem = new ElemIf(m_constructionContext,
  +								m_stylesheet,
  +								name, atts, lineNumber, columnNumber);
  +				break;
  +
  +			case Constants::ELEMNAME_CHOOSE:
  +				elem = new ElemChoose(m_constructionContext,
  +									m_stylesheet,
  +									name, atts, lineNumber, columnNumber);
  +				break;
  +          
  +			case Constants::ELEMNAME_WHEN:
  +				{
  +					ElemTemplateElement* const	parent = m_elemStack.back();
   
  -            for(int i = 0; i < nAttrs; i++)
  -            {
  -              const DOMString aname = atts.getName(i);
  -              if(equals(aname, Constants::ATTRNAME_ELEMENTS))
  -              {
  -                foundIt = true;
  -                StringTokenizer tokenizer(atts.getValue(i), " \t\n\r");
  -                while(tokenizer.hasMoreTokens())
  -                {
  -                  // Use only the root, at least for right now.
  -                  const DOMString wildcardName = tokenizer.nextToken();
  -                  
  -                  /**
  -                  * Creating a match pattern is too much overhead, but it's a reasonably 
  -                  * easy and safe way to do this right now.  TODO: Validate the pattern 
  -                  * to make sure it's a WildcardName.
  -                  */
  -                  const XPath* const	matchPat = m_constructionContext.createMatchPattern(wildcardName, nsNode);
  -                  
  -                  if(Constants::ELEMNAME_PRESERVESPACE == xslToken)
  -                  {
  -                    m_stylesheet.getStylesheetRoot().m_whitespacePreservingElements.push_back(matchPat);
  -                  }
  -                  else
  -                  {
  -                    m_stylesheet.getStylesheetRoot().m_whitespaceStrippingElements.push_back(matchPat);
  -                  }
  -                }
  -              }
  -              else if(!isAttrOK(aname, atts, i))
  -              {
  -				m_constructionContext.error(DOMString(name) + " has an illegal attribute: " + aname);
  -              }
  -            }
  -            if(!foundIt)
  -            {
  -				DOMString msg("(StylesheetHandler) " + DOMString(name) +
  -					" requires a " + Constants::ATTRNAME_ELEMENTS + " attribute!");
  +					if(Constants::ELEMNAME_CHOOSE == parent->getXSLToken())
  +					{
  +						ElemTemplateElement* const	lastChild = dynamic_cast<ElemTemplateElement*>(parent->getLastChild());
  +
  +						if((0 == lastChild) || 
  +							(Constants::ELEMNAME_WHEN == lastChild->getXSLToken()))
  +						{
  +							elem = new ElemWhen(m_constructionContext,
  +										m_stylesheet,
  +										name, atts, lineNumber, columnNumber);
  +						}
  +						else
  +						{
  +							throw SAXException("(StylesheetHandler) misplaced xsl:when!");
  +						}
  +					}
  +					else
  +					{
  +						throw SAXException("(StylesheetHandler) xsl:when not parented by xsl:choose!");
  +					}
  +				}
  +				break;
  +          
  +			case Constants::ELEMNAME_OTHERWISE:
  +				{
  +					ElemTemplateElement* parent = m_elemStack.back();
   
  -				throw SAXException(toCharArray(msg));
  -            }
  -          }
  -          break;
  -          
  -        case Constants::ELEMNAME_KEY:
  -          {
  -            ElemEmpty nsContext(m_constructionContext, m_stylesheet, name, lineNumber, columnNumber);
  -            m_stylesheet.processKeyElement(&nsContext, atts, m_constructionContext);
  -          }
  -          break;
  -          
  -        case Constants::ELEMNAME_DEFINEATTRIBUTESET:
  -		{
  -          m_inTemplate = true; // fake it out
  -          ElemAttributeSet* attrSet = new ElemAttributeSet(m_constructionContext,
  -                                                           m_stylesheet,
  -                                                           name,
  -														   atts,
  -                                                           lineNumber,
  -                                                           columnNumber);
  -          m_elemStack.push_back(attrSet);
  -		}
  -          break;
  -          
  -        case Constants::ELEMNAME_INCLUDE:
  -          processInclude(name, atts);
  -          break;
  -          
  -        case Constants::ELEMNAME_IMPORT:
  -          processImport(name, atts);
  -          break;
  -          
  -        case Constants::ELEMNAME_OUTPUT:
  -          m_stylesheet.getStylesheetRoot().processOutputSpec(name, atts, m_constructionContext);
  -          break;
  -          
  -        case Constants::ELEMNAME_WITHPARAM:
  -        case Constants::ELEMNAME_ATTRIBUTE:
  -        case Constants::ELEMNAME_APPLY_TEMPLATES:
  -        case Constants::ELEMNAME_USE:
  -        case Constants::ELEMNAME_CHILDREN:
  -        case Constants::ELEMNAME_CHOOSE:
  -        case Constants::ELEMNAME_COMMENT:
  -        case Constants::ELEMNAME_CONSTRUCT:
  -        case Constants::ELEMNAME_CONTENTS:
  -        case Constants::ELEMNAME_COPY:
  -        case Constants::ELEMNAME_COPY_OF:
  -        case Constants::ELEMNAME_DISPLAYIF:
  -        case Constants::ELEMNAME_EVAL:
  -        case Constants::ELEMNAME_EXPECTEDCHILDREN:
  -        case Constants::ELEMNAME_FOREACH:
  -        case Constants::ELEMNAME_IF:
  -        case Constants::ELEMNAME_CALLTEMPLATE:
  -        case Constants::ELEMNAME_MESSAGE:
  -        case Constants::ELEMNAME_NUMBER:
  -        case Constants::ELEMNAME_OTHERWISE:
  -        case Constants::ELEMNAME_PI:
  -        case Constants::ELEMNAME_REMOVEATTRIBUTE:
  -        case Constants::ELEMNAME_SORT:
  -        case Constants::ELEMNAME_TEXT:
  -        case Constants::ELEMNAME_VALUEOF:
  -        case Constants::ELEMNAME_WHEN:
  -        case Constants::ELEMNAME_ELEMENT:
  -        case Constants::ELEMNAME_COUNTER:
  -        case Constants::ELEMNAME_COUNTERS:
  -        case Constants::ELEMNAME_COUNTERINCREMENT:
  -        case Constants::ELEMNAME_COUNTERRESET:
  -        case Constants::ELEMNAME_COUNTERSCOPE:
  -        case Constants::ELEMNAME_APPLY_IMPORTS:
  -		{
  -
  -			DOMString msg("(StylesheetHandler) " + DOMString(name) + " not allowed inside a stylesheet!");
  -			throw SAXException(toCharArray(msg));
  -		}
  -          // break;
  -
  -        case Constants::ELEMNAME_STYLESHEET:
  -		{
  -          m_stylesheet.setWrapperless(false);
  -          m_foundStylesheet = true;
  -          int nAttrs = atts.getLength();
  -//          bool didSpecifiyIndent = false;	//doesn't seem to be used
  -          for(int i = 0; i < nAttrs; i++)
  -          {
  -            const DOMString	aname = atts.getName(i);
  -            if(equals(aname, "result-ns"))
  -            {
  -              throw SAXException("result-ns no longer supported!  Use xsl:output instead.");
  -            }
  -            else if(equals(aname, Constants::ATTRNAME_DEFAULTSPACE))
  -            {
  -              throw SAXException("default-space no longer supported!  Use xsl:strip-space or xsl:preserve-space instead.");
  -            }
  -            else if(equals(aname, Constants::ATTRNAME_EXTENSIONELEMENTPREFIXES))
  -            {
  -              // BEGIN SANJIVA CODE
  -              StringTokenizer tokenizer(atts.getValue (i), " \t\n\r", false);
  -
  -              while(tokenizer.hasMoreTokens ()) 
  -              {
  -                const DOMString prefix = tokenizer.nextToken ();
  -                // SANJIVA: ask Scott: is the line below correct?
  -                const DOMString extns = m_stylesheet.getNamespaceForPrefixFromStack (prefix);
  -                ExtensionNSHandler* nsh = new ExtensionNSHandler (m_processor, extns);
  -                m_stylesheet.addExtensionNamespace(extns, nsh);
  -              }
  -              // END SANJIVA CODE
  -            }
  -            else if(equals(aname, "id"))
  -            {
  -              //
  -            }
  -            else if(equals(aname, "indent-result"))
  -            {
  -              throw SAXException("indent-result no longer supported!  Use xsl:output instead.");
  -            }
  -            else if(equals(aname, "version"))
  -            {
  -              const DOMString versionStr = atts.getValue(i);
  -			  m_stylesheet.setXSLTVerDeclared(DOMStringToDouble(versionStr));
  -            }
  -            else if(!(isAttrOK(aname, atts, i) || processSpaceAttr(aname, atts, i)))
  -            {
  -              if(false == m_stylesheet.isWrapperless())
  -			  {
  -				DOMString msg("(StylesheetHandler) " + DOMString(name) + 
  -					" has an illegal attribute: " + aname);
  +					if(Constants::ELEMNAME_CHOOSE == parent->getXSLToken())
  +					{
  +						ElemTemplateElement* lastChild = dynamic_cast<ElemTemplateElement*>(parent->getLastChild());
  +
  +						if((0 == lastChild) || 
  +							(Constants::ELEMNAME_WHEN == lastChild->getXSLToken()))
  +						{
  +							elem = new ElemOtherwise(m_constructionContext,
  +											 m_stylesheet,
  +											 name, atts, lineNumber, columnNumber);
  +						}
  +						else
  +						{
  +							throw SAXException("(StylesheetHandler) misplaced xsl:otherwise!");
  +						}
  +					}
  +					else
  +					{
  +						throw SAXException("(StylesheetHandler) xsl:otherwise not parented by xsl:choose!");
  +					}
  +				}
  +				break;
   
  -				throw SAXException(toCharArray(msg));
  -			  }
  -            }
  -            else if(startsWith(aname,"xmlns:"))
  +			case Constants::ELEMNAME_COPY_OF:
  +				elem = new ElemCopyOf(m_constructionContext,
  +									m_stylesheet,
  +									name, atts, lineNumber, columnNumber);
  +				break;
  +
  +			case Constants::ELEMNAME_COPY:
  +				elem = new ElemCopy(m_constructionContext,
  +								  m_stylesheet,
  +								  name, atts, lineNumber, columnNumber);
  +				break;
  +
  +			case Constants::ELEMNAME_TEXT:
  +			  // Just push the element on the stack to signal
  +			  // that space should be preserved.
  +				m_elemStack.push_back(new ElemText(m_constructionContext,
  +										m_stylesheet,
  +										name, atts, lineNumber, columnNumber));
  +				break;
  +
  +			case Constants::ELEMNAME_USE:
  +				elem = new ElemUse(m_constructionContext,
  +								 m_stylesheet,
  +								 name, lineNumber, columnNumber);
  +				break;
  +
  +			case Constants::ELEMNAME_ATTRIBUTE:
  +				elem = new ElemAttribute(m_constructionContext,
  +									   m_stylesheet,
  +									   name, atts, lineNumber, columnNumber);
  +				break;
  +
  +			case Constants::ELEMNAME_ELEMENT:
  +				elem = new ElemElement(m_constructionContext,
  +									 m_stylesheet,
  +									 name, atts, lineNumber, columnNumber);
  +			  break;
  +          
  +			case Constants::ELEMNAME_PI:
  +				elem = new ElemPI(m_constructionContext,
  +								m_stylesheet,
  +								name, atts, lineNumber, columnNumber);
  +			  break;
  +
  +			case Constants::ELEMNAME_COMMENT:
  +				elem = new ElemComment(m_constructionContext,
  +									 m_stylesheet,
  +									 name, atts, lineNumber, columnNumber);
  +			  break;
  +          
  +			case Constants::ELEMNAME_MESSAGE:
  +				elem = new ElemMessage(m_constructionContext,
  +									 m_stylesheet,
  +									 name, atts, lineNumber, columnNumber);
  +
  +				break;
  +          
  +			case Constants::ELEMNAME_TEMPLATE:
  +			case Constants::ELEMNAME_LOCALE:
  +			case Constants::ELEMNAME_DEFINEATTRIBUTESET:
  +			case Constants::ELEMNAME_DEFINESCRIPT:
  +			case Constants::ELEMNAME_EXTENSION:
  +			case Constants::ELEMNAME_EXTENSIONHANDLER:
  +			case Constants::ELEMNAME_KEY:
  +			case Constants::ELEMNAME_IMPORT:
  +			case Constants::ELEMNAME_INCLUDE:
  +			case Constants::ELEMNAME_PRESERVESPACE:
  +			case Constants::ELEMNAME_STRIPSPACE:
  +				{
  +					DOMString msg("(StylesheetHandler) " + DOMString(name) + " is not allowed inside a template!");
  +					throw SAXException(toCharArray(msg));
  +				}
  +				break;
  +
  +			default:
  +			  // If this stylesheet is declared to be of a higher version than the one
  +				  // supported, don't flag an error.
  +				if(XSLTEngineImpl::getXSLTVerSupported() < m_stylesheet.getXSLTVerDeclared())
  +				{
  +					DOMString msg("Unknown XSL element: " + localName);
  +					throw SAXException(toCharArray(msg));
  +				}
  +			}
  +		  }
  +		}
  +		// BEGIN SANJIVA CODE
  +		else if (!m_inTemplate && startsWith(ns,m_processor.getXSLT4JNameSpaceURL()))
  +		{
  +			if (equals(localName, "component")) 
   			{
  -// rcw to do: in the final recommendation version is specified as an attribute
  -#if 0
  -              const DOMString nsDeclVal = atts.getValue(i);
  -              if(startsWith(nsDeclVal,m_processor.getXSLNameSpaceURLPre()))
  -              {
  -				int lenOfPre = m_processor.getXSLNameSpaceURLPre().length();
  -				const DOMString versionStr = substring(nsDeclVal,lenOfPre+1);
  -				if(versionStr.length() > 1)
  -				{
  -					m_stylesheet.setXSLTVerDeclared(DOMStringToDouble(versionStr));
  -				}
  -              }
  -#endif
  -            }
  -
  -            if(!m_stylesheet.getNamespaces().empty())
  -            {
  -              m_stylesheet.setNamespaceDecls(m_stylesheet.getNamespaces().back());
  -            }
  -
  -            /*
  -            default:
  -            if((null != ns) && (ns.equalsIgnoreCase(m_processor.m_XSLNameSpaceURL) || 
  -            ns.equalsIgnoreCase(m_processor.m_XML4JNameSpaceURL)))
  -            {
  -            m_processor.warn(name
  -            +" unknown XSL instruction inside context of the stylesheet element!");
  -            }
  -            // be tolerant of other namespaces
  -            break;
  -            */
  -          }
  -        }  
  -          break;
  -        default:
  -		{
  -			DOMString msg("Unknown XSL element: " + localName);
  -			throw SAXException(toCharArray(msg));
  -		}
  -        }
  -      }
  -      else
  -      {
  -        switch(xslToken)
  -        {            
  -        case Constants::ELEMNAME_APPLY_TEMPLATES:
  -          elem = new ElemApplyTemplates(m_constructionContext,
  -                                        m_stylesheet,
  -                                        name, atts, lineNumber, columnNumber);
  -          break;
  -          
  -        case Constants::ELEMNAME_CALLTEMPLATE:
  -          elem = new ElemCallTemplate(m_constructionContext,
  -                                      m_stylesheet,
  -                                      name, atts, lineNumber, columnNumber);
  -          break;
  -          
  -        case Constants::ELEMNAME_WITHPARAM:
  -          elem = new ElemWithParam(m_constructionContext,
  -                                   m_stylesheet,
  -                                   name, atts, lineNumber, columnNumber);
  -          break;
  -          
  -        case Constants::ELEMNAME_FOREACH:
  -          elem = new ElemForEach(m_constructionContext,
  -                                 m_stylesheet,
  -                                 name, atts, lineNumber, columnNumber, true);
  -          break;
  -          
  -        case Constants::ELEMNAME_SORT:
  -		{
  -            ElemForEach* foreach = dynamic_cast<ElemForEach*>(m_elemStack.back());
  -
  -            ElemSort* sortElem = new ElemSort(m_constructionContext,
  -                                             m_stylesheet,
  -                                             name, atts, lineNumber, columnNumber);
  -            
  -            foreach->getSortElems().push_back(sortElem);
  -            sortElem->setParentNode(foreach);
  +				DOMString prefix;
  +				DOMString elements;
  +				DOMString functions;
  +
  +				const int nAttrs = atts.getLength();
  +
  +				for (int i = 0; i < nAttrs; i++) 
  +				{
  +					const DOMString		aname = atts.getName (i);
  +
  +					if (equals(aname, "prefix")) 
  +					{
  +						prefix = atts.getValue (i);
  +					}
  +					else if (equals(aname, "elements")) 
  +					{
  +						elements = atts.getValue (i);
  +					}
  +					else if (equals(aname, "functions")) 
  +					{
  +						functions = atts.getValue (i);
  +					}
  +					else if(!isAttrOK(aname, atts, i))
  +					{
  +						m_constructionContext.error(DOMString(name) + " has an illegal attribute: " + aname);
  +					}
  +				}
  +
  +				if (isEmpty(prefix)) 
  +				{
  +					DOMString msg("StylesheetHandler) " + DOMString(name) + " attribute 'prefix' is missing");
  +
  +					throw SAXException(toCharArray(msg));
  +				}
  +
  +				// SCOTT: is the line below correct?
  +				DOMString extns = m_stylesheet.getNamespaceForPrefixFromStack (prefix);
  +				ExtensionNSHandler* nsh = m_stylesheet.lookupExtensionNSHandler(extns);
  +
  +				if (nsh == 0) 
  +				{
  +					DOMString msg("(StylesheetHandler) " + DOMString(name) + " extension namespace prefix '" + prefix + "' unknown");
  +
  +					throw SAXException(toCharArray(msg));
  +				}
  +
  +				if (!isEmpty(elements)) 
  +				{
  +					nsh->setElements(elements);
  +				}
  +
  +				if (!isEmpty(functions)) 
  +				{
  +					nsh->setFunctions(functions);
  +				}
  +
  +				m_pLXSLTExtensionNSH = nsh; // hang on to it for processing 
  +				// endElement on lxslt:script
  +			}
  +			else if (equals(localName, "script")) 
  +			{
  +				// process this in end element so that I can see whether I had 
  +				// a body as well. The default pushing logic will save the 
  +				// attributes for me. The body will be accumulated into the
  +				// following string buffer
  +				m_inLXSLTScript = true;
  +				m_LXSLTScriptBody = DOMString();
  +
  +				const int	nAttrs = atts.getLength();
  +
  +				for (int i = 0; i < nAttrs; i++) 
  +				{
  +
  +					const DOMString		aname = atts.getName(i);
  +
  +					if (equals(aname, "lang")) 
  +					{
  +						m_LXSLTScriptLang = atts.getValue (i);
  +					}
  +					else if (aname.equals ("src")) 
  +					{
  +						m_LXSLTScriptSrcURL = atts.getValue (i);
  +					}
  +					else if(!isAttrOK(aname, atts, i))
  +					{
  +						m_constructionContext.error(DOMString(name) + " has an illegal attribute: " + aname);
  +					}
  +				}
  +			}
  +			else 
  +			{
  +				// other xslt4j: element. Not my business.
  +			}
   		}
  -          break;
  -          
  -        case Constants::ELEMNAME_APPLY_IMPORTS:
  -          elem = new ElemApplyImport(m_constructionContext,
  -                                     m_stylesheet,
  -                                     name, atts, lineNumber, columnNumber);
  -          break;
  -          
  -        case Constants::ELEMNAME_VALUEOF:
  -          elem = new ElemValueOf(m_constructionContext,
  -                                 m_stylesheet,
  -                                 name, atts, lineNumber, columnNumber);
  -          break;
  -
  -        case Constants::ELEMNAME_NUMBER:
  -          elem = new ElemNumber(m_constructionContext,
  -                                m_stylesheet,
  -                                name, atts, lineNumber, columnNumber);
  -          break;
  -          
  -        case Constants::ELEMNAME_VARIABLE:
  -          elem = new ElemVariable(m_constructionContext,
  -                                  m_stylesheet,
  -                                  name, atts, lineNumber, columnNumber);
  -          break;
  -
  -        case Constants::ELEMNAME_PARAMVARIABLE:
  -          elem = new ElemParam(m_constructionContext,
  -                               m_stylesheet,
  -                               name, atts, lineNumber, columnNumber);
  -          break;
  -          
  -        case Constants::ELEMNAME_IF:
  -          elem = new ElemIf(m_constructionContext,
  -                            m_stylesheet,
  -                            name, atts, lineNumber, columnNumber);
  -          break;
  -
  -        case Constants::ELEMNAME_CHOOSE:
  -          elem = new ElemChoose(m_constructionContext,
  -                                m_stylesheet,
  -                                name, atts, lineNumber, columnNumber);
  -          break;
  -          
  -        case Constants::ELEMNAME_WHEN:
  -          {
  -            ElemTemplateElement* parent = m_elemStack.back();
  -            if(Constants::ELEMNAME_CHOOSE == parent->getXSLToken())
  -            {
  -              ElemTemplateElement* lastChild = dynamic_cast<ElemTemplateElement*>(parent->getLastChild());
  -              if((0 == lastChild) || 
  -                 (Constants::ELEMNAME_WHEN == lastChild->getXSLToken()))
  -              {
  -                elem = new ElemWhen(m_constructionContext,
  -                                    m_stylesheet,
  -                                    name, atts, lineNumber, columnNumber);
  -              }
  -              else
  -              {
  -                throw SAXException("(StylesheetHandler) misplaced xsl:when!");
  -              }
  -            }
  -            else
  -            {
  -              throw SAXException("(StylesheetHandler) xsl:when not parented by xsl:choose!");
  -            }
  -          }
  -          break;
  -          
  -        case Constants::ELEMNAME_OTHERWISE:
  -          {
  -            ElemTemplateElement* parent = m_elemStack.back();
  -            if(Constants::ELEMNAME_CHOOSE == parent->getXSLToken())
  -            {
  -              ElemTemplateElement* lastChild = dynamic_cast<ElemTemplateElement*>(parent->getLastChild());
  -              if((0 == lastChild) || 
  -                 (Constants::ELEMNAME_WHEN == lastChild->getXSLToken()))
  -              {
  -                elem = new ElemOtherwise(m_constructionContext,
  -                                         m_stylesheet,
  -                                         name, atts, lineNumber, columnNumber);
  -              }
  -              else
  -              {
  -                throw SAXException("(StylesheetHandler) misplaced xsl:otherwise!");
  -              }
  -            }
  -            else
  -            {
  -              throw SAXException("(StylesheetHandler) xsl:otherwise not parented by xsl:choose!");
  -            }
  -          }
  -          break;
  -
  -        case Constants::ELEMNAME_COPY_OF:
  -          elem = new ElemCopyOf(m_constructionContext,
  -                                m_stylesheet,
  -                                name, atts, lineNumber, columnNumber);
  -          break;
  -
  -        case Constants::ELEMNAME_COPY:
  -          elem = new ElemCopy(m_constructionContext,
  -                              m_stylesheet,
  -                              name, atts, lineNumber, columnNumber);
  -          break;
  -
  -        case Constants::ELEMNAME_TEXT:
  -          // Just push the element on the stack to signal
  -          // that space should be preserved.
  -          m_elemStack.push_back(new ElemText(m_constructionContext,
  -                                    m_stylesheet,
  -                                    name, atts, lineNumber, columnNumber));
  -          break;
  -
  -        case Constants::ELEMNAME_USE:
  -          elem = new ElemUse(m_constructionContext,
  -                             m_stylesheet,
  -                             name, lineNumber, columnNumber);
  -          break;
  -
  -        case Constants::ELEMNAME_ATTRIBUTE:
  -          elem = new ElemAttribute(m_constructionContext,
  -                                   m_stylesheet,
  -                                   name, atts, lineNumber, columnNumber);
  -          break;
  -
  -        case Constants::ELEMNAME_ELEMENT:
  -          elem = new ElemElement(m_constructionContext,
  -                                 m_stylesheet,
  -                                 name, atts, lineNumber, columnNumber);
  -          break;
  -          
  -        case Constants::ELEMNAME_PI:
  -          elem = new ElemPI(m_constructionContext,
  -                            m_stylesheet,
  -                            name, atts, lineNumber, columnNumber);
  -          break;
  -
  -        case Constants::ELEMNAME_COMMENT:
  -          elem = new ElemComment(m_constructionContext,
  -                                 m_stylesheet,
  -                                 name, atts, lineNumber, columnNumber);
  -          break;
  -          
  -        case Constants::ELEMNAME_MESSAGE:
  -          elem = new ElemMessage(m_constructionContext,
  -                                 m_stylesheet,
  -                                 name, atts, lineNumber, columnNumber);
  -
  -          break;
  -          
  -        case Constants::ELEMNAME_TEMPLATE:
  -        case Constants::ELEMNAME_LOCALE:
  -        case Constants::ELEMNAME_DEFINEATTRIBUTESET:
  -        case Constants::ELEMNAME_DEFINESCRIPT:
  -        case Constants::ELEMNAME_EXTENSION:
  -        case Constants::ELEMNAME_EXTENSIONHANDLER:
  -        case Constants::ELEMNAME_KEY:
  -        case Constants::ELEMNAME_IMPORT:
  -        case Constants::ELEMNAME_INCLUDE:
  -        case Constants::ELEMNAME_PRESERVESPACE:
  -        case Constants::ELEMNAME_STRIPSPACE:
  -		{
  -			DOMString msg("(StylesheetHandler) " + DOMString(name) + " is not allowed inside a template!");
  -			throw SAXException(toCharArray(msg));
  -			break;
  -		}
  -        default:
  -          // If this stylesheet is declared to be of a higher version than the one
  -			  // supported, don't flag an error.
  -			if(XSLTEngineImpl::getXSLTVerSupported() < m_stylesheet.getXSLTVerDeclared())
  +		// END SANJIVA CODE
  +		else
  +		{
  +			if(!m_inTemplate && !m_foundStylesheet)
   			{
  -				DOMString msg("Unknown XSL element: " + localName);
  -				throw SAXException(toCharArray(msg));
  +				elem = initWrapperless(name, atts, lineNumber, columnNumber);
   			}
  -        }
  -      }
  -    }
  -    // BEGIN SANJIVA CODE
  -    else if (!m_inTemplate && startsWith(ns,m_processor.getXSLT4JNameSpaceURL()))
  -    {
  -      if (localName.equals ("component")) 
  -      {
  -        DOMString prefix;
  -        DOMString elements;
  -        DOMString functions;
  -
  -        int nAttrs = atts.getLength ();
  -        for (int i = 0; i < nAttrs; i++) 
  -        {
  -          DOMString aname = atts.getName (i);
  -          if (aname.equals ("prefix")) 
  -          {
  -            prefix = atts.getValue (i);
  -          }
  -          else if (aname.equals ("elements")) 
  -          {
  -            elements = atts.getValue (i);
  -          }
  -          else if (aname.equals ("functions")) 
  -          {
  -            functions = atts.getValue (i);
  -          }
  -          else if(!isAttrOK(aname, atts, i))
  -          {
  -            m_constructionContext.error(DOMString(name) + " has an illegal attribute: " + aname);
  -          }
  -        }
  -        if (isEmpty(prefix)) 
  -        {
  -			DOMString msg("StylesheetHandler) " + DOMString(name) + " attribute 'prefix' is missing");
  -			throw SAXException(toCharArray(msg));
  -        }
  -        // SCOTT: is the line below correct?
  -        DOMString extns = m_stylesheet.getNamespaceForPrefixFromStack (prefix);
  -        ExtensionNSHandler* nsh = m_stylesheet.lookupExtensionNSHandler(extns);
  -        if (nsh == 0) 
  -        {
  -			DOMString msg("(StylesheetHandler) " + DOMString(name) + " extension namespace prefix '" + prefix + "' unknown");
  -			throw SAXException(toCharArray(msg));
  -        }
  -        if (!isEmpty(elements)) 
  -        {
  -          nsh->setElements(elements);
  -        }
  -        if (!isEmpty(functions)) 
  -        {
  -          nsh->setFunctions(functions);
  -        }
  -        m_pLXSLTExtensionNSH = nsh; // hang on to it for processing 
  -        // endElement on lxslt:script
  -      }
  -      else if (localName.equals ("script")) 
  -      {
  -        // process this in end element so that I can see whether I had 
  -        // a body as well. The default pushing logic will save the 
  -        // attributes for me. The body will be accumulated into the
  -        // following string buffer
  -        m_inLXSLTScript = true;
  -        m_LXSLTScriptBody = DOMString();
  -        int nAttrs = atts.getLength ();
  -        for (int i = 0; i < nAttrs; i++) 
  -        {
  -          DOMString aname = atts.getName (i);
  -          if (aname.equals ("lang")) 
  -          {
  -            m_LXSLTScriptLang = atts.getValue (i);
  -          }
  -          else if (aname.equals ("src")) 
  -          {
  -            m_LXSLTScriptSrcURL = atts.getValue (i);
  -          }
  -          else if(!isAttrOK(aname, atts, i))
  -          {
  -            m_constructionContext.error(DOMString(name) + " has an illegal attribute: " + aname);
  -          }
  -        }
  -      }
  -      else 
  -      {
  -        // other xslt4j: element. Not my business.
  -      }
  -    }
  -    // END SANJIVA CODE
  -    else
  -    {
  -      if(!m_inTemplate && !m_foundStylesheet)
  -      {
  -        elem = initWrapperless(name, atts, lineNumber, columnNumber);
  -      }
  -      else
  -      {
  -        // BEGIN SANJIVA CODE
  -        // is this an extension element call?
  -        ExtensionNSHandler* nsh = 0;
  -        if (!isEmpty(ns) && 
  -            ((nsh = m_stylesheet.lookupExtensionNSHandler (ns)) != 0)) 
  -        {
  -          elem = new ElemExtensionCall (m_constructionContext,
  -                                        m_stylesheet,
  -                                        name,
  -                                        atts,
  -										lineNumber,
  -										columnNumber,
  -										*nsh,
  -                                        localName);
  -        }
  -        else 
  -        {
  -          elem = new ElemLiteralResult(m_constructionContext,
  -                                       m_stylesheet,
  -                                       name,
  -                                       atts,
  -									   lineNumber,
  -									   columnNumber);
  -        }
  -        // BEGIN SANJIVA CODE
  -      }
  -      // END SANJIVA CODE
  -    }
  -    if(m_inTemplate && (0 != elem))
  -    {
  -      if(!m_elemStack.empty())
  -      {
  -        ElemTemplateElement* parent = m_elemStack.back();
  -        parent->appendChild(elem);
  -      }
  -      m_elemStack.push_back(elem);
  -    }
  -
  -    // If for some reason something didn't get pushed, push an empty 
  -    // object.
  -    if(origStackSize == m_elemStack.size())
  -    {
  -      m_elemStack.push_back(new ElemEmpty(m_constructionContext,
  -                                 m_stylesheet,
  -                                 name, lineNumber, columnNumber));
  -    }
  +			else
  +			{
  +				// BEGIN SANJIVA CODE
  +				// is this an extension element call?
  +				ExtensionNSHandler* nsh = 0;
   
  +				if (!isEmpty(ns) && 
  +					((nsh = m_stylesheet.lookupExtensionNSHandler (ns)) != 0)) 
  +				{
  +					elem = new ElemExtensionCall (m_constructionContext,
  +											m_stylesheet,
  +											name,
  +											atts,
  +											lineNumber,
  +											columnNumber,
  +											*nsh,
  +											localName);
  +				}
  +				else 
  +				{
  +					elem = new ElemLiteralResult(m_constructionContext,
  +										   m_stylesheet,
  +										   name,
  +										   atts,
  +										   lineNumber,
  +										   columnNumber);
  +				}
  +				// BEGIN SANJIVA CODE
  +			}
  +			// END SANJIVA CODE
  +		}
  +
  +		if(m_inTemplate && (0 != elem))
  +		{
  +			if(!m_elemStack.empty())
  +			{
  +				ElemTemplateElement* const	parent = m_elemStack.back();
  +				parent->appendChild(elem);
  +			}
  +
  +			m_elemStack.push_back(elem);
  +		}
  +
  +		// If for some reason something didn't get pushed, push an empty 
  +		// object.
  +		if(origStackSize == m_elemStack.size())
  +		{
  +			m_elemStack.push_back(new ElemEmpty(m_constructionContext,
  +									 m_stylesheet,
  +									 name, lineNumber, columnNumber));
  +		}
  +
   	} // end try
   
   	// Here's the story.  startElement throws exceptions for certain malformed constructs.  These
  @@ -1102,7 +1119,7 @@
   
   				throw SAXException(toCharArray(msg));
   			}
  -			
  +
   			importStack.push_back(hrefUrl);
   
   			Stylesheet* pImportedStylesheet = new Stylesheet(
  @@ -1111,16 +1128,16 @@
   				m_constructionContext);
   
   			StylesheetHandler tp(m_processor, *pImportedStylesheet, m_constructionContext);
  -				
  +
   			pImportedStylesheet->setBaseIdentifier(hrefUrl->getURLText());
   
   			m_processor.parseXML(*hrefUrl, &tp, DOM_UnimplementedDocument(pImportedStylesheet));
  -			
  +
   			// I'm going to insert the elements in backwards order, 
   			// so I can walk them 0 to n.
   			m_stylesheet.getImports().insert(m_stylesheet.getImports().begin(),
   				pImportedStylesheet);
  -			
  +
   			importStack.pop_back();
   			
   			m_processor.setXSLNameSpaceURL(saved_XSLNameSpaceURL);
  
  
  
  1.11      +44 -54    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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XSLTEngineImpl.cpp	2000/02/09 14:15:13	1.10
  +++ XSLTEngineImpl.cpp	2000/02/17 20:30:50	1.11
  @@ -55,7 +55,7 @@
    * <http://www.apache.org/>.
    */
   /**
  - * $Id: XSLTEngineImpl.cpp,v 1.10 2000/02/09 14:15:13 jdonohue Exp $
  + * $Id: XSLTEngineImpl.cpp,v 1.11 2000/02/17 20:30:50 dbertoni Exp $
    * 
    * $State: Exp $
    * 
  @@ -173,6 +173,7 @@
   #include "ElemWithParam.hpp"
   #include "ElementMarker.hpp"
   #include "FunctionCurrent.hpp"
  +#include "FunctionDocument.hpp"
   #include "FunctionFormatNumber.hpp"
   #include "FunctionKey.hpp"
   #include "FunctionUnparsedEntityURI.hpp"
  @@ -210,17 +211,16 @@
    * at the moment.  I don't think this is worth fixing 
    * until NodeList variables are implemented.
    */
  -const bool										XSLTEngineImpl::m_resolveContentsEarly = true;
  +const bool								XSLTEngineImpl::m_resolveContentsEarly = true;
   
  -XSLTEngineImpl::AttributeKeysMapType XSLTEngineImpl::s_attributeKeys;
  +XSLTEngineImpl::AttributeKeysMapType	XSLTEngineImpl::s_attributeKeys;
   
   XSLTEngineImpl::ElementKeysMapType		XSLTEngineImpl::s_elementKeys;
   
  -XSLTEngineImpl::ElementKeysMapType XSLTEngineImpl::s_XSLT4JElementKeys;
  +XSLTEngineImpl::ElementKeysMapType		XSLTEngineImpl::s_XSLT4JElementKeys;
   
   
   
  -
   //==========================================================
   // SECTION: Constructors
   //==========================================================
  @@ -236,7 +236,6 @@
   	m_stylesheetRoot(0),
   	m_stylesheetExecutionContext(0),
   	m_stylesheets(),
  -	m_sourceDocs(),
   	m_rootDoc(),
   	m_XSLNameSpaceURL(s_DefaultXSLNameSpaceURL),
   	m_XSLDirectiveLookup(),
  @@ -285,16 +284,21 @@
   	m_variableStacks(*this)
   {
   }
  +
  +
   
  -void XSLTEngineImpl::Initialize()
  +void
  +XSLTEngineImpl::Initialize()
   {
   	InstallFunctions();
  +
   	InitializeAttributeKeysTable();
   	InitializeElementKeysTable();
   	InitializeXSLT4JElementKeys();
   }
   
   
  +
   /**
    * Reset the state.  This needs to be called after a process() call 
    * is invoked, if the processor is to be used again.
  @@ -671,38 +675,40 @@
   			error("Could not parse "+xmlIdentifier+" document!");
   		}
   	}
  +
   	return sourceTree;
   }
   
   
  -DOM_Document XSLTEngineImpl::parseXML(const XMLURL& url, 
  -	                         DocumentHandler* docHandler, 
  -	                         const DOM_Document& docToRegister)
  +
  +DOM_Document
  +XSLTEngineImpl::parseXML(
  +			const XMLURL&			url,
  +			DocumentHandler*		docHandler,
  +			const DOM_Document&		docToRegister)
   {
   	// java: url.toExternalForm();
   	const DOMString&	urlString = url.getURLText();
  -	DOM_Document	doc;
  -	const SourceDocumentsTableType::iterator	it = m_sourceDocs.find(urlString);
  -	if(it != m_sourceDocs.end())
  -	{
  -		doc = (*it).second;
  -		return doc;
  -	}
  -	 // java: url.toString()
  -	XSLTInputSource	inputSource(url.getURLText());
  -	if(0 != docHandler)
  -		m_parserLiaison.parseXMLStream(inputSource, *docHandler);
  -	else
  -		m_parserLiaison.parseXMLStream(inputSource);
   
  -	if(0 == docHandler)
  -	{
  -		// java:  doc = m_parserLiaison.getDocument();
  -		assert(0);	// @@ JMD: We don't handle this case right now
  -	}
  -	else
  +	DOM_Document		doc = m_xpathEnvSupport.getSourceDocument(urlString);
  +
  +	if(doc == 0)
   	{
  -		doc = docToRegister;
  +		 // java: url.toString()
  +		XSLTInputSource		inputSource(url.getURLText());
  +
  +		if(0 != docHandler)
  +		{
  +			m_parserLiaison.parseXMLStream(inputSource, *docHandler);
  +
  +			doc = docToRegister;
  +		}
  +		else
  +		{
  +			doc = m_parserLiaison.parseXMLStream(inputSource);
  +		}
  +
  +		m_xpathEnvSupport.setSourceDocument(urlString, doc);
   	}
   
   	return doc;
  @@ -762,7 +768,7 @@
   		ds += fragID;
   		ds += ")";
   
  -		ElementPrefixResolverProxy		theProxy(nsNode, m_xpathSupport);
  +		ElementPrefixResolverProxy		theProxy(nsNode, m_xpathEnvSupport, m_xpathSupport);
   
   		XPathExecutionContextDefault	theExecutionContext(m_xpathEnvSupport,
   															m_xpathSupport,
  @@ -2334,7 +2340,7 @@
   		if (type == DOM_Node::ELEMENT_NODE) 
   		{
   			DOM_NamedNodeMap	nnm = parent.getAttributes();
  -			for (int i = 0;  i < nnm.getLength();  i ++) 
  +			for (unsigned long i = 0;  i < nnm.getLength();  i ++) 
   			{
   				const DOM_Node		attr = nnm.item(i);
   				const DOMString 	aname = attr.getNodeName();
  @@ -2449,6 +2455,7 @@
   			XPathExecutionContext&	executionContext)
   {
   	ElementPrefixResolverProxy	theProxy(prefixResolver,
  +										 m_xpathEnvSupport,
   										 m_xpathSupport);
   
   	return evalXPathStr(str, contextNode, theProxy, executionContext);
  @@ -2597,7 +2604,7 @@
   		DOMString	lookahead; // next token
   		DOMString	error; // if not empty, break from loop
   
  -		ElementPrefixResolverProxy	theProxy(namespaceContext, m_xpathSupport);
  +		ElementPrefixResolverProxy	theProxy(namespaceContext, m_xpathEnvSupport, m_xpathSupport);
   
   		while(tokenizer.hasMoreTokens())
   		{
  @@ -3086,7 +3093,7 @@
   				double highPreserveScore = XPath::s_MatchScoreNone;
   				double highStripScore = XPath::s_MatchScoreNone;
   
  -				ElementPrefixResolverProxy		theProxy(parentElem, m_xpathSupport);
  +				ElementPrefixResolverProxy		theProxy(parentElem, m_xpathEnvSupport, m_xpathSupport);
   
   				{
   					const int	nTests = m_stylesheetRoot->m_whitespacePreservingElements.size();
  @@ -3557,7 +3564,7 @@
   			const DOMString&	expression)
   {
   	// java:     QName qname = new QName(key, null, m_parserLiaison);
  -	QName qname(theName, DOM_Element(), m_xpathSupport);
  +	QName qname(theName, DOM_Element(), m_xpathEnvSupport, m_xpathSupport);
   	Arg arg(qname, expression, true);
   	m_topLevelParams.push_back(arg);
   }
  @@ -3569,7 +3576,7 @@
   			XObject*			theValue)
   {
   	// java:     QName qname = new QName(key, null, m_parserLiaison);
  -	const QName		qname(theName, DOM_Element(), m_xpathSupport);
  +	const QName		qname(theName, DOM_Element(), m_xpathEnvSupport, m_xpathSupport);
   	const Arg		arg(qname, theValue);
   
   	m_topLevelParams.push_back(arg);
  @@ -3831,22 +3838,6 @@
   
   
   
  -DOMString
  -XSLTEngineImpl::findURIFromDoc(const DOM_Document&	doc)
  -{ 
  -	return m_xpathEnvSupport.findURIFromDoc(doc);
  -}
  -
  -
  -
  -XSLTEngineImpl::SourceDocumentsTableType&
  -XSLTEngineImpl::getSourceDocsTable() const
  -{
  -	return m_xpathEnvSupport.getSourceDocsTable();
  -}
  -
  -
  -
   XObject*
   XSLTEngineImpl::createXResultTreeFrag(const ResultTreeFragBase&  r) const
   {
  @@ -4322,6 +4313,7 @@
   XSLTEngineImpl::InstallFunctions()
   {
   	XPath::installFunction(XALAN_STATIC_UCODE_STRING("current"), FunctionCurrent());
  +	XPath::installFunction(XALAN_STATIC_UCODE_STRING("current"), FunctionDocument());
   	XPath::installFunction(XALAN_STATIC_UCODE_STRING("format-number"), FunctionFormatNumber());
   	XPath::installFunction(XALAN_STATIC_UCODE_STRING("key"), FunctionKey());
   	XPath::installFunction(XALAN_STATIC_UCODE_STRING("unparsed-entity-uri"), FunctionUnparsedEntityURI());
  @@ -4459,11 +4451,9 @@
   	s_elementKeys[Constants::ELEMNAME_APPLY_IMPORTS_STRING] = Constants::ELEMNAME_APPLY_IMPORTS;
   	
   	s_elementKeys[Constants::ELEMNAME_EXTENSION_STRING] = Constants::ELEMNAME_EXTENSION;
  -
   	s_elementKeys[Constants::ELEMNAME_MESSAGE_STRING] = Constants::ELEMNAME_MESSAGE;
   	s_elementKeys[Constants::ELEMNAME_LOCALE_STRING] = Constants::ELEMNAME_LOCALE;
   	s_elementKeys[Constants::ELEMNAME_FALLBACK_STRING] = Constants::ELEMNAME_FALLBACK;
  -
   	s_elementKeys[Constants::ELEMNAME_OUTPUT_STRING] = Constants::ELEMNAME_OUTPUT;
   }
   
  
  
  
  1.8       +7 -55     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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XSLTEngineImpl.hpp	2000/02/09 14:15:14	1.7
  +++ XSLTEngineImpl.hpp	2000/02/17 20:30:51	1.8
  @@ -59,7 +59,7 @@
   
   /**
    * 
  - * $Id: XSLTEngineImpl.hpp,v 1.7 2000/02/09 14:15:14 jdonohue Exp $
  + * $Id: XSLTEngineImpl.hpp,v 1.8 2000/02/17 20:30:51 dbertoni Exp $
    * 
    * $State: Exp $
    * 
  @@ -381,15 +381,11 @@
   	 * the error condition is severe enough to halt processing.
   	 */
   	DOM_Document
  -	parseXML(const XMLURL& url, 
  -//@@ TODO: Fix this
  -#if 1
  -	                         DocumentHandler* docHandler, 
  -#else
  -	FormatterListener*	docHandler,
  -#endif
  -	                         const DOM_Document& docToRegister);
  -	  
  +	parseXML(
  +			const XMLURL&		url,
  +			DocumentHandler*	docHandler, 
  +			const DOM_Document& docToRegister);
  +
   	/**
   	 * Reset the state of the XSL processor by reading in a new 
   	 * XSL stylesheet.
  @@ -466,55 +462,11 @@
     // SECTION: Source Tree Tables
     //==========================================================
   
  -	/**
  -	 * Table of input documents.
  -	 * Document objects are keyed by URL string.
  -	 */
  -#if defined(XALAN_HASH_CONTAINERS_AVAILABLE)
  -	typedef hash_map<DOMString,
  -					 DOM_Document,
  -					 DOMStringHashFunction,
  -					 DOMStringEqualsFunction>	SourceDocumentsTableType;
  -#else
  -	typedef std::map<DOMString, DOM_Document, DOMStringEqualsFunction>	SourceDocumentsTableType;
  -#endif
  -	SourceDocumentsTableType	m_sourceDocs;
  -
   /**
    * The root document.
    */
   	DOM_Document			m_rootDoc;
   
  -public:
  -
  -	/**
  -	 * Given a DOM Document, tell what URI was used to parse it.
  -	 */
  -	DOMString
  -	findURIFromDoc(const DOM_Document& doc);
  -
  -
  -  /**
  -   * Get table of source tree documents.
  -   * Document objects are keyed by URL string.
  -   */
  -	SourceDocumentsTableType&
  -	getSourceDocsTable() const;
  -
  -  /**
  -   * Set a source document. Every time a source document is requested 
  -   * through either xsl:uri or in a process call,
  -   * the processor will first consult table of supplied 
  -   * documents before trying to load and parse the corresponding 
  -   * document from the Net.
  -
  -   */
  -	void setSourceDocument(const DOMString&	uri,
  -					  DOM_Document&	doc)
  -	{
  -		m_sourceDocs.insert(std::make_pair<const DOMString, DOM_Document>(uri, doc));
  -	}
  -
   protected:
   
     //==========================================================
  @@ -618,7 +570,7 @@
     /**
      *  Hash table that can look up xslt element IDs via name.
      */
  -	static AttributeKeysMapType	s_elementKeys;
  +	static ElementKeysMapType	s_elementKeys;
   
   
   public: