Hi David,
There's an existing sample application that uses the C API for
transformations. See the ApacheModuleXSLT sample application for more
information. The C API is documented here:
http://xml.apache.org/xalan-c/apidocs/XalanCAPI.h.html
I'm not sure why a transformation would be crashing inside Apache that
works find outside of it, or why it works in 1.3, but not in 2.0. It could
be related to exception handling, so you might want to look through the
Apache documentation to see what it says about integrating C++ code which
uses exceptions.
Dave
David Vos
<[EMAIL PROTECTED] To:
<[email protected]>
edu> cc: (bcc: David N
Bertoni/Cambridge/IBM)
Subject: Xalan in Apache 2.0
module
01/08/2003 12:48
PM
I'm working on an Apache 2.0 module that performs xslt. I would like to
use Xalan C++ if possible, though I am open to using other libraries if
necessary.
I've gotten Xalan C++ to work under Apache 1.3. Now, when I'm porting the
module to Apache 2.0, it crashes when I call transform().
Does anyone have any simple, bare-bones examples of Apache 2.0 modules
that use Xalan C++?
I also found in the archives a mention that Xalan has a C API. Could
someone give me a reference for it? I only need to do a simple
transformation using xslt parameters. (Preferrably using a Xalan output
handler so that I can send the result to the client). Apache might like
it better if I do the whole project in C instead of C++.
Here is an example function that I can call from my apache handler:
void test() {
XMLPlatformUtils::Initialize();
XalanTransformer::initialize();
XalanTransformer theXalanTransformer;
int theResult = theXalanTransformer.transform("/tmp/foo.xml",
"/tmp/foo.xsl", "/tmp/foo.out");
if(theResult != 0) {
cerr << "UseStylesheetParam Error: \n" <<
theXalanTransformer.getLastError() << endl << endl;
}
XalanTransformer::terminate();
XMLPlatformUtils::Terminate();
XalanTransformer::ICUCleanUp();
}
The apache process will segfault on transform().
David