Hello,

I have a problem running applications in debug mode. I try to process a xslt 
file which includes another xslt file. In release mode everything works fine. 
But in debug mode the application crashes with the message:

"Debug Assertion Failed!
...
Expression: invalid null pointer"

This happens when I call

theXalanTransformer.transform(*parsedXML, *xslIn, std::cout);

My environment:
- VS2010
- binary packages of Xerces 3.1.1 and Xalan 1.11.0

My code:

 //! namespace clarifications
  XALAN_USING_XALAN(XSLException);
  XALAN_USING_XALAN(XalanTransformer);
  XALAN_USING_XALAN(XalanDOMString);
  XALAN_USING_XALAN(XSLTInputSource);
  XALAN_USING_XALAN(XSLTResultTarget);
  XALAN_USING_XALAN(XalanParsedSource);
  XALAN_USING_XERCES(XMLPlatformUtils);
 
  try{
    XMLPlatformUtils::Initialize();
    XalanTransformer::initialize();
  } catch(const XSLException& xslException) {
    XalanTransformer::terminate();
    XMLPlatformUtils::Terminate();
    std::cout << ((xslException.getMessage()).c_str());
  }

    XalanTransformer theXalanTransformer;  
    const char* reportFilename = "C:\\tmp\\reportTest\\input.xml";
   
    //! transform XML->HTML
    const XalanParsedSource* parsedXML = 0;
    const XSLTInputSource* xmlIn =
      new XSLTInputSource(reportFilename);
    try{
      int result = theXalanTransformer.parseSource(*xmlIn,parsedXML);
      if (result !=0) {
        std::cout << "Error occured! " << theXalanTransformer.getLastError() << 
std::endl;
      }
    } catch (const XSLException& xslException) {
      delete xmlIn;
      xmlIn = 0;
      std::cout << "Error occured! " << theXalanTransformer.getLastError() << 
std::endl;
    }

    const char* xsltFileWithPath ="C:\\tmp\\reportTest\\foo2.xsl";
    XSLTInputSource* xslIn = new XSLTInputSource(xsltFileWithPath);
 
    //! first page containing basic report
    try {
      int result = theXalanTransformer.transform(*parsedXML, *xslIn, std::cout);
      if (result != 0) {
        delete xslIn;       
        xslIn  = 0;
       std::cout << "Error occured! " << theXalanTransformer.getLastError() << 
std::endl;
      }
    } catch (const XSLException &xslException) {
      delete xslIn;
      xslIn  = 0;
      std::cout << "Error occured! " << theXalanTransformer.getLastError() << 
std::endl;
    }
    delete xslIn;
    xslIn  = 0;
    delete xmlIn;
    xmlIn = 0;


Is this a known issue? How can I avoid this assertion failure?

Thanks for your help.

Kind regards 
Claudia

Reply via email to