Ah, I think I see the problem. The TreeWalker::traverse method assumes that the 
node passed to it is the
_main_ node of the DOM, which means that calling XalanNode::getParent() of it 
will return NULL. 
However, in my case, getParent() will _not_ return NULL (because its a subtree 
node) meaning that the traversal 
will continue.

A check ought to be made that if getParent() returns the same value as that of 
the original node passed to
traverse, the traversal should terminate.

I'll try compile that and get back.

Regards
/Rob

> -----Original Message-----
> From: Bielik, Robert 
> Sent: Thursday, April 17, 2003 9:38 AM
> To: [email protected]
> Subject: Compiling embedded XSL problem
> 
> 
> Hi All,
> 
> I'm using Xerces-C V2.1.0 deprecated i.f. and Xalan-C V1.4.0. 
> I have an embedded XSL within the XML I want to 
> process as (simplified but valid view):
> 
> <doc>
>       <dataToProcessForXSL>
>               ... lots of XML here ...
>       </dataToProcessForXSL>
>       <theXSL>
>               <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>                       ... the XSL itself ...
>               </xsl:stylesheet>
>       </theXSL>
> </doc>
> 
> I want to precompile the XSL into a compiled stylesheet, then 
> apply that stylesheet upon a subtree (dataToProcessForXSL) of 
> the XML. This works as long as I extract the XSL subtree as a 
> string, then parse the XSL from a stream.
> 
> However, if I take the XalanNode* that points to the 
> <xsl:stylesheet..> element, the TreeWalker crashes in 
> StylesheetHandler::endElement when the element name passed to 
> the method is "theXSL" (!!!???). The
> <theXSL> element isn't even part of the subtree that is 
> passed to XalanTransformer::compileStylesheet !!
> Anybody know what's going on ??
> 
> TIA
> /Rob
> 

Reply via email to