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