Return-Path: Mailing-List: contact general-help@xml.apache.org; run by ezmlm Delivered-To: mailing list general@xml.apache.org Received: (qmail 13938 invoked from network); 17 Jan 2000 18:25:54 -0000 Received: from mail.centera.com (HELO mikasa.centera.com) (204.144.157.10) by 63.211.145.10 with SMTP; 17 Jan 2000 18:25:54 -0000 Received: by mail.centera.com with Internet Mail Service (5.0.1460.8) id ; Mon, 17 Jan 2000 11:24:51 -0700 Message-ID: From: Brian Dupras To: "Xml-Apache (E-mail)" Subject: xslt with existing DOM nodes Date: Mon, 17 Jan 2000 11:24:50 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.0.1460.8) Content-Type: text/plain I'm trying to use xalan to transform an xml element using an xslt stylesheet already loaded as a dom node. However, I get this: "DTMLiaison can not handle nodes of typeclass org.apache.xerces.dom.DeferredElementImpl" In the final version of the program, I'll be getting xml as strings and I will have processed the xml nodes a bit before this point. So it's important that I be able to use existing DOM Nodes as the input to the processor. Am I doing something wrong? (code below) xerces 1.0.1 xalan 0.19.2 Java 1.2.2 Brian Dupras In the following code, the getxml() function loads an xml document off the disk. This is a stand-in for when we'll be getting xml as strings from a server object. Here's example code: try{ Document xmldocResult = new DocumentImpl(); Element xml = getxml("a.xml"); Element xsl = getxml("b.xsl"); xsltProcessor.process(new XSLTInputSource(xml), new XSLTInputSource(xsl), new XSLTResultTarget(xmldocResult) ); debugout("transform passed: " + xmldocResult.getDocumentElement().getNodeName()); } catch (Exception e) { //right now, this error is always blown debugout("error in transform\n" + e); } private Element getxml(String fn) throws SAXParseException, SAXException, IOException { DOMParser domParser = (DOMParser)Class.forName("org.apache.xerces.parsers.DOMParser").newInstance( ); domParser.parse(strRoot + fn); return domParser.getDocument().getDocumentElement(); } //getxml(String) p.s. I've tried passing in the Document as well as the getDocumentElement() for the xsl parameter. Brian Dupras Centera Information Systems, Inc. phone 303.939.0200 x294 fax 303.939.0111 web http://www.centera.com email briand@centera.com