Hi all,

I've been working on something for a few days now and I can't seem to get
it to work (and I may also be re-inventing the wheel to).  I'm writing an
apache module that needs to generate XHTML pages by feeding in XML and XSL
to Xalan as strings.  These strings will be built on the fly by the
module.  Since the apache module is in C and Xalan is in C++ I think I
need to make a custom api of sorts.  Here's what I have thus far (it is
meant to be a cross between mod_xslt.c and streamtransform.cpp):

#include <XalanTransformer/XalanTransformerDefinitions.hpp>
#include <util/PlatformUtils.hpp>
#include <cassert>
#if defined(XALAN_OLD_STREAM_HEADERS)
#include <strstream.h>
#else
#include <strstream>
#endif

#include "primary_xalan_api.h"

#include <XalanTransformer/XalanCAPI.h>
#include <XalanTransformer/XalanTransformer.hpp>


XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
CustomStreamTransform(const char **xml,
                      const char **xsl,
                      XalanHandle                               
theXalanHandle,
                      void*                                     
theOutputHandle,
                      XalanOutputHandlerType    theOutputHandler,
                      XalanFlushHandlerType     theFlushHandler)
{
  int theResult = 0;
  istrstream theXMLInStream(*xml, strlen(*xml));
  istrstream theXSLInStream(*xsl, strlen(*xsl));

  XSLTInputSource theInputSource(&theXMLInStream);
  XSLTInputSource theStylesheetSource(&theXSLInStream);

  XalanTransformerOutputStream theOutputStream(theOutputHandle, 
theOutputHandler, theFlushHandler);

  XalanOutputStreamPrintWriter  thePrintWriter(theOutputStream);
  XSLTResultTarget                              
theResultTarget(&thePrintWriter);

  // Do the transformation...
  return theXalanHandle.transform(
                   theInputSource,
                   theStylesheetSource,
                   theResultTarget);
}


Unfortunately, this does not compile.  I wind up with this error:

primary_xalan_api.cpp: In function `void CustomStreamTransform(const 
char **, const char **, void *, void *, long unsigned int
(*)(const char *, long unsigned int, void *), void (*)(void *))':
primary_xalan_api.cpp:37: variable `class XalanTransformerOutputStream 
theOutputStream' has initializer but incomplete type
primary_xalan_api.cpp:39: `XalanOutputStreamPrintWriter' undeclared 
(first use this function)
primary_xalan_api.cpp:39: (Each undeclared identifier is reported only once
primary_xalan_api.cpp:39: for each function it appears in.)
primary_xalan_api.cpp:39: parse error before `('
primary_xalan_api.cpp:40: `thePrintWriter' undeclared (first use this 
function)
primary_xalan_api.cpp:46: request for member `transform' in 
`theXalanHandle', which is of non-aggregate type `void *'
primary_xalan_api.cpp:37: warning: unused variable `{error} theOutputStream'
primary_xalan_api.cpp:30: warning: unused variable `int theResult'


Can someone please point me in the right direction as to how to make this
work?  Thanks in advance.

Geoff


Reply via email to