I created a custom tag (myTag:XSLFormat) that applied a stylesheet to the
jsp. I enclosed the entire
document with the tag, effectively making the document a body content. I was
able to retrieve the
body content and transform it with the following code in the doEndTag():
(Using lotusxsl)
                XSLTProcessor processor =
XSLTProcessorFactory.getProcessor();
                XSLTInputSource xmlISource = new
XSLTInputSource(bodyContent.getReader());
                XSLTInputSource xslISheet = new XSLTInputSource(sheet);
\\passed in as attribute
                XSLTResultTarget xmlResult = new
XSLTResultTarget(bodyContent.getEnclosingWriter());
                processor.process(xmlISource,xslISheet,xmlResult);
                bodyContent.writeOut(new
OutputStreamWriter(xmlResult.getByteStream()));

For a test, I included another custom tag within the document that wrote to
the outputstream via:
                        pageContext.getOut().write("test stuff");

The transform tag was able to pick it up and change it. To be honest, I'm
new to jsp and just trying
to do a proof of concept, and haven't tried picking up data from a forward()
yet. It was a very simple test,
and I still have a way to go. Actually, I'd like to hear from anyone dealing
with the design I'm trying to implement. I guess I'm a little concerned with
mixing presentation and content, which is why I'm trying to use jsp to
create an xml document, and apply a stylesheet to the finished document. It
seems to me to be a better decoupling of the presentation(html) from the
content(jsp and xml). For example, using a model 2 architecture, how would
you handle different locales,clients, ect - each needing a different front
end? Duplicate the logic in each page? I recently looked through the jsp1.1
spec, and it seemed to indicate that in a later version it may provide
custom tags to apply xsl. Legitimate concern? Or just missing something?
Thanks,
Joe M.



> -----Original Message-----
> From: Daniel Lopez [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, April 07, 2000 5:29 AM
> To:   Joe Milora
> Subject:      Re: transforming the output stream
>
> Hi Joe,
>
> I was thinking about doingsomething similar and that was one of the
> problems I
> know I'll have to face. Would you mind sharing your approach? I thought
> about
> opening an URLConnection but then I'd lose the parameters that where sent
> with the
> original request. So, can you get the OutputStream of a forward() and then
> process
> it?
> Thanks in advance,
> Dan
>
>
> Joe Milora wrote:
>
> >         Never mind, I was able to get it to work. I hope no one spent
> too
> > much time thinking about it.
> >         But if anyone has a better idea for implementing this, I'm all
> ears.
> >         thanks.
> >
> > > -----Original Message-----
> > > From: Joe Milora
> > > Sent: Thursday, April 06, 2000 8:02 AM
> > > To:   '[EMAIL PROTECTED]'
> > > Subject:      transforming the output stream
> > >
> > >
> > >
> > > Hi everyone.
> > > I'm trying to design a jsp page similar to the following:
> > >
> > > static xml
> > > <myTagLibrary:dynamicXML>...</..>
> > >
> > > <myTagLibrary:XSLStyle  sheet="..."  source=?this?>
> > >
> > > I'd like to get the previous output of the jsp(which will now be an
> XML
> > > document) and transform
> > > it into html using XSL. Is it possible to get access to the output
> stream
> > > and change it? Or do I need
> > > a different approach? I've tried several variations so far without any
> > > luck.
> > >
> > > thanks,
> > > Joe Milora
> >
> >
> ==========================================================================
> =
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.html
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to