David,

Thank you for pointing me in the write direction (I strongly suspected I 
was missing something).  However, one thing, I can't seem to find 
documented anywhere how to get the CVS updates.  All I can find is how 
to download the latest full releases.  Also, is there any documentation 
of the innards of the Xalan parser anywhere?  The only thing I see in 
the docs are about the SAX and DOM interfaces.

Geoff

[EMAIL PROTECTED] wrote:

>The error messages from the compiler are a result of not including the
>correct header files.
>
>You should also take a look at the latest version of the Xalan C API.
>There are already functions to use buffers for source tree and stylesheet
>input.  See the file XalanTransformer/XalanCAPI.h:
>
>      XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
>      XalanParseSourceFromStream(
>                  const char*       theXMLStream,
>                  unsigned long     theXMLStreamLength,
>                  XalanHandle       theXalanHandle,
>                  XalanPSHandle*    thePSHandle);
>
>      XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
>      XalanCompileStylesheetFromStream(
>                  const char*             theXSLStream,
>                  unsigned long           theXSLStreamLength,
>                  XalanHandle             theXalanHandle,
>                  XalanCSSHandle*         theCSSHandle);
>
>      XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
>      XalanTransformToHandlerPrebuilt(
>                        XalanPSHandle                 thePSHandle,
>                        XalanCSSHandle                theCSSHandle,
>                        XalanHandle                   theXalanHandle,
>                        void*                         theOutputHandle,
>                        XalanOutputHandlerType  theOutputHandler,
>                        XalanFlushHandlerType   theFlushHandler);
>
>Be sure to read the comments in the header file carefully, because you'll
>need to destroy the parsed source and compiled stylesheets instances once
>the transformation is finished.  Don't worry if you think this is less
>efficient -- sources are always parsed and stylesheets are always compiled,
>so there's no loss of efficiency if you do it yourself in your code.
>
>You may need to get the latest source code from CVS.  You can also wait
>until we finish the 1.3 release, which ought to be early next week.
>
>Dave
>
>
>
>                                                                                      
>                                                
>                      Geoff                                                           
>                                                
>                      <[EMAIL PROTECTED]         To:      [EMAIL PROTECTED]      
>                                                
>                      om>                      cc:                                    
>                                                
>                                               Subject: custom routines               
>                                                
>                      12/28/2001 08:36                                                
>                                                
>                      PM                                                              
>                                                
>                      Please respond                                                  
>                                                
>                      to xalan-dev                                                    
>                                                
>                                                                                      
>                                                
>                                                                                      
>                                                
>
>
>
>
>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