I think it's because I'm having the parser liaison create a document to use as the result tree factory object. Yech. Argh. I ought to at least have a setDOMFactory() method on the process, but for some reason I only put in a getDOMFactory(). The &#*$^ DOM won't let you add a node to one document that was created by another document. The easiest workaround for this is to set the FormatterToDOM object yourself: public static void transformElement(Element xmlSource, Document xsl, Element xmlTarget) throws SAXException { XSLTProcessor xsltProcessor = XSLTProcessorFactory.getProcessor(new org.apache.xalan.xpath.xdom.XercesLiaison()); org.apache.xalan.xpath.xml.FormatterToDOM domMaker = new org.apache.xalan.xpath.xml.FormatterToDOM(xmlTarget.getOwnerDocument(), xmlTarget); xsltProcessor.process( new XSLTInputSource(xmlSource), new XSLTInputSource(xsl.getDocumentElement ()), new XSLTResultTarget(domMaker) ); } //transformElement Please let me know if this works around the problem for you or not. BTW, in general I'm having a pretty hard time keeping up with the mail on all the Apache lists. You're a little better off sending mail that relates to Xalan to the xalan dev list. -scott Brian Dupras ra.com> cc: (bcc: Scott Boag/CAM/Lotus) Subject: WRONG_DOCUMENT_ERR 02/03/00 11:20 AM Please respond to general I'm trying to track down a bug in my code, but i'm having some trouble. Any help is greatly appreciated. I've written the following function to transform an XML Element through an XSL Document, and store the results as children of another XML Element: public static void transformElement(Element xmlSource, Document xsl, Element xmlTarget) throws SAXException { XSLTProcessor xsltProcessor = XSLTProcessorFactory.getProcessor(new org.apache.xalan.xpath.xdom.XercesLiaison()); xsltProcessor.process( new XSLTInputSource(xmlSource), new XSLTInputSource(xsl.getDocumentElement()), new XSLTResultTarget(xmlTarget) ); } //transformElement However, I'm gettnig a WRONG_DOCUMENT_ERR. I'm not sure which part I'm doing wrong. Any clues from the above? For xmlSource, I'm passing an Element Node deep inside one document tree. For xmlTarget, I'm passing an Element Node that is owned by a different Document. xsl is a new Document that holds the xsl transform. the xsl: I'm getting this on the stderr: WRONG_DOCUMENT_ERR org.apache.xerces.dom.DOMExceptionImpl: WRONG_DOCUMENT_ERR at org.apache.xerces.dom.NodeImpl.internalInsertBefore(NodeImpl.java, Compiled Code) at org.apache.xerces.dom.NodeImpl.insertBefore(NodeImpl.java, Compiled Code) at org.apache.xerces.dom.NodeImpl.appendChild(NodeImpl.java, Compiled Code) at org.apache.xalan.xpath.xml.FormatterToDOM.append(FormatterToDOM.java:129) at org.apache.xalan.xpath.xml.FormatterToDOM.characters(FormatterToDOM.java:328 ) at org.apache.xalan.xslt.XSLTEngineImpl$ResultTreeHandler.characters(XSLTEngine Impl.java, Compiled Code) at org.apache.xalan.xslt.XSLTEngineImpl.cloneToResultTree(XSLTEngineImpl.java:1 810) at org.apache.xalan.xslt.ElemTemplateElement.transformChild(ElemTemplateElement .java:976) at org.apache.xalan.xslt.ElemTemplateElement.transformSelectedChildren(ElemTemp lateElement.java, Compiled Code) at org.apache.xalan.xslt.ElemApplyTemplates.execute(ElemApplyTemplates.java:147 ) at org.apache.xalan.xslt.ElemTemplateElement.executeChildren(ElemTemplateElemen t.java, Compiled Code) at org.apache.xalan.xslt.ElemTemplate.execute(ElemTemplate.java:141) at org.apache.xalan.xslt.StylesheetRoot.process(StylesheetRoot.java, Compiled Code) at org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java, Compiled Code) at com.medwired.pp.XmlHelper.transformElement(XmlHelper.java:65) at com.medwired.pp.components.StaticStory.render(StaticStory.java:27) at jsp.medwired.pagetest.pagegen.renderComponent(pagegen.java:312) at jsp.medwired.pagetest.pagegen.renderComponents(pagegen.java, Compiled Code) at jsp.medwired.pagetest.pagegen._jspService(pagegen.java:130) at com.livesoftware.jsp.HttpJSPServlet.service(HttpJSPServlet.java:31) at com.livesoftware.jsp.JSPServlet.service(JSPServlet.java:118) at javax.servlet.http.HttpServlet.service(HttpServlet.java:840) at com.livesoftware.jrun.JRun.runServlet(JRun.java, Compiled Code) at com.livesoftware.jrun.JRunGeneric.handleConnection(JRunGeneric.java:116) at com.livesoftware.jrun.JRunGeneric.handleProxyConnection(JRunGeneric.java:78) at com.livesoftware.jrun.service.proxy.JRunProxyServiceHandler.handleRequest(JR unProxyServiceHandler.java:102) at com.livesoftware.jrun.service.ThreadConfigHandler.run(ThreadConfigHandler.ja va, Compiled Code) Brian Dupras Centera Information Systems, Inc. phone 303.939.0200 x294 fax 303.939.0111 web http://www.centera.com email briand@centera.com