xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbert...@apache.org
Subject cvs commit: xml-xalan/c/src/XSLT XSLTEngineImpl.cpp
Date Wed, 29 Jan 2003 02:19:22 GMT
dbertoni    2003/01/28 18:19:22

  Modified:    c/src/XSLT XSLTEngineImpl.cpp
  Log:
  Traverse the DOM instance correctly when compiling a stylesheet.
  
  Revision  Changes    Path
  1.167     +28 -4     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.166
  retrieving revision 1.167
  diff -u -r1.166 -r1.167
  --- XSLTEngineImpl.cpp	21 Dec 2002 00:21:25 -0000	1.166
  +++ XSLTEngineImpl.cpp	29 Jan 2003 02:19:22 -0000	1.167
  @@ -477,11 +477,31 @@
   
   		if(stylesheetNode != 0)
   		{
  -			xslIdentifier = XALAN_STATIC_UCODE_STRING("Input XSL");
  +			const XalanNode::NodeType	theType = stylesheetNode->getNodeType();
   
  -			FormatterTreeWalker tw(stylesheetProcessor);
  +			if (theType != XalanNode::ELEMENT_NODE && theType != XalanNode::DOCUMENT_NODE)
  +			{
  +				error(StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("Compiling a stylesheet from
a DOM instance requires a Document or Element node")));
  +			}
  +			else
  +			{
  +				xslIdentifier = XALAN_STATIC_UCODE_STRING("Input XSL");
  +
  +				FormatterTreeWalker tw(stylesheetProcessor);
   
  -			tw.traverse(stylesheetSource.getNode());
  +				if (theType == XalanNode::DOCUMENT_NODE)
  +				{
  +					tw.traverse(stylesheetNode);
  +				}
  +				else
  +				{
  +					stylesheetProcessor.startDocument();
  +
  +					tw.traverseSubtree(stylesheetNode);
  +
  +					stylesheetProcessor.endDocument();
  +				}
  +			}
   		}
   		else
   		{
  @@ -819,7 +839,11 @@
   
   			FormatterTreeWalker tw(stylesheetProcessor);
   
  -			tw.traverse(frag, frag->getParentNode());
  +			stylesheetProcessor.startDocument();
  +
  +			tw.traverseSubtree(frag);
  +
  +			stylesheetProcessor.endDocument();
   
   			if(m_diagnosticsPrintWriter != 0)
   			{
  
  
  

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


Mime
View raw message