dbertoni    2003/07/01 14:16:55

  Modified:    c/src/xalanc/XalanTransformer XalanTransformer.cpp
                        XalanTransformer.hpp
  Log:
  Added a convenience function to force the output encoding.
  
  Revision  Changes    Path
  1.2       +8 -3      
xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformer.cpp
  
  Index: XalanTransformer.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformer.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XalanTransformer.cpp      29 Jun 2003 03:58:23 -0000      1.1
  +++ XalanTransformer.cpp      1 Jul 2003 21:16:55 -0000       1.2
  @@ -156,6 +156,7 @@
   #else
        m_warningStream(&std::cerr),
   #endif
  +     m_outputEncoding(),
        m_stylesheetExecutionContext(new StylesheetExecutionContextDefault)
   {
   #if defined(XALAN_USE_ICU)
  @@ -1199,10 +1200,14 @@
   
                addTraceListeners(m_traceListeners, theProcessor);
   
  -             // Since the result target is not const in our
  -             // internal intefaces, we'll pass in a local copy
  -             // of the one provided...
  +             // We may need to change the output encoding, so
  +             // we make a copy of the result target.
                XSLTResultTarget        tempResultTarget(theResultTarget);
  +
  +             if (tempResultTarget.getEncoding().length() == 0 && 
m_outputEncoding.length() != 0)
  +             {
  +                     tempResultTarget.setEncoding(m_outputEncoding);
  +             }
   
                if (theCompiledStylesheet != 0)
                {
  
  
  
  1.2       +28 -0     
xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformer.hpp
  
  Index: XalanTransformer.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/xalanc/XalanTransformer/XalanTransformer.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XalanTransformer.hpp      29 Jun 2003 03:58:23 -0000      1.1
  +++ XalanTransformer.hpp      1 Jul 2003 21:16:55 -0000       1.2
  @@ -710,6 +710,32 @@
        }
   
        /**
  +      * Get the current output encoding, if any.  Note this is not the 
output encoding
  +      * specified in a stylesheet.  Rather, it can override that encoding, 
if the
  +      *
  +      * @return A string containing the current encoding
  +      */
  +     const XalanDOMString&
  +     getOutputEncoding() const
  +     {
  +             return m_outputEncoding;
  +     }
  +
  +     /**
  +      * Set the current output encoding.  Note this will override the 
encoding
  +      * specified in the stylesheet, if the encoding is available.  However,
  +      * it will not override any encoding specified by an XSLTResultTarget
  +      * parameter to one of the transform() member functions.
  +      *
  +      * @param theEncoding The encoding to use.
  +      */
  +     void
  +     setOutputEncoding(const XalanDOMString&         theEncoding)
  +     {
  +             m_outputEncoding = theEncoding;
  +     }
  +
  +     /**
         * Get the current number of spaces to indent.
         * 
         * @return number of spaces
  @@ -956,6 +982,8 @@
        ProblemListener*                                                
m_problemListener;
   
        StreamType*                                                             
m_warningStream;
  +
  +     XalanDOMString                                                  
m_outputEncoding;
   
        // This should always be the latest data member!!!
        StylesheetExecutionContextDefault*              
m_stylesheetExecutionContext;
  
  
  

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

Reply via email to