auriemma    01/03/16 12:12:43

  Modified:    c/src/XalanTransformer XalanTransformer.cpp
                        XalanTransformer.hpp
  Log:
  Added (c++) support for compiled stylesheets and stylesheet parameters.
  
  Revision  Changes    Path
  1.10      +243 -118  xml-xalan/c/src/XalanTransformer/XalanTransformer.cpp
  
  Index: XalanTransformer.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanTransformer.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XalanTransformer.cpp      2001/03/02 21:02:51     1.9
  +++ XalanTransformer.cpp      2001/03/16 20:12:38     1.10
  @@ -54,15 +54,15 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -#include <sax/SAXException.hpp>
  +#include <algorithm>
   
   
   
  -#include <XalanDOM/XalanDOMException.hpp>
  +#include <sax/SAXException.hpp>
   
   
   
  -#include <XalanTransformer/XalanTransformer.hpp>
  +#include <XalanDOM/XalanDOMException.hpp>
   
   
   
  @@ -71,6 +71,10 @@
   
   
   
  +#include <XalanTransformer/XalanTransformer.hpp>
  +
  +
  +
   XSLTInit*    XalanTransformer::m_xsltInit = 0;
   
   
  @@ -86,16 +90,12 @@
                                m_domSupport,
                                m_xobjectFactory,
                                m_xpathFactory),
  -     m_stylesheetXPathFactory(),
  -     m_stylesheetConstructionContext(
  -                             m_processor,
  -                             m_xsltprocessorEnvSupport,
  -                             m_stylesheetXPathFactory),
        m_stylesheetExecutionContext(
                                m_processor,
                                m_xsltprocessorEnvSupport,
                                m_domSupport,
                                m_xobjectFactory),
  +     m_compiledStylesheets(),
        m_errorMessage()
   {
        m_domSupport.setParserLiaison(&m_parserLiaison);
  @@ -107,6 +107,14 @@
   
   XalanTransformer::~XalanTransformer()
   {
  +#if !defined(XALAN_NO_NAMESPACES)
  +     using std::for_each;
  +#endif
  +
  +     // Clean up all entries in the compliledStylesheets vector.
  +     for_each(m_compiledStylesheets.begin(),
  +                      m_compiledStylesheets.end(),
  +                      DeleteFunctor<XalanCompiledStylesheet>());
   }
   
   
  @@ -133,7 +141,7 @@
   XalanTransformer::transform(
        const XSLTInputSource&          theInputSource, 
        const XSLTInputSource&          theStylesheetSource,
  -     XSLTResultTarget&                       theResultTarget)
  +     const XSLTResultTarget&         theResultTarget)
   {
        int             theResult = 0;
   
  @@ -155,12 +163,21 @@
   
                
m_parserLiaison.setExecutionContext(m_stylesheetExecutionContext);
   
  +             // Create a stylesheet construction context, using the
  +             // stylesheet's factory support objects.
  +             StylesheetConstructionContextDefault    
theStylesheetConstructionContext(
  +                                     m_processor,
  +                                     m_xsltprocessorEnvSupport,
  +                                     m_xpathFactory);
  +
  +             XSLTResultTarget        temp(theResultTarget);
  +
                // Do the transformation...
                m_processor.process(
                                        theInputSource,
                                        theStylesheetSource,
  -                                     theResultTarget,
  -                                     m_stylesheetConstructionContext,
  +                                     temp,
  +                                     theStylesheetConstructionContext,
                                        m_stylesheetExecutionContext);
        }
        catch (XSLException& e)
  @@ -230,99 +247,113 @@
   
   int
   XalanTransformer::transform(
  -             const char*             theXMLFileName, 
  -             const char*             theXSLFileName,
  -             const char*             theOutFileName)
  -{
  -     // Set input sources
  -     const XalanDOMString    theDOMStringXMLFileName(theXMLFileName);
  -     const XalanDOMString    theDOMStringXSLFileName(theXSLFileName);
  -
  -     XSLTInputSource theInputSource(c_wstr(theDOMStringXMLFileName));
  -     XSLTInputSource theStylesheetSource(c_wstr(theDOMStringXSLFileName));
  -
  -     // Set output target
  -     const XalanDOMString    theDomStringOutFileName(theOutFileName);
  -     
  -     XSLTResultTarget                
theResultTarget(theDomStringOutFileName);
  +                     const XSLTInputSource&                  theInputSource, 
  +                     const XalanCompiledStylesheet*  theCompiledStylesheet,
  +                     const XSLTResultTarget&                 theResultTarget)
  +{
  +     int             theResult = 0;
   
  -     // Do the transformation...
  -     return transform(
  -                                     theInputSource, 
  -                                     theStylesheetSource,
  -                                     theResultTarget);
  -}
  +     // Clear the error message.
  +     m_errorMessage.clear();
  +     m_errorMessage.push_back(0);
   
  +     // Store error messages from problem listener.
  +     XalanDOMString  theErrorMessage;
   
  +     try
  +     {
  +             // Create a problem listener and send output to a 
XalanDOMString.
  +             DOMStringPrintWriter    thePrintWriter(theErrorMessage);
  +             
  +             ProblemListenerDefault  theProblemListener(&thePrintWriter);
   
  -int
  -XalanTransformer::transform(
  -             const char*             theXMLFileName, 
  -             const char*             theOutFileName)
  -{
  -     // Set input sources
  -     const XalanDOMString    theDOMStringXMLFileName(theXMLFileName);
  +             m_processor.setProblemListener(&theProblemListener);
   
  -     XSLTInputSource theInputSource(c_wstr(theDOMStringXMLFileName));
  -     XSLTInputSource theStylesheetSource;
  +             // Set the compiled stylesheet.
  +             
theCompiledStylesheet->setStylesheetRoot(m_stylesheetExecutionContext);
   
  -     // Set output target
  -     const XalanDOMString    theDomStringOutFileName(theOutFileName);
  -     
  -     XSLTResultTarget                
theResultTarget(theDomStringOutFileName);
  +             XSLTResultTarget        temp(theResultTarget);
   
  -     // Do the transformation...
  -     return transform(
  -                                     theInputSource, 
  -                                     theStylesheetSource,
  -                                     theResultTarget);
  -}
  +             // Do the transformation...
  +             m_processor.process(
  +                                     theInputSource,                         
  +                                     temp,                                   
  +                                     m_stylesheetExecutionContext);
  +     }
  +     catch (XSLException& e)
  +     {
  +             if (length(theErrorMessage) != 0)
  +             {
  +                     TranscodeToLocalCodePage(theErrorMessage, 
m_errorMessage, true);
  +             }
  +             else
  +             {
  +                     TranscodeToLocalCodePage(e.getMessage(), 
m_errorMessage, true);
  +             }
   
  +             theResult = -1;         
  +     }
  +     catch (SAXException& e)
  +     {
  +             if (length(theErrorMessage) != 0)
  +             {
  +                     TranscodeToLocalCodePage(theErrorMessage, 
m_errorMessage, true);
  +             }
  +             else
  +             {
  +                     TranscodeToLocalCodePage(e.getMessage(), 
m_errorMessage, true);
  +             }
   
  +             theResult = -2;
  +     }
  +     catch (XMLException& e)
  +     {
  +             if (length(theErrorMessage) != 0)
  +             {
  +                     TranscodeToLocalCodePage(theErrorMessage, 
m_errorMessage, true);
  +             }
  +             else
  +             {
  +                     TranscodeToLocalCodePage(e.getMessage(), 
m_errorMessage, true);
  +             }
   
  -int
  -XalanTransformer::transform(
  -             const char*             theXMLFileName, 
  -             const char*             theXSLFileName,
  -             ostream&                theOutStream)
  -{
  -     // Set input sources
  -     const XalanDOMString    theDOMStringXMLFileName(theXMLFileName);
  -     const XalanDOMString    theDOMStringXSLFileName(theXSLFileName);
  +             theResult = -3;
  +     }
  +     catch(const XalanDOMException&  e)
  +     {
  +             if (length(theErrorMessage) != 0)
  +             {
  +                     TranscodeToLocalCodePage(theErrorMessage, 
m_errorMessage, true);
  +             }
  +             else
  +             {
  +                     XalanDOMString theMessage("XalanDOMException caught.  
The code is ");
  +                     
  +                     append(theMessage,  
LongToDOMString(long(e.getExceptionCode())));
  +                     append(theMessage,  XalanDOMString("."));               
                                 
   
  -     XSLTInputSource theInputSource(c_wstr(theDOMStringXMLFileName));
  -     XSLTInputSource theStylesheetSource(c_wstr(theDOMStringXSLFileName));
  +                     TranscodeToLocalCodePage(theMessage, m_errorMessage, 
true);
  +             }
   
  -     // Set output target
  -     XSLTResultTarget        theResultTarget(&theOutStream);
  +             theResult = -4;
  +     }
   
  -     // Do the transformation...
  -     return transform(
  -                                     theInputSource, 
  -                                     theStylesheetSource,
  -                                     theResultTarget);
  +     reset();
  +     
  +     return theResult;
   }
   
   
   
   int
   XalanTransformer::transform(
  -             const char*             theXMLFileName, 
  -             ostream&                theOutStream)
  +                     const XSLTInputSource&          theInputSource,         
        
  +                     const XSLTResultTarget&         theResultTarget)
   {
  -     // Set input sources
  -     const XalanDOMString    theDOMStringXMLFileName(theXMLFileName);
  -     
  -     XSLTInputSource theInputSource(c_wstr(theDOMStringXMLFileName));
  -     XSLTInputSource         theStylesheetSource;    
  -
  -     // Set output target
  -     XSLTResultTarget        theResultTarget(&theOutStream);
  -
        // Do the transformation...
        return transform(
                                        theInputSource, 
  -                                     theStylesheetSource,
  +                                     XSLTInputSource(),
                                        theResultTarget);
   }
   
  @@ -330,16 +361,16 @@
   
   int
   XalanTransformer::transform(
  -             istream&                theXMLInStream, 
  -             istream&                theXSLInStream,
  -             ostream&                theOutStream)
  -{
  -     // Set input sources
  -     XSLTInputSource         theInputSource(&theXMLInStream);
  -     XSLTInputSource         theStylesheetSource(&theXSLInStream);
  -     
  -     // Set output target
  -     XSLTResultTarget        theResultTarget(&theOutStream);
  +                     const XSLTInputSource&                  theInputSource, 
  +                     const XSLTInputSource&                  
theStylesheetSource,
  +                     const void*                                             
theOutputHandle, 
  +                     XalanOutputHandlerType                  
theOutputHandler,
  +                     XalanFlushHandlerType                   theFlushHandler)
  +{
  +     // Set to output target to the callback 
  +     XalanTransformerOutputStream    theOutputStream(theOutputHandle, 
theOutputHandler, theFlushHandler);
  +     XalanOutputStreamPrintWriter    thePrintWriter(theOutputStream);
  +     XSLTResultTarget                                
theResultTarget(&thePrintWriter);
   
        // Do the transformation...
        return transform(
  @@ -352,20 +383,21 @@
   
   int
   XalanTransformer::transform(
  -             istream&                theXMLInStream,                 
  -             ostream&                theOutStream)
  +                     const XSLTInputSource&                  theInputSource, 
  +                     const XalanCompiledStylesheet*  theCompiledStylesheet,
  +                     const void*                                             
theOutputHandle, 
  +                     XalanOutputHandlerType                  
theOutputHandler,
  +                     XalanFlushHandlerType                   theFlushHandler)
   {
  -     // Set input sources
  -     XSLTInputSource         theInputSource(&theXMLInStream);
  -     XSLTInputSource         theStylesheetSource;    
  -     
  -     // Set output target
  -     XSLTResultTarget        theResultTarget(&theOutStream);
  +     // Set to output target to the callback 
  +     XalanTransformerOutputStream    theOutputStream(theOutputHandle, 
theOutputHandler, theFlushHandler);
  +     XalanOutputStreamPrintWriter    thePrintWriter(theOutputStream);
  +     XSLTResultTarget                                
theResultTarget(&thePrintWriter);
   
        // Do the transformation...
        return transform(
                                        theInputSource, 
  -                                     theStylesheetSource,
  +                                     theCompiledStylesheet,
                                        theResultTarget);
   }
   
  @@ -373,19 +405,11 @@
   
   int
   XalanTransformer::transform(
  -             const char*                             theXMLFileName, 
  -             const char*                             theXSLFileName,
  -             const void*                             theOutputHandle, 
  -             XalanOutputHandlerType  theOutputHandler,
  -             XalanFlushHandlerType   theFlushHandler)
  -{
  -     // Set input sources
  -     const XalanDOMString    theDOMStringXMLFileName(theXMLFileName);
  -     const XalanDOMString    theDOMStringXSLFileName(theXSLFileName);
  -
  -     const XSLTInputSource   theInputSource(c_wstr(theDOMStringXMLFileName));
  -     const XSLTInputSource   
theStylesheetSource(c_wstr(theDOMStringXSLFileName));
  -
  +                     const XSLTInputSource&          theInputSource,         
        
  +                     const void*                                     
theOutputHandle, 
  +                     XalanOutputHandlerType          theOutputHandler,
  +                     XalanFlushHandlerType           theFlushHandler)
  +{
        // Set to output target to the callback 
        XalanTransformerOutputStream    theOutputStream(theOutputHandle, 
theOutputHandler, theFlushHandler);
        XalanOutputStreamPrintWriter    thePrintWriter(theOutputStream);
  @@ -394,12 +418,117 @@
        // Do the transformation...
        return transform(
                                        theInputSource, 
  -                                     theStylesheetSource,
  +                                     XSLTInputSource(),
                                        theResultTarget);
   }
   
   
   
  +XalanCompiledStylesheet*
  +XalanTransformer::compileStylesheet(const XSLTInputSource&           
theStylesheetSource)
  +{
  +     // Clear the error message.
  +     m_errorMessage.clear();
  +     m_errorMessage.push_back(0);
  +
  +     // Store error messages from problem listener.
  +     XalanDOMString  theErrorMessage;
  +
  +     try
  +     {       
  +             // Create a new XalanCompiledStylesheet.
  +             XalanCompiledStylesheet* const theCompiledStylesheet =
  +                     new XalanCompiledStylesheet(
  +                                             theStylesheetSource, 
  +                                             m_xsltprocessorEnvSupport,
  +                                             m_processor);
  +
  +             // Store it in a vector.
  +             m_compiledStylesheets.push_back(theCompiledStylesheet);
  +
  +             return theCompiledStylesheet;
  +     }
  +     catch (XSLException& e)
  +     {
  +             if (length(theErrorMessage) != 0)
  +             {
  +                     TranscodeToLocalCodePage(theErrorMessage, 
m_errorMessage, true);
  +             }
  +             else
  +             {
  +                     TranscodeToLocalCodePage(e.getMessage(), 
m_errorMessage, true);
  +             }
  +             
  +     }
  +     catch (SAXException& e)
  +     {
  +             if (length(theErrorMessage) != 0)
  +             {
  +                     TranscodeToLocalCodePage(theErrorMessage, 
m_errorMessage, true);
  +             }
  +             else
  +             {
  +                     TranscodeToLocalCodePage(e.getMessage(), 
m_errorMessage, true);
  +             }
  +             
  +     }
  +     catch (XMLException& e)
  +     {
  +             if (length(theErrorMessage) != 0)
  +             {
  +                     TranscodeToLocalCodePage(theErrorMessage, 
m_errorMessage, true);
  +             }
  +             else
  +             {
  +                     TranscodeToLocalCodePage(e.getMessage(), 
m_errorMessage, true);
  +             }
  +             
  +     }
  +     catch(const XalanDOMException&  e)
  +     {
  +             if (length(theErrorMessage) != 0)
  +             {
  +                     TranscodeToLocalCodePage(theErrorMessage, 
m_errorMessage, true);
  +             }
  +             else
  +             {
  +                     XalanDOMString theMessage("XalanDOMException caught.  
The code is ");
  +                     
  +                     append(theMessage,  
LongToDOMString(long(e.getExceptionCode())));
  +                     append(theMessage,  XalanDOMString("."));               
                                 
  +
  +                     TranscodeToLocalCodePage(theMessage, m_errorMessage, 
true);
  +             }
  +     }
  +     return 0;
  +}
  +
  +
  +
  +void
  +XalanTransformer::setStylesheetParam(
  +                     const XalanDOMString&   key,
  +                     const XalanDOMString&   expression)
  +{
  +     // Set the stylesheet parameter.
  +     m_processor.setStylesheetParam(key,  expression);
  +}
  +
  +
  +
  +void
  +XalanTransformer::setStylesheetParam(
  +                     const char*                             key,
  +                     const char*                             expression)
  +{
  +     // Set the stylesheet parameter.
  +     m_processor.setStylesheetParam(
  +                                     XalanDOMString(key),  
  +                                     XalanDOMString(expression));
  +}
  +
  +
  +
   const char*
   XalanTransformer::getLastError() const
   {
  @@ -418,8 +547,6 @@
                
                m_parserLiaison.reset();
   
  -             m_stylesheetConstructionContext.reset();
  -
                // Clear the problem listener before it goes out of scope.
                m_processor.setProblemListener(0);
        }
  @@ -427,6 +554,4 @@
        {
        }
   }
  -
  -
   
  
  
  
  1.12      +125 -104  xml-xalan/c/src/XalanTransformer/XalanTransformer.hpp
  
  Index: XalanTransformer.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanTransformer.hpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- XalanTransformer.hpp      2001/03/02 21:02:53     1.11
  +++ XalanTransformer.hpp      2001/03/16 20:12:40     1.12
  @@ -54,8 +54,8 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -#if !defined(XALAN_TRANSFORMER_HEADER_GUARD)
  -#define XALAN_TRANSFORMER_HEADER_GUARD
  +#if !defined(XALANTRANSFORMER_HEADER_GUARD)
  +#define XALANTRANSFORMER_HEADER_GUARD
   
   
   
  @@ -64,6 +64,10 @@
   
   
   
  +#include <vector>
  +
  +
  +
   #include <PlatformSupport/DOMStringHelper.hpp>
   
   
  @@ -90,6 +94,7 @@
   
   
   
  +#include <XalanTransformer/XalanCompiledStylesheet.hpp>
   #include <XalanTransformer/XalanTransformerOutputStream.hpp>
   
   
  @@ -111,9 +116,9 @@
   
   /**
    * This is a simple C++ interface for some common usage patterns. It's 
  - * the user's responsibility to call initialize and terminate 
  - * before creating and after deleting any XalanTransformer instances 
  - * respectively.
  + * the user's responsibility to call initialize and terminate for Xerces 
  + * and Xalan before creating and after deleting any XalanTransformer  
  + * instances.
   */
   class XALAN_TRANSFORMER_EXPORT XalanTransformer
   {
  @@ -148,143 +153,163 @@
        const char*
        getLastError() const;
   
  -     /**
  -      * Transform the source tree to output in the given result tree target.
  -      * The processor will apply the the stylesheet source to the input 
source
  -      * and write the transformation output to the target. Called internally 
by 
  -      * all transform methods.
  -      *
  -      * @param inputSource           input source
  -      * @param stylesheetSource      stylesheet source
  -      * @param outputTarget          output source tree
  -      * @return      0 for success
  -      */
  -     int
  -     transform(
  -                     const XSLTInputSource&          inputSource, 
  -                     const XSLTInputSource&          stylesheetSource,
  -                     XSLTResultTarget&                       outputTarget);
  -
        /**
  -      * Transform the XML source tree to the given result file.
  -      * The processor will apply the the stylesheet source to the input 
source
  -      * and write the transformation output to the output file.
  +      * Transform will apply the stylesheet source to the input source
  +      * and write the transformation output to the target. The input 
  +      * source and result target can be a file name, a stream or a root
  +      * node.
         *
  -      * @param theXMLFileName        filename of XML input file
  -      * @param theXSLFileName        filename of stylesheet file
  -      * @param theOutFileName        filename of output file
  +      * @param theInputSource                input source
  +      * @param theStylesheetSource   stylesheet source
  +      * @param theResultTarget               output source
         * @return      0 for success
         */
        int
        transform(
  -                     const char*                                     
theXMLFileName, 
  -                     const char*                                     
theXSLFileName,
  -                     const char*                                     
theOutFileName);
  +                     const XSLTInputSource&          theInputSource, 
  +                     const XSLTInputSource&          theStylesheetSource,
  +                     const XSLTResultTarget&         theResultTarget);
   
        /**
  -      * Transform the XML source tree to the given result file.
  -      * The processor will apply the the stylesheet provided as a PI in the 
  -      * the XML to the input file and write the transformation output to the 
  -      * output file.
  +      * Transform will apply the compiled stylesheet to the input source
  +      * and write the transformation output to the target. The input 
  +      * source and result target can be a file name, a stream or a root
  +      * node. 
         *
  -      * @param theXMLFileName        filename of XML input file      
  -      * @param theOutFileName        filename of output file
  +      * @param theInputSource                input source
  +      * @param theCompiledStylesheet pointer to a compiled stylesheet
  +      * @param theResultTarget               output source 
         * @return      0 for success
         */
        int
        transform(
  -                     const char*                                     
theXMLFileName, 
  -                     const char*                                     
theOutFileName);
  +                     const XSLTInputSource&                  theInputSource, 
  +                     const XalanCompiledStylesheet*  theCompiledStylesheet,
  +                     const XSLTResultTarget&                 
theResultTarget);
   
        /**
  -      * Transform the XML source tree to an output stream.
  -      * The processor will apply the the stylesheet file to the input file
  -      * and write the transformation output to the output stream.
  +      * Transform will apply the stylesheet provided as a PI in the 
  +      * XML of the input source and write the transformation output to 
  +      * the target. The input source and result target can be a file 
  +      * name, a stream or a root node.
         *
  -      * @param theXMLFileName        filename of XML input source
  -      * @param theXSLFileName        filename of stylesheet source
  -      * @param theOutStream          a std ostream for the output
  +      * @param theInputSource                input source
  +      * @param theResultTarget               output source tree
         * @return      0 for success
         */
        int
        transform(
  -                     const char*                                     
theXMLFileName, 
  -                     const char*                                     
theXSLFileName,
  -                     ostream&                                        
theOutStream);
  +                     const XSLTInputSource&          theInputSource,         
        
  +                     const XSLTResultTarget&         theResultTarget);
   
        /**
  -      * Transform the XML source tree to an output stream.
  -      * The processor will apply the the stylesheet provided as a PI in the
  -      * the XML to the input file and write the transformation output to the 
  -      * output stream.
  -      *
  -      * @param theXMLFileName        filename of XML input source
  -      * @param theXSLFileName        filename of stylesheet source
  -      * @param theOutStream          a std ostream for the output
  -      * @return      0 for success
  -      */
  -     int
  -     transform(
  -                     const char*                                     
theXMLFileName, 
  -                     ostream&                                        
theOutStream);
  -
  -     /**
  -      * Transform the XML source tree to an output stream.
  -      * The processor will apply the the stylesheet stream to the input 
stream
  -      * and write the transformation output to the output stream.
  +      * Transform will apply the stylesheet source to the input source
  +      * and write the transformation result to a callback function  
  +      * in pre-allocated blocks. The input source can be a file name, 
  +      * a stream or a root node. Upon termination, Xalan releases any 
  +      * allocated memory. Data passed to the callback is not guaranteed to 
  +      * be null terminated.
         *
  -      * @param theXMLInStream        a std istream for the input
  -      * @param theXSLInStream        a std istream for the input
  -      * @param theOutStream          a std ostream for the output
  -      * @return      0 for success
  +      * - See XalanTransformerOutputStream and XalanOutputHandlerType 
  +      * for more details.
  +      * 
  +      * @param theInputSource                input source
  +      * @param theStylesheetSource   stylesheet source       
  +      * @param theOutputHandle               void pointer passed through to 
callback.
  +      * @param theOutputHandler              a user defined (callback) 
function.
  +      * @param theFlushHandler               (optional) a user defined 
(callback) function.
  +      * @return      0 for success 
         */
        int
        transform(
  -                     istream&                                        
theXMLInStream, 
  -                     istream&                                        
theXSLInStream,
  -                     ostream&                                        
theOutStream);
  +                     const XSLTInputSource&          theInputSource, 
  +                     const XSLTInputSource&          theStylesheetSource,
  +                     const void*                                     
