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

Re: Using XT via a Java Servlet?

Subject: Re: Using XT via a Java Servlet?
From: Paul Tchistopolskii <paul@xxxxxxx>
Date: Tue, 28 Dec 1999 15:29:30 -0800
java servlet dom
Writing my answer  to the XSL-list  scares me a bit, but 
I hope I will not say something extremely stupid from 
James Clark's point of view ;-)

If there are some serious mistakes in the text below
( I'm taking about XT interlans as I see them ;-) , I hope 
James would correct me.

> Has anyone taken the DOMDemo.java example included in the demo directory of 
> XT and made it work as a Java servlet?  If so, mind sharing your code?  I'm 
> able to use LotusXSL in this manner, but haven't had any luck yet with 
> XT.  TIA,

The DOMDemo utilizes XSLTransformEngine.

I think it could be fair to say that at the moment there is kind 
of *two* transform engines in the latest version of XT.jar.

The 'basic'  and 'well-known' engine ( XSLProcessorImpl ) 
takes some 'input', builds the 'XT-specific' DOM and then allows 
you to transform that 'XT-specific' DOM into diferent 'output media'. 

You are specifying the desired 'output media' attaching 
the desired destination to OutputMethodHandlerImpl and 
then attaching the OutputMethodHandlerImpl to  
XSLProcessorImpl .

OutputMethodHandlerImpl outputMethodHandler = 
    new OutputMethodHandlerImpl(xsl);

 xsl.setOutputMethodHandler(outputMethodHandler);

 outputMethodHandler.setDestination 
  ( new ServletDestination(response) );

This pattern *does*not* work with XSLTransformEngine.
I mean that XSLTransformEngine assumes that one is 
utilizing this class for XML-DOM -> XML-DOM only transformations.

However, with semi-trivial subclassing *and* some cut&paste
I forced XSLTransformEngine to take into account  OutputMethodHandlerImpl

main[]

MySunXMLProcessorImpl reader = new MySunXMLProcessorImpl();
  
org.w3c.dom.Node Sheet = reader.load
   ( new InputSource( new URL("file", "", args[1]).toString() ) );

org.w3c.dom.Node Content = reader.load
   ( new InputSource( new URL("file", "", args[0]).toString() ) );

com.sun.xml.tree.XmlDocument doc = new com.sun.xml.tree.XmlDocument ();

OutputMethodHandlerImpl outputMethodHandler = new OutputMethodHandlerImpl( null );

//  This is important. For a servlet one should use:
//  outputMethodHandler.setDestination ( new ServletDestination(response) );

outputMethodHandler.setDestination ( new FileDescriptorDestination(FileDescriptor.out) );

reader.createTransform(Sheet).My_transform( Content, outputMethodHandler );

Rgds.Paul.

PS. If you realy need that hack very-very-much I may send it to you, but I suggest 
to wait until (if) James will come with the 'common'  design of XSLTransformEngine
and XSLProcessorImpl .




 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.