[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Feeding DOMs to XSLT Processors

Subject: Re: Feeding DOMs to XSLT Processors
From: Michael Harry Scepaniak <ihispanic@xxxxxxxxx>
Date: Tue, 8 Feb 2000 05:15:33 -0800 (PST)
creating a dom from bytearrayoutputstream
Mark,

This is derived from my current, working code:

StylesheetRoot styRoot = null;
XSLTEngineImpl xsltEI = null;
//...
XercesLiaison xercesLiaison = new XercesLiaison();
this.xsltEI = new XSLTEngineImpl(xercesLiaison);
try
{
     this.styRoot = this.xsltEI.processStylesheet("foo.xsl");
}
catch(SAXException ex){ }

ByteArrayOutputStream byteout = new ByteArrayOutputStream();
XSLTResultTarget xsltResultTarget = new XSLTResultTarget(byteout);

//Create your DOM Document
//Document document = ...

try
{
     this.styRoot.process(this.xsltEI, document, xsltResultTarget);
}
catch(SAXException ex){ }

System.out.println(byteout.toString());


Mike....

> From: Paul Levin <plevin@xxxxxxx>
> Date: Thu, 03 Feb 2000 13:27:20 -0500
>
> Mike,
>     Using Xerces (XML DOM implementation and parser) and Xalan (XSLT)
you
> do the following:
>
> 1) build your DOM using methods in 
org.apache.xerces.dom.DocumentImpl.
> 2) compile your XSL stylesheet, from a file, into a
> org.apache.xalan.xslt.StylesheetRoot, using
> org.apache.xalan.xslt.XSLTEngineImpl.processStylesheet().  Be sure to
> construct the XSLTEngineImpl with an
> org.apache.xalan.xpath.xdom.XercesLiaison.
> 3) apply the StylesheetRoot to the DOM using
> org.apache.xalan.xslt.StylesheetRoot.process().
> 4) the result of process() is another DOM. If your stylesheet
generated
> HTML then this DOM has HTML nodes.  process() has the ability to
render
> this DOM, or you use some other xalan class to render this DOM to
text. (I
> do not know the name of this class off-hand, because I needed to
write my
> own renderer, since I output something other than XML, HTML and
TEXT.)

If anyone has been successful with this approach, I'd appreciate seeing
the
code that does this.
I can't get this to work. I get the following error.

"DTMLiaison can not handle nodes of typeclass
org.apache.xerces.dom.DocumentImpl"

Mark Volkmann

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.