robweir 00/03/13 14:44:02
Modified: src/org/apache/xalan/xslt XSLTEngineImpl.java
Log:
add additional test to switchLiaisonsIfNeeded().
Revision Changes Path
1.57 +19 -0 xml-xalan/src/org/apache/xalan/xslt/XSLTEngineImpl.java
Index: XSLTEngineImpl.java
===================================================================
RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/XSLTEngineImpl.java,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- XSLTEngineImpl.java 2000/03/13 20:34:32 1.56
+++ XSLTEngineImpl.java 2000/03/13 22:44:02 1.57
@@ -473,12 +473,25 @@
/**
* Switch the liaisons if needed according to the type of
* the source and result nodes.
+ * @param sourceNode The node being transformed -- may be null.
+ * @param resultNode The node to which result nodes will be added -- may
be null.
*/
void switchLiaisonsIfNeeded(Node sourceNode, Node resultNode)
throws SAXException
{
// If the result node is a xerces node, try to be smart about which
// liaison is going to be used.
+
+ // Here's the logic:
+
+ // Source - Result - What we do
+ // ==========================================
+ // DTM - Xerces DOM - error, you can't mix types
+ // DTM - DTM - Do nothing, We're OK
+ // Xerces DOM - DTM - error, you can't have DTM as a result
+ // Xerces DOM - Xerces DOM - switch to Xerces Liaison
+
+
if((null != resultNode) && (resultNode instanceof
org.apache.xerces.dom.NodeImpl) &&
(m_parserLiaison instanceof org.apache.xalan.xpath.dtm.DTMLiaison))
{
@@ -495,6 +508,12 @@
else if((null != sourceNode)&& (sourceNode instanceof
org.apache.xerces.dom.NodeImpl) &&
(m_parserLiaison instanceof org.apache.xalan.xpath.dtm.DTMLiaison))
{
+ if((null != resultNode)
+ && (!(resultNode instanceof org.apache.xerces.dom.NodeImpl)))
+ {
+ throw new SAXException("Can not mix Xerces-DOM input with non
Xerces-DOM output!");
+ }
+
XMLParserLiaison newLiaison = new
org.apache.xalan.xpath.xdom.XercesLiaison();
newLiaison.copyFromOtherLiaison((XMLParserLiaisonDefault)m_parserLiaison);
setExecContext(newLiaison);