ilene 2003/01/10 13:05:06
Modified: java/src/org/apache/xalan/templates Tag: xslt20
OutputProperties.java
Log:
Propogating patch for bugzilla #6157 to xslt20 branch.
Revision Changes Path
No revision
No revision
1.20.12.1.2.1 +11 -74
xml-xalan/java/src/org/apache/xalan/templates/OutputProperties.java
Index: OutputProperties.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/OutputProperties.java,v
retrieving revision 1.20.12.1
retrieving revision 1.20.12.1.2.1
diff -u -r1.20.12.1 -r1.20.12.1.2.1
--- OutputProperties.java 14 Aug 2002 19:21:28 -0000 1.20.12.1
+++ OutputProperties.java 10 Jan 2003 21:05:06 -0000 1.20.12.1.2.1
@@ -57,29 +57,22 @@
package org.apache.xalan.templates;
import java.io.BufferedInputStream;
-import java.io.InputStream;
import java.io.IOException;
-
-import java.util.Vector;
+import java.io.InputStream;
+import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Properties;
-import java.util.Enumeration;
-
-import java.lang.Cloneable;
+import java.util.Vector;
-import org.w3c.dom.Document;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.TransformerException;
-import org.apache.xml.utils.QName;
+import org.apache.xalan.res.XSLMessages;
+import org.apache.xalan.res.XSLTErrorResources;
+import org.apache.xalan.serialize.Method;
import org.apache.xml.utils.FastStringBuffer;
+import org.apache.xml.utils.QName;
import org.apache.xml.utils.WrappedRuntimeException;
-import org.apache.xalan.serialize.Method;
-import org.apache.xalan.extensions.ExtensionHandler;
-import org.apache.xalan.res.XSLTErrorResources;
-import org.apache.xalan.res.XSLMessages;
-
-
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.OutputKeys;
/**
* This class provides information from xsl:output elements. It is mainly
@@ -948,66 +941,10 @@
public void copyFrom(OutputProperties opsrc)
throws TransformerException
{
- checkDuplicates(opsrc);
+ // Bugzilla 6157: recover from xsl:output statements
+ // checkDuplicates(opsrc);
copyFrom(opsrc.getProperties());
}
-
- /**
- * Check to see if a set of properties is at the same import level as the
- * last set of properties set that was passed as an argument to this
method.
- * This operation assumes that the OutputProperties are being called
- * from most important to least important, in document order.
- *
- * @param newProps non-null reference to OutputProperties that is about to
- * be added to this set.
- */
- private void checkDuplicates(OutputProperties newProps)
- throws TransformerException
- {
-
- if (null == m_propertiesLevels)
- m_propertiesLevels = new Hashtable();
-
- // This operation assumes that the OutputProperties are being called
- // from most important to least important, in reverse document order.
-
- int newPrecedence =
newProps.getStylesheetComposed().getImportCountComposed();
-
- Properties p = newProps.getProperties();
- Enumeration enum = p.keys();
-
- while (enum.hasMoreElements())
- {
- String key = (String) enum.nextElement();
-
- if (key.equals(OutputKeys.CDATA_SECTION_ELEMENTS))
- continue;
-
- // Do we already have this property? Call hashtable operation,
- // since we don't want to look at default properties.
- Integer oldPrecedence = (Integer) m_propertiesLevels.get(key);
- if (null == oldPrecedence)
- {
- m_propertiesLevels.put(key, new Integer(newPrecedence));
- }
- else if (newPrecedence >= oldPrecedence.intValue())
- {
- String oldValue = (String) this.m_properties.get(key);
- String newValue = (String) newProps.m_properties.get(key);
- // add name QName prop to the test?
- //QName oldName = this.getQNameProperty("name");
- //QName newName = newProps.getQNameProperty("name");
- //if ( ((oldName.equals(newName) && oldValue == null)
- if ( ((oldValue == null) && (newValue != null)) ||
!oldValue.equals(newValue) )
- {
- String msg = key + " can not be multiply defined at the same "
- + "import level! Old value = "
- + oldValue + "; New value = " + newValue;
- throw new TransformerException(msg, newProps);
- }
- }
- }
-}
/**
* Report if the key given as an argument is a legal xsl:output key.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]