You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mo...@apache.org on 2001/07/18 17:36:01 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/runtime AbstractTranslet.java DefaultRun.java DefaultSAXOutputHandler.java SAXAdapter.java StringValueHandler.java TextOutput.java TransletOutputBase.java

morten      01/07/18 08:36:01

  Modified:    java/src/org/apache/xalan/xsltc TransletOutputHandler.java
               java/src/org/apache/xalan/xsltc/cmdline Transform.java
               java/src/org/apache/xalan/xsltc/compiler Output.java
                        Stylesheet.java
               java/src/org/apache/xalan/xsltc/runtime
                        AbstractTranslet.java DefaultRun.java
                        DefaultSAXOutputHandler.java SAXAdapter.java
                        StringValueHandler.java TextOutput.java
                        TransletOutputBase.java
  Log:
  A series of changes to the XSLTC output handling to accomodate the
  set/getOutputSettings() methods in the TrAX API.
  PR:		n/a
  Obtained from:	n/a
  Submitted by:	morten@xml.apache.org
  Reviewed by:	morten@xml.apache.org
  
  Revision  Changes    Path
  1.4       +5 -3      xml-xalan/java/src/org/apache/xalan/xsltc/TransletOutputHandler.java
  
  Index: TransletOutputHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/TransletOutputHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TransletOutputHandler.java	2001/05/21 15:12:14	1.3
  +++ TransletOutputHandler.java	2001/07/18 15:36:01	1.4
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: TransletOutputHandler.java,v 1.3 2001/05/21 15:12:14 morten Exp $
  + * @(#)$Id: TransletOutputHandler.java,v 1.4 2001/07/18 15:36:01 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -65,8 +65,10 @@
   package org.apache.xalan.xsltc;
   
   import java.io.*;
  +import org.apache.xalan.xsltc.runtime.Hashtable;
   
   public interface TransletOutputHandler {
  +
       public void startDocument() throws TransletException;
       public void endDocument() throws TransletException;
       public void characters(char[] characters, int offset, int length)
  @@ -81,7 +83,7 @@
   	throws TransletException;
       public void setType(int type);
       public void setIndent(boolean indent);
  -    public void omitXmlDecl(boolean value);
  +    public void omitHeader(boolean value);
       public boolean setEscaping(boolean escape) throws TransletException;
  -    public void insertCdataElement(String elementName);
  +    public void setCdataElements(Hashtable elements);
   }
  
  
  
  1.2       +3 -4      xml-xalan/java/src/org/apache/xalan/xsltc/cmdline/Transform.java
  
  Index: Transform.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/cmdline/Transform.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Transform.java	2001/07/12 11:32:27	1.1
  +++ Transform.java	2001/07/18 15:36:01	1.2
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: Transform.java,v 1.1 2001/07/12 11:32:27 morten Exp $
  + * @(#)$Id: Transform.java,v 1.2 2001/07/18 15:36:01 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -170,13 +170,12 @@
   	    }
   
   	    // Transform the document
  -	    String encoding = translet.getOutputEncoding();
  -	    if (encoding == null) encoding = "UTF-8";
  +	    String encoding = _translet._encoding;
   
   	    //TextOutput textOutput = new TextOutput(System.out, encoding);
   	    DefaultSAXOutputHandler saxHandler = new 
   		DefaultSAXOutputHandler(System.out, encoding);
  -	    TextOutput textOutput = new TextOutput(saxHandler, encoding);
  +	    TextOutput textOutput = new TextOutput(saxHandler);
   	    translet.transform(dom, textOutput);
   
   	    if (_debug) {
  
  
  
  1.5       +150 -123  xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Output.java
  
  Index: Output.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Output.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Output.java	2001/06/06 10:45:18	1.4
  +++ Output.java	2001/07/18 15:36:01	1.5
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: Output.java,v 1.4 2001/06/06 10:45:18 morten Exp $
  + * @(#)$Id: Output.java,v 1.5 2001/07/18 15:36:01 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -76,22 +76,27 @@
   
   final class Output extends TopLevelElement {
   
  -    // These attributes are extracted from the xsl:output element
  -    private String  _method;
  +    // These attributes are extracted from the xsl:output element. They also
  +    // appear as fields (with the same type, only public) in the translet
       private String  _version;
  +    private String  _method;
       private String  _encoding;
  -    private boolean _omitXmlDeclaration = false;
  +    private boolean _omitHeader = false;
       private String  _standalone;
  -    private String  _doctypePublic;	// IGNORED!!!
  -    private String  _doctypeSystem;	// IGNORED!!!
  -    private String  _cdataElements;
  +    private String  _doctypePublic;
  +    private String  _doctypeSystem;
  +    private String  _cdata;
       private boolean _indent = false;
       private String  _mediaType;
   
  +    // Disables this output element (when other element has higher precedence)
       private boolean _disabled = false;
   
  -    // This is generated from the above data.
  -    private String _header;
  +    // Some global constants
  +    private final static String STRING_SIG = "Ljava/lang/String;";
  +    private final static String ONE_DOT_ZERO_STRING = "1.0";
  +    private final static String OUTPUT_VERSION_ERROR =
  +	"Output XML document type should be 1.0";
   
       /**
        * Displays the contents of this element (for debugging)
  @@ -101,36 +106,13 @@
   	Util.println("Output " + _method);
       }
   
  -    public void disable() {
  -	_disabled = true;
  -    }
  -
       /**
  -     * Generates the XML output document header
  +     * Disables this <xsl:output> element in case where there are some other
  +     * <xsl:output> element (from a different imported/included stylesheet)
  +     * with higher precedence.
        */
  -    private String generateXmlHeader() {
  -        // No header if user doesn't want one.
  -        if (_omitXmlDeclaration) return(Constants.EMPTYSTRING);
  -
  -	// Start off XML header
  -        final StringBuffer hdr = new StringBuffer("<?xml ");
  -	
  -	if ((_version != null) && (_version !=Constants.EMPTYSTRING))
  -	    hdr.append("version=\"" + _version + "\" ");
  -	else
  -	    hdr.append("version=\"1.0\" ");
  -
  -	if ((_encoding != null) && (_encoding !=Constants.EMPTYSTRING))
  -	    hdr.append("encoding=\"" + _encoding + "\" ");
  -	else
  -	    hdr.append("encoding=\"utf-8\" ");
  -
  -	if ((_standalone != null) && (_standalone != Constants.EMPTYSTRING))
  -	    hdr.append("standalone=\"" + _standalone + "\" ");
  -
  -	// Finish off XML header and return string.
  -	hdr.append("?>");
  -	return(hdr.toString());
  +    public void disable() {
  +	_disabled = true;
       }
   
       /**
  @@ -138,114 +120,159 @@
        */
       public void parseContents(Parser parser) {
   
  -	_method        = getAttribute("method");
  -	_version       = getAttribute("version");
  -	_encoding      = getAttribute("encoding");
  -	_doctypeSystem = getAttribute("doctype-system");
  -	_doctypePublic = getAttribute("doctype-public");
  -	_cdataElements = getAttribute("cdata-section-elements");
  -	_mediaType     = getAttribute("media-type");
  -	_standalone    = getAttribute("standalone");
  -
  -	if ((_method == null) || (_method == Constants.EMPTYSTRING))
  -	    _method = "xml";
  +	// Do nothing if other <xsl:output> element has higher precedence
  +	if (_disabled) return;
   
  -	String attrib = getAttribute("omit-xml-declaration");
  -	if ((attrib != null) && (attrib.equals("yes")))
  -	    _omitXmlDeclaration = true;
  +	String attrib = null;
   
  -	if (_method.equals("xml") || _method.equals("html")) {
  -	    attrib = getAttribute("indent");
  -	    if ((attrib != null) && (attrib.equals("yes")))
  -	        _indent = true;
  +	// Get the output XML version - only version "1.0" should be used
  +	_version = getAttribute("version");
  +	if ((_version == null) || (_version.equals(Constants.EMPTYSTRING))) {
  +	    _version = ONE_DOT_ZERO_STRING;
   	}
  +	if (!_version.equals(ONE_DOT_ZERO_STRING)) {
  +	    ErrorMsg msg = new ErrorMsg(OUTPUT_VERSION_ERROR);
  +	    parser.reportError(Constants.WARNING, msg);
  +	}
  +
  +	// Get the output method - "xml", "html", "text" or <qname>
  +	_method = getAttribute("method");
  +	if (_method.equals(Constants.EMPTYSTRING)) _method = null;
  +	if (_method != null) _method = _method.toLowerCase();
  +
  +	// Get the output encoding - any value accepted here
  +	_encoding = getAttribute("encoding");
  +	if (_encoding.equals(Constants.EMPTYSTRING)) _encoding = null;
  +
  +	// Should the XML header be omitted - translate to true/false
  +	attrib = getAttribute("omit-xml-declaration");
  +	if ((attrib != null) && (attrib.equals("yes"))) _omitHeader = true;
  +
  +	// Add 'standalone' decaration to output - use text as is
  +	_standalone = getAttribute("standalone");
  +	if (_standalone.equals(Constants.EMPTYSTRING)) _standalone = null;
   
  -	if (_method.equals("xml"))
  -	    _header = generateXmlHeader();
  -	else
  -	    _header = null;
  +	// Get system/public identifiers for output DOCTYPE declaration
  +	_doctypeSystem = getAttribute("doctype-system");
  +	if (_doctypeSystem.equals(Constants.EMPTYSTRING)) _doctypeSystem = null;
  +	_doctypePublic = getAttribute("doctype-public");
  +	if (_doctypePublic.equals(Constants.EMPTYSTRING)) _doctypePublic = null;
  +
  +	// Names the elements of whose text contents should be output as CDATA
  +	_cdata = getAttribute("cdata-section-elements");
  +	if ((_cdata != null) && (_cdata.equals(Constants.EMPTYSTRING)))
  +	    _cdata = null;
  +
  +	// Get the indent setting - only has effect for xml and html output
  +	attrib = getAttribute("indent");
  +	if ((attrib != null) && (attrib.equals("yes"))) _indent = true;
  +
  +	// Get the MIME type for the output file - we don't do anythign with it,
  +	// but our client may use it to specify a data transport type, etc.
  +	_mediaType = getAttribute("media-type");
  +	if (_mediaType.equals(Constants.EMPTYSTRING)) _mediaType = null;
   
  -	parseChildren(parser);
  +	// parseChildren(parser); - the element is always empty
   
   	parser.setOutput(this);
       }
   
       /**
  -     * Compile code to set the appropriate output type and 
  -     * output header (if any).
  +     * Compile code that passes the information in this <xsl:output> element
  +     * to the appropriate fields in the translet
        */
  -    public void translate(ClassGenerator classGen,
  -			  MethodGenerator methodGen) {
  -	
  +    public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
  +
  +	// Do nothing if other <xsl:output> element has higher precedence
   	if (_disabled) return;
   
   	ConstantPoolGen cpg = classGen.getConstantPool();
   	InstructionList il = methodGen.getInstructionList();
   
  -	// bug fix # 1406, Compile code to set xml header on/off
  -	if ( _omitXmlDeclaration ) {
  -	    final int omitXmlDecl = cpg.addInterfaceMethodref(OUTPUT_HANDLER,
  -						 "omitXmlDecl","(Z)V");
  -	    il.append(methodGen.loadHandler());
  -	    il.append(new PUSH(cpg, true));
  -	    il.append(new INVOKEINTERFACE(omitXmlDecl,2));
  -	}
  -
  -	// Compile code to set the appropriate output type.
  -	final int type = cpg.addInterfaceMethodref(OUTPUT_HANDLER,
  -						   "setType", "(I)V");
  -	il.append(methodGen.loadHandler());
  -	if (_method.equals("text")) {
  -  	    il.append(new PUSH(cpg, TextOutput.TEXT));
  -	}
  -	else if (_method.equals("xml")) {
  -	    // Handle any XML elements that should be turned into
  -	    // CDATA elements in the XML output document.
  -	    if ((_cdataElements != null) && 
  -		(_cdataElements != Constants.EMPTYSTRING)) {
  -	        StringTokenizer st = new StringTokenizer(_cdataElements,",");
  -		final int cdata = cpg.addInterfaceMethodref(OUTPUT_HANDLER,
  -						   "insertCdataElement",
  -						   "("+STRING_SIG+")V");
  -		while (st.hasMoreElements()) {
  -		    il.append(DUP); // Reference to handler on stack
  -		    il.append(new PUSH(cpg,st.nextToken()));
  -		    il.append(new INVOKEINTERFACE(cdata,2));
  -		}
  -	    }
  -	    il.append(new PUSH(cpg, TextOutput.XML));
  +	int field = 0;
  +        il.append(classGen.loadTranslet());
  +
  +	// Only update _version field if set and different from default
  +	if ((_version != null) && (!_version.equals(ONE_DOT_ZERO_STRING))) {
  +	    field = cpg.addFieldref(TRANSLET_CLASS, "_version", STRING_SIG);
  +	    il.append(DUP);
  +	    il.append(new PUSH(cpg, _version));
  +	    il.append(new PUTFIELD(field));
   	}
  -	else if (_method.equals("html")) {
  -	    il.append(new PUSH(cpg, TextOutput.HTML));
  +
  +	// Only update _method field if "method" attribute used
  +	if (_method != null) {
  +	    field = cpg.addFieldref(TRANSLET_CLASS, "_method", STRING_SIG);
  +	    il.append(DUP);
  +	    il.append(new PUSH(cpg, _method));
  +	    il.append(new PUTFIELD(field));
   	}
  -	else {
  -	    il.append(new PUSH(cpg, TextOutput.QNAME));
  +
  +	// Only update if _encoding field is "encoding" attribute used
  +	if (_encoding != null) {
  +	    field = cpg.addFieldref(TRANSLET_CLASS, "_encoding", STRING_SIG);
  +	    il.append(DUP);
  +	    il.append(new PUSH(cpg, _encoding));
  +	    il.append(new PUTFIELD(field));
   	}
  -	il.append(new INVOKEINTERFACE(type,2));
   
  +	// Only update if "omit-xml-declaration" used and set to 'yes'
  +	if (_omitHeader) {
  +	    field = cpg.addFieldref(TRANSLET_CLASS, "_omitHeader", "Z");
  +	    il.append(DUP);
  +	    il.append(new PUSH(cpg, _omitHeader));
  +	    il.append(new PUTFIELD(field));
  +	}
  +
  +	// Add 'standalone' decaration to output - use text as is
  +	if (_standalone != null) {
  +	    field = cpg.addFieldref(TRANSLET_CLASS, "_standalone", STRING_SIG);
  +	    il.append(DUP);
  +	    il.append(new PUSH(cpg, _standalone));
  +	    il.append(new PUTFIELD(field));
  +	}
  +
  +	// Set system/public doctype only if both are set
  +	if ((_doctypePublic != null) && (_doctypeSystem != null)) {
  +	    field = cpg.addFieldref(TRANSLET_CLASS,"_doctypeSystem",STRING_SIG);
  +	    il.append(DUP);
  +	    il.append(new PUSH(cpg, _doctypeSystem));
  +	    il.append(new PUTFIELD(field));
  +	    field = cpg.addFieldref(TRANSLET_CLASS,"_doctypePublic",STRING_SIG);
  +	    il.append(DUP);
  +	    il.append(new PUSH(cpg, _doctypePublic));
  +	    il.append(new PUTFIELD(field));
  +	}
  +	
  +	// Add 'medye-type' decaration to output - if used
  +	if (_mediaType != null) {
  +	    field = cpg.addFieldref(TRANSLET_CLASS, "_mediaType", STRING_SIG);
  +	    il.append(DUP);
  +	    il.append(new PUSH(cpg, _mediaType));
  +	    il.append(new PUTFIELD(field));
  +	}
  +
   	// Compile code to set output indentation on/off
  -	if ( _indent ) {
  -	    final int indent = cpg.addInterfaceMethodref(OUTPUT_HANDLER,
  -							 "setIndent","(Z)V");
  -	    il.append(methodGen.loadHandler());
  -	    il.append(new PUSH(cpg, true));
  -	    il.append(new INVOKEINTERFACE(indent,2));
  +	if (_indent ) {
  +	    field = cpg.addFieldref(TRANSLET_CLASS, "_indent", "Z");
  +	    il.append(DUP);
  +	    il.append(new PUSH(cpg, _indent));
  +	    il.append(new PUTFIELD(field));
   	}
  -    }
   
  -    /**
  -     *  Sets the character encoding in the translet. This method is   
  -     *  called from org.apache.xalan.xsltc.compiler.Stylesheet in order to
  -     *  have the value of the encoding  that was specified in the
  -     *  stylesheet (<xsl:output> element) available in the translets
  -     *  constructor.  
  -     */
  -    public void translateEncoding(ClassGenerator classGen, InstructionList il) {
  -	ConstantPoolGen cpg = classGen.getConstantPool();
  -        il.append(classGen.loadTranslet());
  -        il.append(new PUSH(cpg, _encoding));
  -        il.append(new PUTFIELD(cpg.addFieldref(TRANSLET_CLASS,
  -					       "_encoding",
  -					       "Ljava/lang/String;")));
  +	// Forward to the translet any elements that should be output as CDATA
  +	if (_cdata != null) {
  +	    int index = cpg.addMethodref(TRANSLET_CLASS,
  +					 "addCdataElement",
  +					 "(Ljava/lang/String;)V");
  +	    StringTokenizer tokens = new StringTokenizer(_cdata);
  +	    while (tokens.hasMoreTokens()) {
  +		il.append(DUP);
  +		il.append(new PUSH(cpg, tokens.nextToken()));
  +		il.append(new INVOKEVIRTUAL(index));
  +	    }
  +	}
  +	il.append(POP); // Cleanup - pop last translet reference off stack
       }
  +
   }
  
  
  
  1.11      +29 -18    xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Stylesheet.java
  
  Index: Stylesheet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Stylesheet.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Stylesheet.java	2001/07/09 10:17:41	1.10
  +++ Stylesheet.java	2001/07/18 15:36:01	1.11
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: Stylesheet.java,v 1.10 2001/07/09 10:17:41 morten Exp $
  + * @(#)$Id: Stylesheet.java,v 1.11 2001/07/18 15:36:01 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -405,9 +405,6 @@
   	
   	addDOMField(classGen);
   
  -	// Compile a default constructor to init the namesIndex table
  -	//compileConstructor(classGen);
  -
   	// Compile transform() to initialize parameters, globals & output
   	// and run the transformation
   	compileTransform(classGen);
  @@ -447,15 +444,27 @@
   	    getXSLTC().dumpClass(classGen.getJavaClass());
   	}
       }
  -	
  +
  +    /**
  +     * Compile the translet's constructor
  +     */
       private void compileConstructor(ClassGenerator classGen, Output output) {
   
   	final ConstantPoolGen cpg = classGen.getConstantPool();
   	final InstructionList il = new InstructionList();
  +
  +	final MethodGenerator constructor =
  +	    new MethodGenerator(ACC_PUBLIC,
  +				de.fub.bytecode.generic.Type.VOID, 
  +				null, null, "<init>", 
  +				_className, il, cpg);
  +
  +	// Call the constructor in the AbstractTranslet superclass
   	il.append(classGen.loadTranslet());
   	il.append(new INVOKESPECIAL(cpg.addMethodref(TRANSLET_CLASS,
   						     "<init>", "()V")));
   
  +	// Put the names array into the translet - used for dom/translet mapping
   	final Vector names = getXSLTC().getNamesIndex();
   	il.append(classGen.loadTranslet());
   	il.append(new PUSH(cpg, names.size()));
  @@ -472,6 +481,7 @@
   					       NAMES_INDEX,
   					       NAMES_INDEX_SIG)));
   
  +	// Put the namespace names array into the translet
   	final Vector namespaces = getXSLTC().getNamespaceIndex();
   	il.append(classGen.loadTranslet());
   	il.append(new PUSH(cpg, namespaces.size()));
  @@ -488,17 +498,12 @@
   					       NAMESPACE_INDEX,
   					       NAMESPACE_INDEX_SIG)));
   
  -	// Introduces bytecodes to set encoding from <xsl:output> if exists. 
  +	// Compile in code to set the output configuration from <xsl:output>
   	if (output != null) {
  -	    output.translateEncoding(classGen, il);
  +	    // Set all the output settings files in the translet
  +	    output.translate(classGen, constructor);
   	}
   
  -	final MethodGenerator constructor =
  -	    new MethodGenerator(ACC_PUBLIC,
  -				de.fub.bytecode.generic.Type.VOID, 
  -				null, null, "<init>", 
  -				_className, il, cpg);
  -	
   	// Compile default decimal formatting symbols.
   	// This is an implicit, nameless xsl:decimal-format top-level element.
   	if (_numberFormattingUsed)
  @@ -510,10 +515,8 @@
   	constructor.setMaxLocals();
   	constructor.setMaxStack();
   	classGen.addMethod(constructor.getMethod());
  -
       }
   
  -
       /**
        * Compile a topLevel() method into the output class. This method is 
        * called from transform() to handle all non-template top-level elemtents.
  @@ -571,12 +574,12 @@
   	// Compile code for other top-level elements
   	while (elements.hasMoreElements()) {
   	    final Object element = elements.nextElement();
  +	    /*
   	    // xsl:output
   	    if (element instanceof Output) {
   		((Output)element).translate(classGen, toplevel);
   	    }
   	    // xsl:key
  -	    /*
   	    else if (element instanceof Key) {
   		final Key key = (Key)element;
   		key.translate(classGen, toplevel);
  @@ -584,7 +587,7 @@
   	    }
   	    */
   	    // xsl:decimal-format
  -	    else if (element instanceof DecimalFormatting) {
  +	    if (element instanceof DecimalFormatting) {
   		((DecimalFormatting)element).translate(classGen,toplevel);
   	    }
   	    // xsl:strip/preserve-space
  @@ -771,7 +774,15 @@
   	// continue with globals initialization
   	il.append(new PUSH(cpg, DOM.ROOTNODE));
   	il.append(new ISTORE(current.getIndex()));
  -	
  +
  +	// Transfer the output settings to the output post-processor
  +	il.append(classGen.loadTranslet());
  +	il.append(transf.loadHandler());
  +	final int index = cpg.addMethodref(TRANSLET_CLASS,
  +					   "transferOutputSettings",
  +					   "("+OUTPUT_HANDLER_SIG+")V");
  +	il.append(new INVOKEVIRTUAL(index));
  +
   	// Look for top-level elements that need handling
   	final Enumeration toplevel = elements();
   	if ((_globals.size() > 0) || (toplevel.hasMoreElements())) {
  
  
  
  1.12      +77 -20    xml-xalan/java/src/org/apache/xalan/xsltc/runtime/AbstractTranslet.java
  
  Index: AbstractTranslet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/AbstractTranslet.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- AbstractTranslet.java	2001/07/12 15:54:50	1.11
  +++ AbstractTranslet.java	2001/07/18 15:36:01	1.12
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: AbstractTranslet.java,v 1.11 2001/07/12 15:54:50 morten Exp $
  + * @(#)$Id: AbstractTranslet.java,v 1.12 2001/07/18 15:36:01 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -79,6 +79,19 @@
   
   public abstract class AbstractTranslet implements Translet {
   
  +    // These attributes are extracted from the xsl:output element. They also
  +    // appear as fields (with the same type, only public) in Output.java
  +    public String  _version = "1.0";
  +    public String  _method = null;
  +    public String  _encoding = "utf-8";
  +    public boolean _omitHeader = false;
  +    public String  _standalone = null;
  +    public String  _doctypePublic = null;
  +    public String  _doctypeSystem = null;
  +    public boolean _indent = false;
  +    public String  _mediaType = null;
  +    public Hashtable _cdata = null;
  +
       // DOM/translet handshaking - the arrays are set by the compiled translet
       protected String[] namesArray;
       protected String[] namespaceArray;
  @@ -498,31 +511,75 @@
   	handler.characters(string.toCharArray(), 0, length);
       }
   
  -    // Holds output encoding - set by code compiled by compiler/Output
  -    protected String _encoding = "utf-8";
  -
       /**
  -     * Pass the output encoding setting to the output handler.
  +     * Add's a name of an element whose text contents should be output as CDATA
        */
  -    public String getOutputEncoding() {
  -      	return _encoding; 
  -    } 
  -
  -    // Holds the translet's name - God only knows what it is used for
  -    private String _transletName;
  -
  -    /**
  -     * Set the translet's name (default is class name)
  -     */
  -    public void setTransletName(String name) {
  -	_transletName = name;
  +    public void addCdataElement(String name) {
  +	if (_cdata == null) _cdata = new Hashtable();
  +	_cdata.put(name, name);
       }
   
       /**
  -     * Get the translet's name (default is class name)
  +     * Transfer the output settings to the output post-processor
        */
  -    public String getTransletName() {
  -	return _transletName;
  +    protected void transferOutputSettings(TransletOutputHandler output) {
  +
  +	// It is an error if this method is called with anything else than
  +	// the translet post-processor (TextOutput)
  +	if (!(output instanceof TextOutput)) {
  +	    System.err.println("output is "+output);
  +	    return;
  +	}
  +
  +	TextOutput handler = (TextOutput)output;
  +
  +	// Transfer the output method setting
  +	if (_method != null) {
  +	    // Transfer all settings relevant to XML output
  +	    if (_method.equals("xml")) {
  +		handler.setType(TextOutput.XML);
  +		handler.setCdataElements(_cdata);
  +		if (_version != null) handler.setVersion(_version);
  +		if (_standalone != null) handler.setStandalone(_standalone);
  +		if (_omitHeader) handler.omitHeader(true);
  +		if (_indent) handler.setIndent(_indent);
  +		if ((_doctypePublic != null) && (_doctypeSystem != null))
  +		    handler.setDoctype(_doctypeSystem, _doctypePublic);
  +	    }
  +	    // Transfer all output settings relevant to HTML output
  +	    else if (_method.equals("html")) {
  +		handler.setType(TextOutput.HTML);
  +		if (_indent)
  +		    handler.setIndent(_indent);
  +		else
  +		    handler.setIndent(true);
  +		if ((_doctypePublic != null) && (_doctypeSystem != null))
  +		    handler.setDoctype(_doctypeSystem, _doctypePublic);
  +		if (_mediaType != null) handler.setMediaType(_mediaType);
  +	    }
  +	    else if (_method.equals("text")) {
  +		handler.setType(TextOutput.TEXT);
  +	    }
  +	    else {
  +		handler.setType(TextOutput.QNAME);
  +	    }
  +	}
  +	else {
  +	    handler.setCdataElements(_cdata);
  +	    if (_version != null) handler.setVersion(_version);
  +	    if (_standalone != null) handler.setStandalone(_standalone);
  +	    if (_omitHeader) handler.omitHeader(true);
  +	    if (_indent) handler.setIndent(_indent);
  +	    if ((_doctypePublic != null) && (_doctypeSystem != null))
  +		handler.setDoctype(_doctypeSystem, _doctypePublic);
  +	}
       }
  +
  +    /*
  +    // Holds the translet's name - God only knows what it is used for
  +    private String _transletName;
  +    public void setTransletName(String name) { _transletName = name; }
  +    public String getTransletName() { return _transletName; }
  +    */
   
   }
  
  
  
  1.10      +3 -5      xml-xalan/java/src/org/apache/xalan/xsltc/runtime/DefaultRun.java
  
  Index: DefaultRun.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/DefaultRun.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultRun.java	2001/07/12 11:32:30	1.9
  +++ DefaultRun.java	2001/07/18 15:36:01	1.10
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: DefaultRun.java,v 1.9 2001/07/12 11:32:30 morten Exp $
  + * @(#)$Id: DefaultRun.java,v 1.10 2001/07/18 15:36:01 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -167,13 +167,11 @@
   	    }
   
   	    // Transform the document
  -	    String encoding = translet.getOutputEncoding();
  -	    if (encoding == null) encoding = "UTF-8";
  +	    String encoding = _translet._encoding;
   
  -	    //TextOutput textOutput = new TextOutput(System.out, encoding);
   	    DefaultSAXOutputHandler saxHandler = new 
   		DefaultSAXOutputHandler(System.out, encoding);
  -	    TextOutput textOutput = new TextOutput(saxHandler, encoding);
  +	    TextOutput textOutput = new TextOutput(saxHandler);
   	    translet.transform(dom, textOutput);
   
   	    if (_debug) {
  
  
  
  1.7       +40 -21    xml-xalan/java/src/org/apache/xalan/xsltc/runtime/DefaultSAXOutputHandler.java
  
  Index: DefaultSAXOutputHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/DefaultSAXOutputHandler.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultSAXOutputHandler.java	2001/06/06 15:17:33	1.6
  +++ DefaultSAXOutputHandler.java	2001/07/18 15:36:01	1.7
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: DefaultSAXOutputHandler.java,v 1.6 2001/06/06 15:17:33 morten Exp $
  + * @(#)$Id: DefaultSAXOutputHandler.java,v 1.7 2001/07/18 15:36:01 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -89,19 +89,17 @@
       // Contains the name of the last opened element (set in startElement())
       private String _element = null;
   
  -    // Contains the output document type (XML, HTML or TEXT).
  -    private int	_outputType = TextOutput.UNKNOWN;
  -    // Contains the name of the output encoding (default is utf-8).
  -    private String _encoding = "utf-8";
  +    // Settings passed on from TextOutput
  +    private int	    _outputType = TextOutput.UNKNOWN;
  +    private String  _encoding   = "utf-8";
  +    private String  _version    = "1.0";
  +    private String  _standalone = null;
  +    private boolean _indent = false;
  +    private boolean _omitHeader = false;
   
       // This variable is set to 'true' when a start tag is left open
       private boolean _startTagOpen = false;
   
  -    // XML output header (used only for XML output).
  -    private static final String XML_HEADER_BEG  =
  -	"<?xml version=\"1.0\" encoding=\"";
  -    private static final String XML_HEADER_END  = "\" ?>\n";
  -
       // Commonly used strings are stored as char arrays for speed
       private static final char[] BEGPI    = "<?".toCharArray();
       private static final char[] ENDPI    = "?>".toCharArray();
  @@ -117,8 +115,6 @@
   
       private static final String EMPTYSTRING = "";
   
  -    private boolean   _indent = false;
  -    private boolean   _omitXmlDecl = false;
       private boolean   _indentNextEndTag = false;
       private boolean   _linefeedNextStartTag = false;
       private int       _indentLevel = 0;
  @@ -186,14 +182,22 @@
        * Utility method - outputs an XML header
        */
       private void emitHeader() throws SAXException {
  -	if (_omitXmlDecl) {
  -	    // if true then stylesheet contained an xsl:output element
  -	    // with the omit-xml-declaration attribute set to "yes". 
  -	    return;
  +	// First check if the 'omit-xml-declaration' was set to yes in the
  +	// stylesheet's <xsl:output> element (if any)
  +	if (_omitHeader) return;
  +
  +	// If not go ahead and output the XML header
  +	StringBuffer buffer = new StringBuffer();
  +	buffer.append("<?xml version=\"");
  +	buffer.append(_version);
  +	buffer.append("\" encoding=\"");
  +	buffer.append(_encoding);
  +	if (_standalone != null) {
  +	    buffer.append("\" standalone=\"");
  +	    buffer.append(_standalone);
   	}
  -	characters(XML_HEADER_BEG);
  -	characters(_encoding);
  -	characters(XML_HEADER_END);
  +	buffer.append("\" ?>\n");
  +	characters(buffer.toString());
       }
   
       /**
  @@ -464,13 +468,28 @@
       }
   
       /**
  +     * Sets the version number that will be output in the XML header.
  +     */
  +    public void setVersion(String version) {
  +	_version = version;
  +    }
  +
  +    /**
  +     * Sets the 'standalone' attribute that will be output in the XML header.
  +     * The attribute will be omitted unless this method is called.
  +     */
  +    public void setStandalone(String standalone) {
  +	_standalone = standalone;
  +    }
  +
  +    /**
        * Turns xml declaration generation on/off, dependent on the attribute
        * omit-xml-declaration in any xsl:output element. 
        * Breaks the SAX HandlerBase interface, but TextOutput will only call
        * this method of the SAX handler is an instance of this class.
        */
  -    public void omitXmlDecl(boolean value) {
  -        _omitXmlDecl = value;
  +    public void omitHeader(boolean value) {
  +        _omitHeader = value;
       }
   
       /**
  
  
  
  1.5       +3 -3      xml-xalan/java/src/org/apache/xalan/xsltc/runtime/SAXAdapter.java
  
  Index: SAXAdapter.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/SAXAdapter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SAXAdapter.java	2001/05/21 15:13:08	1.4
  +++ SAXAdapter.java	2001/07/18 15:36:01	1.5
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: SAXAdapter.java,v 1.4 2001/05/21 15:13:08 morten Exp $
  + * @(#)$Id: SAXAdapter.java,v 1.5 2001/07/18 15:36:01 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -174,8 +174,8 @@
       public void setType(int type) {}
       public void setHeader(String header) {}
       public void setIndent(boolean indent) {}
  -    public void omitXmlDecl(boolean value) {}
  -    public void insertCdataElement(String elementName) {}
  +    public void omitHeader(boolean value) {}
  +    public void setCdataElements(Hashtable elements) { }
       public boolean setEscaping(boolean escape)  throws TransletException {
           return(true);
       }
  
  
  
  1.2       +2 -1      xml-xalan/java/src/org/apache/xalan/xsltc/runtime/StringValueHandler.java
  
  Index: StringValueHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/StringValueHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringValueHandler.java	2001/04/17 18:52:45	1.1
  +++ StringValueHandler.java	2001/07/18 15:36:01	1.2
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: StringValueHandler.java,v 1.1 2001/04/17 18:52:45 sboag Exp $
  + * @(#)$Id: StringValueHandler.java,v 1.2 2001/07/18 15:36:01 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -67,6 +67,7 @@
   import org.apache.xalan.xsltc.*;
   
   public final class StringValueHandler extends TransletOutputBase {
  +
       private char[] _buffer = new char[32];
       private int _free = 0;
   	
  
  
  
  1.12      +125 -102  xml-xalan/java/src/org/apache/xalan/xsltc/runtime/TextOutput.java
  
  Index: TextOutput.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/TextOutput.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TextOutput.java	2001/07/09 10:17:56	1.11
  +++ TextOutput.java	2001/07/18 15:36:01	1.12
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: TextOutput.java,v 1.11 2001/07/09 10:17:56 morten Exp $
  + * @(#)$Id: TextOutput.java,v 1.12 2001/07/18 15:36:01 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -73,23 +73,26 @@
   
   public final class TextOutput implements TransletOutputHandler {
   
  -    public static final int UNKNOWN = -1;
  +    // These are the various output types we handle
  +    public static final int UNKNOWN = -1; // determine type from output contents
       public static final int TEXT    = 0;
       public static final int XML     = 1;
       public static final int HTML    = 2;
  -    public static final int QNAME   = 3;
  +    public static final int QNAME   = 3;  // no special handling
   
  -    private int	      _outputType;
  +    // These parameters are set by the <xsl:output> element, or by the
  +    // get/setOutputProperty() methods in TrAX
  +    private int	   _outputType = UNKNOWN;
  +    private String _encoding;
  +    private String _mediaType = "text/html";
   
       private boolean   _escapeChars = false;
       private boolean   _startTagOpen = false;
       private boolean   _cdataTagOpen = false;
       private boolean   _headTagOpen = false;
   
  -    // Contains commonly used attributes (for speeding up output)
  -    private Hashtable _attributeTemplates = new Hashtable();
       // Contains all elements that should be output as CDATA sections
  -    private Hashtable _cdataElements = new Hashtable();
  +    private Hashtable _cdata = null;
   
       private static final String XML_PREFIX = "xml";
   
  @@ -117,7 +120,6 @@
   
       private AttributeList _attributes = new AttributeList();
       private String        _elementName = null;
  -    private String        _header;
   
       private Hashtable _namespaces;
       private Stack     _nodeStack;
  @@ -126,13 +128,15 @@
   
       // Holds the current tree depth (see startElement() and endElement()).
       private int _depth = 0;
  -
  -    private String _encoding;
   
  +    // Reference to the SAX2 handler that consumes this handler's output
       private ContentHandler _saxHandler;
   
       /**
  -     * Constructor
  +     * Creates a new translet output post-processor
  +     *
  +     * @param handler A SAX2 handler to consume the generated SAX events 
  +     * @throws IOException
        */
       public TextOutput(ContentHandler handler) throws IOException {
           _saxHandler = handler;
  @@ -140,7 +144,11 @@
       }
   
       /**
  -     * Constructor
  +     * Creates a new translet output post-processor
  +     *
  +     * @param handler A SAX2 handler to consume the generated SAX events 
  +     * @param encoding The default encoding to use (set in <xsl:output>)
  +     * @throws IOException
        */
       public TextOutput(ContentHandler handler, String encoding)
   	throws IOException {
  @@ -153,36 +161,26 @@
        * Initialise global variables
        */
       private void init() throws IOException {
  +	// Reset all output configuration from <xsl:output>
  +	_outputType = UNKNOWN;
  +	_encoding = "utf-8";
  +	_mediaType = "text/html";
  +
  +	// Reset all internal variables and tables
   	_escapeChars  = false;
   	_startTagOpen = false;
   	_cdataTagOpen = false;
  -	_outputType   = UNKNOWN;
  -	_header       = null;
  -	_encoding     = "utf-8";
  -
  -	_qnameStack   = new Stack();
  -
  -	// Empty all our hashtables
  -	_attributeTemplates.clear();
  -	_cdataElements.clear();
  +	_qnameStack = new Stack();
  +
  +	// Reset our internal namespace handling
   	initNamespaces();
       }
   
       /**
  -     * Set the output type. The type must be wither TEXT, XML or HTML.
  +     * This method is used internally when the output type was initially
  +     * undefined and the type is set (by this handler) based on the contents
  +     * of the output. Set the default values for some output paramters.
        */
  -    public void setType(int type)  {
  -	try {
  -	    _outputType = type;
  -	    if (_encoding == null) _encoding = "utf-8";
  -	    if (_saxHandler instanceof DefaultSAXOutputHandler)
  -		((DefaultSAXOutputHandler)_saxHandler).setOutputType(type);
  -	}
  -	catch (SAXException e) {
  -
  -	}
  -    }
  -
       private void setTypeInternal(int type) {
   	if (type == XML) {
   	    _escapeChars = true;
  @@ -198,40 +196,17 @@
        * Emit header through the SAX handler
        */
       private void emitHeader() throws SAXException {
  -	// Make sure the _encoding string contains something
  -	if ((_encoding == null) || (_encoding == EMPTYSTRING))
  -	    _encoding = "utf-8";
  -
   	// Output HTML header as META element
   	if (_outputType == HTML) {
   	    AttributeList attrs = new AttributeList();
  -	    attrs.add("http-equiv","Content-Type");
  -	    attrs.add("content","text/html; charset="+_encoding);
  +	    attrs.add("http-equiv", "Content-Type");
  +	    attrs.add("content", _mediaType+"; charset="+_encoding);
   	    _saxHandler.startElement(null, null, "meta", attrs);
   	    _saxHandler.endElement(null, null, "meta");
   	}
       }
   
       /**
  -     * Turns output indentation on/off. Should only be set to on
  -     * if the output type is XML or HTML.
  -     */
  -    public void setIndent(boolean indent) {
  -	if (_saxHandler instanceof DefaultSAXOutputHandler) {
  -            ((DefaultSAXOutputHandler)_saxHandler).setIndent(indent);
  -	}
  -    } 
  -
  -    /**
  -     * Directive to turn xml header declaration  on/off. 
  -     */
  -    public void omitXmlDecl(boolean value) {
  -	if (_saxHandler instanceof DefaultSAXOutputHandler) {
  -            ((DefaultSAXOutputHandler)_saxHandler).omitXmlDecl(value);
  -	}
  -    } 
  -
  -    /**
        * This method is called when all the data needed for a call to the
        * SAX handler's startElement() method has been gathered.
        */
  @@ -240,7 +215,7 @@
   	    _startTagOpen = false;
   	    
   	    // Output current element, either as element or CDATA section
  -	    if (_cdataElements.containsKey(_elementName)) {
  +	    if ((_cdata != null) && (_cdata.containsKey(_elementName))) {
   		characters(BEGCDATA);
   		_cdataTagOpen = true;
   	    }
  @@ -298,44 +273,14 @@
       }
   
       /**
  -     * Output document stream flush
  -     */ 
  -    /*
  -    public void flush() throws IOException {
  -	//_saxHandler.flush();
  -    }
  -    */
  -
  -    /**
  -     * Output document stream close
  -     */ 
  -    /*
  -    public void close() throws IOException {
  -	//_saxHandler.close();
  -    }
  -    */
  -
  -    /**
  -     * The <xsl:output method="xml"/> instruction can specify that certain
  -     * XML elements should be output as CDATA sections. This methods allows
  -     * the translet to insert these elements into a hashtable of strings.
  -     * Every output element is looked up in this hashtable before it is
  -     * output.
  -     */ 
  -    public void insertCdataElement(String elementName) {
  -	_cdataElements.put(elementName,EMPTYSTRING);
  -    }
  -
  -    /**
        * Starts the output document. Outputs the document header if the
        * output type is set to XML.
        */
       public void startDocument() throws TransletException {
           try {
               _saxHandler.startDocument();
  -            if (_outputType == XML) {
  -                _escapeChars = true;
  -            }
  +	    // Output escaping is _ALWAYS_ enabled for XML output
  +            if (_outputType == XML) _escapeChars = true;
           } catch (SAXException e) {
               throw new TransletException(e);
           }
  @@ -387,14 +332,8 @@
   	throws TransletException {
           try {
   	    // Close any open start tag
  -	    if (_startTagOpen) {
  -		closeStartTag();
  -	    }
  -            else if (_cdataTagOpen) {
  -                characters(ENDCDATA);
  -                _cdataTagOpen = false;
  -            }
  -
  +	    if (_startTagOpen) closeStartTag();
  +	    
               // Set output type to XML (the default) if still unknown.
               if (_outputType == UNKNOWN) setTypeInternal(XML);
   
  @@ -597,6 +536,8 @@
   	if (_outputType == TEXT) return;
    
   	try {
  +	    boolean closeElement = true;
  +
   	    // Close any open element
   	    if (_startTagOpen) {
   		closeStartTag();
  @@ -604,10 +545,11 @@
   	    else if (_cdataTagOpen) {
   		characters(ENDCDATA);
   		_cdataTagOpen = false;
  +		closeElement = false;
   	    }
   
   	    final String qname = (String)(_qnameStack.pop());
  -            _saxHandler.endElement(null, null, qname);
  +            if (closeElement) _saxHandler.endElement(null, null, qname);
   
               popNamespaces();
               _depth--;
  @@ -785,5 +727,86 @@
   	else
   	    return(uri+":"+local);
       }
  -    
  +
  +    /************************************************************************
  +     * The following are all methods for configuring the output settings
  +     ************************************************************************/
  +    /**
  +     * Set the output type. The type must be wither TEXT, XML or HTML.
  +     */
  +    public void setType(int type)  {
  +	try {
  +	    _outputType = type;
  +	    if (_encoding == null) _encoding = "utf-8";
  +	    if (_saxHandler instanceof DefaultSAXOutputHandler)
  +		((DefaultSAXOutputHandler)_saxHandler).setOutputType(type);
  +	}
  +	catch (SAXException e) { }
  +    }
  +
  +    /**
  +     * Turns output indentation on/off. Should only be set to on
  +     * if the output type is XML or HTML.
  +     */
  +    public void setIndent(boolean indent) {
  +	if (_saxHandler instanceof DefaultSAXOutputHandler) {
  +            ((DefaultSAXOutputHandler)_saxHandler).setIndent(indent);
  +	}
  +    } 
  +
  +    /**
  +     * Directive to turn xml header declaration  on/off. 
  +     */
  +    public void omitHeader(boolean value) {
  +	if (_saxHandler instanceof DefaultSAXOutputHandler) {
  +            ((DefaultSAXOutputHandler)_saxHandler).omitHeader(value);
  +	}
  +    }
  +
  +    /**
  +     * Set the XML output document version - should be 1.0
  +     */
  +    public void setVersion(String version) {
  +	if (_saxHandler instanceof DefaultSAXOutputHandler) {
  +            ((DefaultSAXOutputHandler)_saxHandler).setVersion(version);
  +	}
  +    }
  +
  +    /**
  +     * Set the XML standalone attribute - must be "yes" or "no"
  +     */
  +    public void setStandalone(String standalone) {
  +	if (_saxHandler instanceof DefaultSAXOutputHandler) {
  +            ((DefaultSAXOutputHandler)_saxHandler).setStandalone(standalone);
  +	}
  +    }
  +
  +    /**
  +     * Set the output document system/public identifiers
  +     */
  +    public void setDoctype(String system, String pub) {
  +	// TODO - pass these to the SAX output handler - how?
  +    }
  +
  +    /**
  +     * Set the output media type - only relevant for HTML output
  +     */
  +    public void setMediaType(String mediaType) {
  +	// This value does not have to be passed to the SAX handler. This
  +	// handler creates the HTML <meta> tag in which the media-type
  +	// (MIME-type) will be used.
  +	_mediaType = mediaType;
  +    }
  +
  +    /**
  +     * The <xsl:output method="xml"/> instruction can specify that certain
  +     * XML elements should be output as CDATA sections. This methods allows
  +     * the translet to insert these elements into a hashtable of strings.
  +     * Every output element is looked up in this hashtable before it is
  +     * output.
  +     */ 
  +    public void setCdataElements(Hashtable elements) {
  +	_cdata = elements;
  +    }
  +
   }
  
  
  
  1.4       +9 -7      xml-xalan/java/src/org/apache/xalan/xsltc/runtime/TransletOutputBase.java
  
  Index: TransletOutputBase.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/TransletOutputBase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TransletOutputBase.java	2001/05/21 15:13:14	1.3
  +++ TransletOutputBase.java	2001/07/18 15:36:01	1.4
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: TransletOutputBase.java,v 1.3 2001/05/21 15:13:14 morten Exp $
  + * @(#)$Id: TransletOutputBase.java,v 1.4 2001/07/18 15:36:01 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -64,7 +64,9 @@
   
   package org.apache.xalan.xsltc.runtime;
   
  +
   import org.apache.xalan.xsltc.*;
  +import org.apache.xalan.xsltc.runtime.Hashtable;
   
   public class TransletOutputBase implements TransletOutputHandler {
       public void startDocument() throws TransletException {}
  @@ -80,12 +82,12 @@
       public void comment(String comment) throws TransletException {}
       public void processingInstruction(String target, String data)
   	throws TransletException {}
  +    public boolean setEscaping(boolean escape) 
  +	throws TransletException { return true; }
  +    public String expandQName(String withPrefix) { return(withPrefix); }
  +
       public void setType(int type) {}
       public void setIndent(boolean indent) {}
  -    public void omitXmlDecl(boolean value) {}
  -    public void insertCdataElement(String elementName) {}
  -    public boolean setEscaping(boolean escape) throws TransletException {
  -        return true;
  -    }
  -    public String expandQName(String withPrefix) { return(withPrefix); }
  +    public void omitHeader(boolean value) {}
  +    public void setCdataElements(Hashtable elements) {}
   }
  
  
  

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