You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Avula, Raj" <RA...@firstam.com> on 2001/04/04 02:43:15 UTC

Xalan C++ process stylesheet error.


Hi,
	I have just started using Xalan C++ API to transform XML to another
XML using XSL.
In my program I am first trying to process the stylesheet using
processor.processStylesheet() method
and then use the processor object to apply the stylesheet to all the given
XML documents(I want to basically seperate the processing of stylesheet and
XML file).
I am getting coredump at s_pProcessor->processStylesheet(see the code
below).
It is working fine if I use processor.process() supplying the style-sheet.

Here is the snippet of code where I am processing the stylesheet

void CXTSupportObjects::createSupportObjects(const RWCString& inXSLFile)
{
   ENTRY();
   try
   {
	  //initialze XSL subsystem.
      XSLTInit xsltInit;

	  // Initialize the XalanSourceTree subsystem.  This must stay in
scope until
      // we're done with the subsystem, since its destructor shuts down the
      // subsystem.
      XalanSourceTreeInit
theXalanSourceTreeInit;
    
      // Create some support objects that are necessary for running the
processor...
      XalanSourceTreeDOMSupport		theDOMSupport;
      XalanSourceTreeParserLiaison	theParserLiaison(theDOMSupport);

      // Hook the two together...
      theDOMSupport.setParserLiaison(&theParserLiaison);

      // Create some more support objects...
      XSLTProcessorEnvSupportDefault	theXSLTProcessorEnvSupport;
      XObjectFactoryDefault			   theXObjectFactory;
      XPathFactoryDefault				   theXPathFactory;

      // Create a processor...
      s_pProcessor = new XSLTEngineImpl(  theParserLiaison,
                                          theXSLTProcessorEnvSupport,
                                          theDOMSupport,
                                          theXObjectFactory,
                                          theXPathFactory);

      // Connect the processor to the support object...
      theXSLTProcessorEnvSupport.setProcessor(s_pProcessor);

      // Create a stylesheet construction context, and a stylesheet
      // execution context...
      StylesheetConstructionContextDefault	theConstructionContext(
*s_pProcessor,
 
theXSLTProcessorEnvSupport,
 
theXPathFactory);

      s_pExecutionContext = new StylesheetExecutionContextDefault	(
*s_pProcessor,
 
theXSLTProcessorEnvSupport,
 
theDOMSupport,
 
theXObjectFactory);
       
      //parse the XSL Stylesheet.
      const XalanDOMString		theXSLFileName("temp.xsl");
      theParserLiaison.setExecutionContext(*s_pExecutionContext);
      StylesheetRoot* stylesheet =
s_pProcessor->processStylesheet(theXSLFileName, theConstructionContext);
      s_pExecutionContext->setStylesheetRoot(stylesheet);

   } catch(SAXException& saxe) {
	   cerr << "SAX Exception " <<endl
			<< saxe.getMessage() << endl;
   } catch(XSLException &xsle) {
	   cerr << "XSLException :" << endl
			<< xsle.getMessage() << endl;
   } catch(XalanDOMException &dome) {
		cerr << "XalanDOMException :" <<endl;
   } catch(... ) {
      cerr << "Exception while cerating support objects "
            << endl;
   }
    EXIT(); 
}


I am not able to figure out where I am doing wrong.
Any help would be greately appreciated.

Regards,
Raj