theOutputHandle, 
  +                     XalanOutputHandlerType          theOutputHandler,
  +                     XalanFlushHandlerType           theFlushHandler = 0);
        
        /**
  -      * Transform the XML source tree to an output stream.
  -      * The processor will apply the the stylesheet provided as a PI in the 
  -      * XML of the input stream and write the transformation output to the 
  -      * output stream.
  +      * Transform will apply the compiled stylesheet to the input source
  +      * and write the transformation result to a callback function  
  +      * in pre-allocated blocks. The input source can be a file name, 
  +      * a stream or a root node. Upon termination, Xalan releases any 
  +      * allocated memory. Data passed to the callback is not guaranteed to 
  +      * be null terminated.
         *
  -      * @param theXMLInStream        a std istream for the input
  -      * @param theOutStream          a std ostream for the output
  -      * @return      0 for success
  +      * - See XalanTransformerOutputStream and XalanOutputHandlerType 
  +      * for more details.
  +      * 
  +      * @param theInputSource                input source
  +      * @param theCompiledStylesheet pointer to a compiled stylesheet
  +      * @param theOutputHandle               void pointer passed through to 
callback.
  +      * @param theOutputHandler              a user defined (callback) 
function.
  +      * @param theFlushHandler               (optional) a user defined 
(callback) function.
  +      * @return      0 for success 
         */
        int
        transform(
  -                     istream&                                        
theXMLInStream, 
  -                     ostream&                                        
theOutStream);
  +                     const XSLTInputSource&                  theInputSource, 
  +                     const XalanCompiledStylesheet*  theCompiledStylesheet,
  +                     const void*                                             
