You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mi...@apache.org on 2006/12/13 06:31:04 UTC
svn commit: r486502 -
/xalan/java/tags/xalan-j_2_7_1/src/org/apache/xalan/xsltc/trax/TransformerImpl.java
Author: minchau
Date: Tue Dec 12 21:30:57 2006
New Revision: 486502
URL: http://svn.apache.org/viewvc?view=rev&rev=486502
Log:
Pulling out the patch that was from XALANJ-2133 since it caused
regressions in some of the flavours of testing.
Modified:
xalan/java/tags/xalan-j_2_7_1/src/org/apache/xalan/xsltc/trax/TransformerImpl.java
Modified: xalan/java/tags/xalan-j_2_7_1/src/org/apache/xalan/xsltc/trax/TransformerImpl.java
URL: http://svn.apache.org/viewvc/xalan/java/tags/xalan-j_2_7_1/src/org/apache/xalan/xsltc/trax/TransformerImpl.java?view=diff&rev=486502&r1=486501&r2=486502
==============================================================================
--- xalan/java/tags/xalan-j_2_7_1/src/org/apache/xalan/xsltc/trax/TransformerImpl.java (original)
+++ xalan/java/tags/xalan-j_2_7_1/src/org/apache/xalan/xsltc/trax/TransformerImpl.java Tue Dec 12 21:30:57 2006
@@ -892,13 +892,84 @@
*/
public void transferOutputProperties(SerializationHandler handler)
{
- if (_properties != null) {
- // We don't need to parse the properties here and
- // send them one at a time to the handler.
- //
- // This is already managed in the serializer so we delegate.
- handler.setOutputFormat(_properties);
- }
+ // Return right now if no properties are set
+ if (_properties == null) return;
+
+ String doctypePublic = null;
+ String doctypeSystem = null;
+
+ // Get a list of all the defined properties
+ Enumeration names = _properties.propertyNames();
+ while (names.hasMoreElements()) {
+ // Note the use of get() instead of getProperty()
+ String name = (String) names.nextElement();
+ String value = (String) _properties.get(name);
+
+ // Ignore default properties
+ if (value == null) continue;
+
+ // Pass property value to translet - override previous setting
+ if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) {
+ doctypePublic = value;
+ }
+ else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
+ doctypeSystem = value;
+ }
+ else if (name.equals(OutputKeys.MEDIA_TYPE)) {
+ handler.setMediaType(value);
+ }
+ else if (name.equals(OutputKeys.STANDALONE)) {
+ handler.setStandalone(value);
+ }
+ else if (name.equals(OutputKeys.VERSION)) {
+ handler.setVersion(value);
+ }
+ else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
+ handler.setOmitXMLDeclaration(
+ value != null && value.toLowerCase().equals("yes"));
+ }
+ else if (name.equals(OutputKeys.INDENT)) {
+ handler.setIndent(
+ value != null && value.toLowerCase().equals("yes"));
+ }
+ else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
+ if (value != null) {
+ StringTokenizer e = new StringTokenizer(value);
+ Vector uriAndLocalNames = null;
+ while (e.hasMoreTokens()) {
+ final String token = e.nextToken();
+
+ // look for the last colon, as the String may be
+ // something like "http://abc.com:local"
+ int lastcolon = token.lastIndexOf(':');
+ String uri;
+ String localName;
+ if (lastcolon > 0) {
+ uri = token.substring(0, lastcolon);
+ localName = token.substring(lastcolon+1);
+ } else {
+ // no colon at all, lets hope this is the
+ // local name itself then
+ uri = null;
+ localName = token;
+ }
+
+ if (uriAndLocalNames == null) {
+ uriAndLocalNames = new Vector();
+ }
+ // add the uri/localName as a pair, in that order
+ uriAndLocalNames.addElement(uri);
+ uriAndLocalNames.addElement(localName);
+ }
+ handler.setCdataSectionElements(uriAndLocalNames);
+ }
+ }
+ }
+
+ // Call setDoctype() if needed
+ if (doctypePublic != null || doctypeSystem != null) {
+ handler.setDoctype(doctypeSystem, doctypePublic);
+ }
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org