Bob,

Hey, stop right here... Your servlet works, right? Invoking:

http://cb:8080/examples/servlet/servlet23.BobServlet

should return XML from your servlet, right?
Then next step: pipe servlet output into Coocon. You have Cocoon
deployed in tomcat under, say, cocoon:

http://cb:8080/cocoon/welcome

Now, you have sitemap entry:

<map:match pattern="servlet23/*">
  <map:generate src="http://cb:8080/examples/servlet/servlet23.{1}"/>
  <map:transform src="stylesheets/test.xsl"/>
  <map:serialize/>
</map:match>

Did you EVER tried to access

http://cb:8080/cocoon/servlet23/BobServlet

???

If yes, what is the output?

Regards,
Vadim


> -----Original Message-----
> From: Bob Garvey [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 23, 2002 2:27 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Servlet to XSL possible?
> 
> David,
>     Thanks for your thoughts.  I am going to digest what you suggest
> further.  I think another approach that is clean, albeit no Cocoon, is
to
> leave it as a servlet, and use xalan directly - something like:
> 
>       // instantiate a TransformerFactory
>       javax.xml.transform.TransformerFactory tFactory =
>                 javax.xml.transform.TransformerFactory.newInstance();
> 
>       // ?? somehow attach a StringBuffer to the source instead of a
file
>       javax.xml.transform.Source xmlSource =
>                 new javax.xml.transform.stream.StreamSource
>                              (new
> java.net.URL("file:foo.xml").openStream());
> 
>       // write all the XML to a/the StringBuffe here ........
> 
>       // set the style sheet source
>       javax.xml.transform.Source xslSource =
>                 new javax.xml.transform.stream.StreamSource
>                              (new
> java.net.URL("file:foo.xsl").openStream());
> 
>       // Generate (instantiate) the transformer.
>       javax.xml.transform.Transformer transformer =
>                              tFactory.newTransformer(xslSource);
> 
>       // Perform the transformation, sending the output to the
response.
>       transformer.transform(xmlSource,
>                            new
> javax.xml.transform.stream.StreamResult(out));
> 
> Bob Garvey
> 

<snip/>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to