xml-xalan-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minc...@apache.org
Subject cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/trax TransformerImpl.java
Date Wed, 15 Oct 2003 18:28:27 GMT
minchau     2003/10/15 11:28:27

  Modified:    java/src/org/apache/xalan/xsltc/trax Tag: xslt20-compiled
                        TransformerImpl.java
  Log:
  bugzilla 15901 patch applied.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.71.2.1  +24 -12    xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerImpl.java
  
  Index: TransformerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerImpl.java,v
  retrieving revision 1.71
  retrieving revision 1.71.2.1
  diff -u -r1.71 -r1.71.2.1
  --- TransformerImpl.java	7 Jul 2003 18:26:13 -0000	1.71
  +++ TransformerImpl.java	15 Oct 2003 18:28:27 -0000	1.71.2.1
  @@ -99,6 +99,7 @@
   import org.apache.xalan.xsltc.StripFilter;
   import org.apache.xalan.xsltc.Translet;
   import org.apache.xalan.xsltc.TransletException;
  +import org.apache.xml.serializer.OutputPropertiesFactory;
   import org.apache.xml.serializer.SerializationHandler;
   import org.apache.xalan.xsltc.compiler.util.ErrorMsg;
   import org.apache.xalan.xsltc.dom.DOMWSFilter;
  @@ -1012,13 +1013,7 @@
        */
       private Properties createOutputProperties(Properties outputProperties) {
   	final Properties defaults = new Properties();
  -	defaults.setProperty(OutputKeys.ENCODING, "UTF-8");
  -	defaults.setProperty(OutputKeys.METHOD, XML_STRING);
  -	defaults.setProperty(OutputKeys.INDENT, NO_STRING);
  -	defaults.setProperty(OutputKeys.MEDIA_TYPE, "text/xml");
  -	defaults.setProperty(OutputKeys.OMIT_XML_DECLARATION, NO_STRING);
  -	defaults.setProperty(OutputKeys.STANDALONE, NO_STRING);
  -	defaults.setProperty(OutputKeys.VERSION, "1.0");
  +	setDefaults(defaults, "xml");
   
   	// Copy propeties set in stylesheet to base
   	final Properties base = new Properties(defaults);
  @@ -1039,18 +1034,35 @@
   	final String method = base.getProperty(OutputKeys.METHOD);
   	if (method != null) {
   	    if (method.equals("html")) {
  -		defaults.setProperty(OutputKeys.INDENT, "yes");
  -		defaults.setProperty(OutputKeys.VERSION, "4.0");
  -		defaults.setProperty(OutputKeys.MEDIA_TYPE, "text/html");
  +	        setDefaults(defaults,"html");
   	    }
   	    else if (method.equals("text")) {
  -		defaults.setProperty(OutputKeys.MEDIA_TYPE, "text/plain");
  +	        setDefaults(defaults,"text");
   	    }
   	}
   
   	return base; 
       }
   
  +	/**
  +	 * Internal method to get the default properties from the
  +	 * serializer factory and set them on the property object.
  +	 * @param props a java.util.Property object on which the properties are set.
  +	 * @param method The output method type, one of "xml", "text", "html" ...
  +	 */
  +	private void setDefaults(Properties props, String method)
  +	{
  +		final Properties method_props =
  +			OutputPropertiesFactory.getDefaultMethodProperties(method);
  +		{
  +			final Enumeration names = method_props.propertyNames();
  +			while (names.hasMoreElements())
  +			{
  +				final String name = (String)names.nextElement();
  +				props.setProperty(name, method_props.getProperty(name));
  +			}
  +		}
  +	}
       /**
        * Verifies if a given output property name is a property defined in
        * the JAXP 1.1 / TrAX spec
  
  
  

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


Mime
View raw message