dbertoni    01/06/21 08:37:20

  Modified:    c/samples/CompileStylesheet CompileStylesheet.cpp
  Log:
  Changes for new XalanTransformer interfaces.
  
  Revision  Changes    Path
  1.18      +38 -32    
xml-xalan/c/samples/CompileStylesheet/CompileStylesheet.cpp
  
  Index: CompileStylesheet.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/samples/CompileStylesheet/CompileStylesheet.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- CompileStylesheet.cpp     2001/04/19 18:44:38     1.17
  +++ CompileStylesheet.cpp     2001/06/21 15:37:18     1.18
  @@ -55,38 +55,44 @@
                // Initialize Xalan.
                XalanTransformer::initialize();
   
  -             // Create a XalanTransformer.
  -             XalanTransformer theXalanTransformer;
  -
  -             // Our input files...The assumption is that the executable will 
be run
  -             // from same directory as the input files.
  -             const char*             theXSLFileName = "foo.xsl";
  -             
  -             // Compile the stylesheet.
  -             const XalanCompiledStylesheet* const    theCompiledStylesheet = 
  -                     theXalanTransformer.compileStylesheet(theXSLFileName);
  -
  -             assert(theCompiledStylesheet != 0);
  -
  -             for (unsigned int i = 0; i < 10; i++)
  -             {               
  -                     // Buffers passed in to ostrstream.
  -                     char            inBuffer[10];
  -                     char            outBuffer[10];  
  -
  -                     // Generate the input and output file names.
  -                     ostrstream      theFormatterIn(inBuffer, 
sizeof(inBuffer));
  -                     ostrstream      theFormatterOut(outBuffer, 
sizeof(outBuffer));
  -
  -                     theFormatterIn << "foo" << i + 1 << ".xml" << '\0';
  -                     theFormatterOut << "foo" << i + 1 << ".out" << '\0';
  -
  -                     char*           theXMLFileName = theFormatterIn.str();
  -                     char*           theOutputFileName = 
theFormatterOut.str();
  -
  -                     // Do the transform.
  -                     theResult = 
theXalanTransformer.transform(theXMLFileName, theCompiledStylesheet, 
theOutputFileName);
  -    
  +             {
  +                     // Create a XalanTransformer.
  +                     XalanTransformer theXalanTransformer;
  +
  +                     // Our input files...The assumption is that the 
executable will be run
  +                     // from same directory as the input files.
  +                     const char*             theXSLFileName = "foo.xsl";
  +                     
  +                     // Compile the stylesheet.
  +                     const XalanCompiledStylesheet*  theCompiledStylesheet = 
0;
  +
  +                     theResult =     
theXalanTransformer.compileStylesheet(theXSLFileName, theCompiledStylesheet);
  +
  +                     if (theResult == 0)
  +                     {
  +                             assert(theCompiledStylesheet != 0);
  +
  +                             for (unsigned int i = 0; i < 10; ++i)
  +                             {               
  +                                     // Buffers passed in to ostrstream.
  +                                     char    inBuffer[10];
  +                                     char    outBuffer[10];  
  +
  +                                     // Generate the input and output file 
names.
  +                                     ostrstream      
theFormatterIn(inBuffer, sizeof(inBuffer));
  +                                     ostrstream      
theFormatterOut(outBuffer, sizeof(outBuffer));
  +
  +                                     theFormatterIn << "foo" << i + 1 << 
".xml" << '\0';
  +                                     theFormatterOut << "foo" << i + 1 << 
".out" << '\0';
  +
  +                                     // Do the transform.
  +                                     theResult = 
theXalanTransformer.transform(
  +                                                     inBuffer,
  +                                                     theCompiledStylesheet,
  +                                                     outBuffer);
  +                             }
  +                     }
  +   
                        if(theResult != 0)
                        {
                                cerr << "CompileStylesheet Error: \n" << 
theXalanTransformer.getLastError()
  
  
  

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

Reply via email to