mmidy       00/02/10 14:58:44

  Modified:    src/org/apache/xalan/xslt StylesheetRoot.java
  Log:
  Work around differences in default indent between Xalan and Xerces
  
  Revision  Changes    Path
  1.21      +14 -4     xml-xalan/src/org/apache/xalan/xslt/StylesheetRoot.java
  
  Index: StylesheetRoot.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/StylesheetRoot.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- StylesheetRoot.java       2000/02/09 21:09:02     1.20
  +++ StylesheetRoot.java       2000/02/10 22:58:44     1.21
  @@ -220,6 +220,12 @@
       formatter.setStandalone(this.getOutputStandalone());
       formatter.setMediaType(this.getOutputMediaType());
       formatter.setVersion(this.getOutputVersion());
  +    // This is to get around differences between Xalan and Xerces.
  +    // Xalan uses -1 as default for no indenting, Xerces uses 0.
  +    // So we just bump up the indent value here because we will
  +    // subtract from it at output time (FormatterToXML.init()); 
  +    if (getOutputIndent())
  +      formatter.setIndent(formatter.getIndent()+1);
       
       // Don't pass the cdata elements to the formatter, 'cause we 
       // handle it ourselves.
  @@ -331,8 +337,12 @@
           {
             OutputFormat formatter = getOutputFormat();
             if (!(processor.m_parserLiaison.getIndent() < 0))
  -          {  
  -            formatter.setIndent(processor.m_parserLiaison.getIndent());
  +          {
  +            // This is to get around differences between Xalan and Xerces.
  +            // Xalan uses -1 as default for no indenting, Xerces uses 0.
  +            // So we just bump up the indent value here because we will
  +            // subtract from it at output time (FormatterToXML.init());
  +            formatter.setIndent(processor.m_parserLiaison.getIndent() + 1);
             }  
             processor.m_flistener = 
makeSAXSerializer(outputTarget.getByteStream(),
                                                                  formatter);
  @@ -342,7 +352,7 @@
             OutputFormat formatter = getOutputFormat();
             if (!(processor.m_parserLiaison.getIndent() < 0))
             {  
  -            formatter.setIndent(processor.m_parserLiaison.getIndent());
  +            formatter.setIndent(processor.m_parserLiaison.getIndent() + 1);
             }
             processor.m_flistener = 
makeSAXSerializer(outputTarget.getCharacterStream(),
                                                                  formatter);
  @@ -352,7 +362,7 @@
             OutputFormat formatter = getOutputFormat();
             if (!(processor.m_parserLiaison.getIndent() < 0))
             {  
  -            formatter.setIndent(processor.m_parserLiaison.getIndent());
  +            formatter.setIndent(processor.m_parserLiaison.getIndent() + 1);
             }
             ostream = new FileOutputStream(outputTarget.getFileName());
             processor.m_flistener = makeSAXSerializer(ostream, formatter);
  
  
  

Reply via email to