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...@apache.org on 2004/04/06 20:38:30 UTC

cvs commit: xml-xalan/c/src/xalanc/XSLT Stylesheet.cpp

dbertoni    2004/04/06 11:38:30

  Modified:    c/src/xalanc/XSLT Stylesheet.cpp
  Log:
  Fixed import precedence problem with xsl:strip/preserve-space.
  
  Revision  Changes    Path
  1.11      +28 -4     xml-xalan/c/src/xalanc/XSLT/Stylesheet.cpp
  
  Index: Stylesheet.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/Stylesheet.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Stylesheet.cpp	6 Apr 2004 00:15:36 -0000	1.10
  +++ Stylesheet.cpp	6 Apr 2004 18:38:29 -0000	1.11
  @@ -470,14 +470,17 @@
   void
   Stylesheet::postConstruction(StylesheetConstructionContext&		constructionContext)
   {
  +	KeyDeclarationVectorType::size_type			theKeyDeclarationsCount = 0;
  +	WhitespaceElementsVectorType::size_type		theWhitespaceElementsCount = 0;
  +
   	{
   		m_importsSize = m_imports.size();
   
  -		// Call postConstruction() on any imported stylesheets, the get things
  -		// in reverse order, to preserve import precedence. Also, get any key
  +		// Call postConstruction() on any imported stylesheets, in reverse order,
  +		// so namespace aliases are processed properly. Also, get any key
   		// declarations and preserve/strip space information.
   		const StylesheetVectorType::reverse_iterator	theEnd = m_imports.rend();
  -		StylesheetVectorType::reverse_iterator	i = m_imports.rbegin();
  +		StylesheetVectorType::reverse_iterator			i = m_imports.rbegin();
   
   		while(i != theEnd)
   		{
  @@ -485,6 +488,27 @@
   
   			m_namespacesHandler.copyNamespaceAliases((*i)->getNamespacesHandler());
   
  +			theKeyDeclarationsCount += (*i)->m_keyDeclarations.size();
  +			theWhitespaceElementsCount += (*i)->m_whitespaceElements.size();
  +
  +			++i;
  +		}
  +	}
  +
  +	{
  +		// Call postConstruction() on any imported stylesheets, in import order,
  +		// and process preserve/strip space information.
  +		const StylesheetVectorType::iterator	theEnd = m_imports.end();
  +		StylesheetVectorType::iterator			i = m_imports.begin();
  +
  +		m_keyDeclarations.reserve(
  +			m_keyDeclarations.size() + theKeyDeclarationsCount);
  +
  +		m_whitespaceElements.reserve(
  +			m_whitespaceElements.size() + theWhitespaceElementsCount);
  +
  +		while(i != theEnd)
  +		{
   			m_keyDeclarations.insert(
   				m_keyDeclarations.end(),
   				(*i)->m_keyDeclarations.begin(),
  @@ -718,7 +742,7 @@
   		{
   			// This is an error...
   			constructionContext.error(
  -				XalanMessageLoader::getMessage(XalanMessages::LastFoundStylesheetWillBeUsed),
  +				XalanMessageLoader::getMessage(XalanMessages::StylesheetHasDuplicateNamedTemplate),
   				0,
   				theTemplate);
   		}
  
  
  

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