Hello Di,

Wednesday, February 06, 2002, 4:51:47 PM, you wrote:

DLG> Hello,
DLG> I'm tring to use cocoon 1.8 with tomcat.I have this problem.
DLG> how could I receive an xml file (from a server far away) , join it with an
DLG> xsl file and automatically generate the html using cocoon?
DLG> where could I find a good forum of cocoon?

DLG> Thank you
DLG> Giovanni

 I haven't drop much look to the cocoon framework, but as I realized,
 it implements javx.xml.transform API to apply XSL transformations
 to XML document. If so, the following code snippet could throw some
 light on your problem:


 1. Instantiate a TransformerFactory.
TransformerFactory tFactory =  TransformerFactory.newInstance();

// 2. Use the TransformerFactory to process the stylesheet Source and
//    generate a Transformer.
Transformer transformer = tFactory.newTransformer(new 
StreamSource("your-xsl-file.xsl"));

// 3. Use the Transformer to transform an XML Source and send the output to 
HttpServletResponse object.
transformer.transform(new 
javax.xml.transform.stream.StreamSource("http://yourserver/your-xml.xml";), response);

Depending on what should be the logic of generating html result, you
can put all this code in service() method of your servlet or made step 1)
and 2) only once in the init() if your xsl stylesheet persists the same
while only xml changing.

 Max

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to