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 2001/01/29 21:47:07 UTC

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

dbertoni    01/01/29 12:47:07

  Modified:    c/src/XSLT ElemElement.cpp
  Log:
  Fixed bug where namespace declaration was added to parent instead of the element being generated.  Fixes impincl09 and namespace02.
  
  Revision  Changes    Path
  1.15      +18 -6     xml-xalan/c/src/XSLT/ElemElement.cpp
  
  Index: ElemElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemElement.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ElemElement.cpp	2001/01/25 17:15:05	1.14
  +++ ElemElement.cpp	2001/01/29 20:47:02	1.15
  @@ -179,6 +179,8 @@
   
   	const bool				haveNamespace = indexOfNSSep == len ? false : true;
   
  +	bool					outputNSDecl = false;
  +
   	const XalanDOMString*	ns = 0;
   
   	if(haveNamespace == true)
  @@ -211,7 +213,11 @@
   
   	if (len != 0 && (haveNamespace == false || nsLength != 0))
   	{
  -		if(0 != m_namespaceAVT)
  +		if(0 == m_namespaceAVT)
  +		{
  +			executionContext.startElement(toCharArray(elemName));   
  +		}
  +		else
   		{
   			StylesheetExecutionContext::GetAndReleaseCachedString	elemNameSpaceGuard(executionContext);
   
  @@ -219,8 +225,12 @@
   
   			m_namespaceAVT->evaluate(elemNameSpace, sourceNode, *this, executionContext);
   
  -			if(!isEmpty(elemNameSpace))
  +			if(isEmpty(elemNameSpace) == true)
   			{
  +				executionContext.startElement(toCharArray(elemName));   
  +			}
  +			else
  +			{
   				if(indexOfNSSep < len)
   				{
   					assign(elemName, substring(elemName, indexOfNSSep + 1));
  @@ -236,6 +246,8 @@
   
   					insert(elemName, 0, DOMServices::s_XMLNamespaceSeparatorString);
   					insert(elemName, 0, prefix);
  +			
  +					executionContext.startElement(toCharArray(elemName));   
   				}
   				else
   				{
  @@ -255,19 +267,19 @@
   
   					append(nsDecl, newPrefix);
   
  -					executionContext.addResultAttribute(nsDecl, elemNameSpace);
  -
   					reserve(
   						elemName,
   						length(elemName) + DOMServices::s_XMLNamespaceSeparatorStringLength + length(newPrefix) + 1);
   
   					insert(elemName, 0, DOMServices::s_XMLNamespaceSeparatorString);
   					insert(elemName, 0, newPrefix);
  +
  +					executionContext.startElement(toCharArray(elemName));   
  +
  +					executionContext.addResultAttribute(nsDecl, elemNameSpace);
   				}
   			}
   		}
  -
  -		executionContext.startElement(toCharArray(elemName));   
   	}
   
   	ElemUse::execute(executionContext, sourceTree, sourceNode, mode);