You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mk...@apache.org on 2002/09/16 21:32:16 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/compiler TransletOutput.java

mkwan       2002/09/16 12:32:16

  Modified:    java/src/org/apache/xalan/xsltc/compiler TransletOutput.java
  Log:
  Support the append attribute in the output extension element, so that
  it behavior is more like redirect:write.
  
  Revision  Changes    Path
  1.8       +16 -2     xml-xalan/java/src/org/apache/xalan/xsltc/compiler/TransletOutput.java
  
  Index: TransletOutput.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/TransletOutput.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TransletOutput.java	1 Feb 2002 20:07:09 -0000	1.7
  +++ TransletOutput.java	16 Sep 2002 19:32:16 -0000	1.8
  @@ -69,6 +69,7 @@
   final class TransletOutput extends Instruction {
   
       private Expression _filename;
  +    private boolean _append;
   
       private final static String MISSING_FILE_ATTR =
   	"The <xsltc:output> element requires a 'file' attribute.";
  @@ -88,6 +89,10 @@
       public void parseContents(Parser parser) {
   	// Get the output filename from the 'file' attribute
   	String filename = getAttribute("file");
  +        
  +        // If the 'append' attribute is set to "yes" or "true",
  +        // the output is appended to the file.
  +        String append   = getAttribute("append");
   
   	// Verify that the filename is in fact set
   	if ((filename == null) || (filename.equals(EMPTYSTRING))) {
  @@ -96,6 +101,14 @@
   
   	// Save filename as an attribute value template
   	_filename = AttributeValue.create(this, filename, parser);
  +        
  +        if (append != null && (append.toLowerCase().equals("yes") ||
  +            append.toLowerCase().equals("true"))) {
  +          _append = true;     
  +        }
  +        else
  +          _append = false;
  +          
   	parseChildren(parser);
       }
       
  @@ -124,7 +137,7 @@
   	
   	final int open =  cpg.addMethodref(TRANSLET_CLASS,
   					   "openOutputHandler",
  -					   "("+STRING_SIG+")"+
  +                                           "(" + STRING_SIG + "Z)" +
   					   TRANSLET_OUTPUT_SIG);
   
   	final int close =  cpg.addMethodref(TRANSLET_CLASS,
  @@ -134,6 +147,7 @@
   	// Create the new output handler (leave it on stack)
   	il.append(classGen.loadTranslet());
   	_filename.translate(classGen, methodGen);
  +        il.append(new PUSH(cpg, _append));
   	il.append(new INVOKEVIRTUAL(open));
   
   	// Overwrite current handler
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org