xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Boag/CAM/Lotus" <Scott_B...@lotus.com>
Subject Re: xslt with existing DOM nodes
Date Tue, 18 Jan 2000 05:57:10 GMT

The problem is that we have these things called XMLParserLiaisons, which
are the glue to a give parser/DOM implementation, and the processor.  The
default liaison, the DTMLiaison, is not compatible with the DOM nodes from
Xerces, so you need to create the processor via:

      XSLTProcessor xsltProcessor
        = XSLTProcessorFactory.getProcessor(new

This should solve your problem.

> Am I doing something wrong?

You're being mislead by our bad interface.  We need to handle this
automatically for the common case.


                    Brian Dupras                                                         
                    <briand@cente        To:     "Xml-Apache (E-mail)" <general@xml.apache.org>
                    ra.com>              cc:     (bcc: Scott Boag/CAM/Lotus)          
                                         Subject:     xslt with existing DOM nodes       
                    01:24 PM                                                             
                    respond to                                                           

I'm trying to use xalan to transform an xml element using an xslt
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

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:

           Document xmldocResult = new DocumentImpl();
           Element xml = getxml("a.xml");
           Element xsl = getxml("b.xsl");
           xsltProcessor.process(new XSLTInputSource(xml),
                                          new XSLTInputSource(xsl),
           debugout("transform passed: " +
} 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.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

View raw message