dbertoni    00/06/27 14:01:49

  Modified:    c/src/TestXSLT process.cpp
  Log:
  Fixed fetching stylesheet URI from PI.
  
  Revision  Changes    Path
  1.25      +27 -8     xml-xalan/c/src/TestXSLT/process.cpp
  
  Index: process.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/TestXSLT/process.cpp,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- process.cpp       2000/06/26 19:53:56     1.24
  +++ process.cpp       2000/06/27 21:01:48     1.25
  @@ -584,8 +584,6 @@
        if (!isEmpty(xslFileName))
        {
                stylesheet = processor.processStylesheet(xslFileName, 
theConstructionContext);
  -
  -             theExecutionContext.setStylesheetRoot(stylesheet);
        }
   
        auto_ptr<TextOutputStream>      
outputFileStream(createOutputStream(params));
  @@ -601,8 +599,6 @@
                                mimeEncoding,
                                stylesheet));
   
  -     XSLTInputSource         theInputSource(params.inFileName.c_str());
  -
        XSLTResultTarget        rTreeTarget;
   
        if(formatter.get() == 0)
  @@ -616,11 +612,34 @@
                xmlParserLiaison.setFormatterListener(formatter.get());
        }
   
  +
        // Do the transformation...
  -     processor.process(
  -                     theInputSource,
  -                     rTreeTarget,
  -                     theExecutionContext);
  +     XSLTInputSource         theInputSource(params.inFileName.c_str());
  +
  +     if (stylesheet == 0)
  +     {
  +             // No stylesheet, so the only hope is that the xml file has
  +             // PI with the stylesheet...
  +
  +             // Dummy input source...
  +             XSLTInputSource         theStylesheetSource;
  +
  +             processor.process(
  +                             theInputSource,
  +                             theStylesheetSource,
  +                             rTreeTarget,
  +                             theConstructionContext,
  +                             theExecutionContext);
  +     }
  +     else
  +     {
  +             theExecutionContext.setStylesheetRoot(stylesheet);
  +
  +             processor.process(
  +                             theInputSource,
  +                             rTreeTarget,
  +                             theExecutionContext);
  +     }
   
        return 0;
   }
  
  
  

Reply via email to