theOutputHandle, 
  +                     XalanOutputHandlerType                  
theOutputHandler,
  +                     XalanFlushHandlerType                   theFlushHandler 
= 0);
   
        /**
  -      * Transform the XML source tree to a callback function.
  -      * The processor will apply the stylesheet file to the input file
  -      * and allocate the transformation result to a callback function  
  -      * in pre-allocated blocks. Upon termination, Xalan releases any 
  -      * allocated memory. Data passed to the callback is not guaranteed to 
  -      * be null terminated.
  +      * Transform will apply the stylesheet provided as a PI in the 
  +      * XML of the input source and write  the transformation result to a  
  +      * callback function in pre-allocated blocks. The input source can be 
  +      * a file name, a stream or a root node. Upon termination, Xalan 
  +      * releases any allocated memory. Data passed to the callback is not 
  +      * guaranteed to be null terminated.
         *
         * - See XalanTransformerOutputStream and XalanOutputHandlerType 
         * for more details.
         * 
  -      * @param theXMLFileName        filename of XML input source
  -      * @param theXSLFileName        filename of stylesheet source    
  -      * @param theOutputHandle       void pointer passed through to callback.
  -      * @param theOutputHandler      a user defined (callback) function.
  -      * @param theFlushHandler       (optional) a user defined (callback) 
function.
  +      * @param theInputSource                input source
  +      * @param theOutputHandle               void pointer passed through to 
callback.
  +      * @param theOutputHandler              a user defined (callback) 
function.
  +      * @param theFlushHandler               (optional) a user defined 
(callback) function.
         * @return      0 for success 
         */
        int
        transform(
  -                     const char*                                     
theXMLFileName, 
  -                     const char*                                     
theXSLFileName,
  +                     const XSLTInputSource&          theInputSource,         
        
                        const void*                                     
theOutputHandle, 
                        XalanOutputHandlerType          theOutputHandler,
  -                     XalanFlushHandlerType           theFlushHandler = 0);
  +                     XalanFlushHandlerType           theFlushHandler =0);
  +
  +     /**
  +      * Creates a complied stylesheet.  The input source can be 
  +      * a file name, a stream or a root node.
  +      *
  +      * @param theStylesheetSource   input source
  +      * @return      a pointer to a XalanCompiledStylesheet or 0 for failure.
  +      */
  +     XalanCompiledStylesheet*
  +     compileStylesheet(const XSLTInputSource&                
theStylesheetSource);
   
  +     /**
  +      * Set a top-level stylesheet parameter.  This value can be evaluated 
via
  +      * xsl:param-variable.
  +      *
  +      * @param key name of the param
  +      * @param expression expression that will be evaluated
  +      */
  +     void
  +     setStylesheetParam(
  +                     const XalanDOMString&   key,
  +                     const XalanDOMString&   expression);
  +     void
  +     setStylesheetParam(
  +                     const char*                             key,
  +                     const char*                             expression);
  +
  +#if defined(XALAN_NO_NAMESPACES)
  +     typedef vector<const XalanCompiledStylesheet*>          
CompiledStylesheetPtrVectorType;
  +#else
  +     typedef std::vector<const XalanCompiledStylesheet*>     
CompiledStylesheetPtrVectorType;
  +#endif
  +
   protected:
   
   private:
  @@ -303,21 +328,17 @@
        XPathFactoryDefault                                             
m_xpathFactory;
        
        XSLTEngineImpl                                                  
m_processor;
  -     
  -     XPathFactoryBlock                                               
m_stylesheetXPathFactory;
  -
  -     StylesheetConstructionContextDefault    m_stylesheetConstructionContext;
   
        StylesheetExecutionContextDefault               
m_stylesheetExecutionContext;
   
  +     CompiledStylesheetPtrVectorType                 m_compiledStylesheets;
  +
        CharVectorType                                                  
m_errorMessage;
   
        static XSLTInit*                                                
m_xsltInit;
   };
  -
  -
   
  -#endif       // XALAN_TRANSFORMER_HEADER_GUARD
  +#endif       // XALANTRANSFORMER_HEADER_GUARD
   
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to