I've got II) working and III) working on production sites, and they work well,
I'm happy to report. Using XSLT to "skin" or localize JSP is much better than
the other template approaches out there.
I implemented III) by hacking GNUJSP and used two different techniques. The first
substitutes my own version of JSPWriter backed by a StringWriter, which is
passed through James Clark's XT. The second technique hopes to achieve
efficiency by saving the in-memory source document/parser step. I
I have the JSP compiler alter any text of the form
<wml>
<card ...>
etc
into direct calls to org.xml.sax.DocumentHandler.startElement("wml", ...) so that
the parsing step is avoided. It took some hacking of XT though. And of
course, any internal out.print's must be handled specially, and can't
output non-wellformed fragments.
If I ever get around to converting my site to Tomcat, I was thinking of
doing it via some kind of tag like:
<x:xmlfilter type="text/xsl" stylesheet="foo.xsl">
xml stuff
</x:xmlfilter>
if possible. This would allow different filtering techniques like
<x:xmlfilter type="java/sax" stylesheet="com.foo.bar.SAXFilter">
or
<x:xmlfilter type="java/dom" stylesheet="com.foo.bar.DOMFilter">
The only thing I worry about is scalability. All that buffering
and creating of object models in the heap adds to latency, and
causes more GC. Building up a giant document, parsing it
into DOM in the heap and then applying an XSLT which results
in another result-set tree could mean hundreds of K of heap
chewed per request. Right now, since my site isn't getting
millions of hits a day, it's not a problem, but I wonder.
I posted a small essay on the XSL a while ago about optimizing
for XSLT transformations by avoiding building a complete DOM
tree when possible. Maybe the Caucho guys will answer my prayers
and produce a kick-ass ultra fast scalable XSLT. So far, no one
has been able to beat XT's speed. :)
> That is also my categorisation.
>
> The current thoughts (all to be validated in the expert gropus) are:
>
> * do (IV) in the standard tag library
> * do (III) in the container by providing the mechanism at the Servlet
> layer, and perhaps provide a way to access it from JSP.
> * II requires finalizing the XML view of a JSP page, so we will look at
> this in the JSP spec.
>
> One additional disadvantage of (IV) on the current Servlet spec is that
> I only know how to implement it by doing a new client request (so we can
> get hold of the XML doc source and apply the transformation -- I am
> assuming the source is given as a URL). This we also want to address in
> Servlet 2.3.
>
> Hope this helps,
>
> - eduard/o
>
> > Date: Fri, 11 Feb 2000 10:47:37 -0800
> > From: Scott Ferguson <[EMAIL PROTECTED]>
> > Subject: Re: JSP generating XML, passed through XSL?
> >
> > I like this. It's a good thing that different vendors are experimenting with
> > different XSL techniques and I'm glad Sun is avoiding XSL for now.
> > Standardizing
> > before anyone knows what works would be a bad thing.
> >
> > FYI, here's a list of jsp/xsl techniques that I'm aware of:
> >
> > I) XSL precompilation. Use any standard XSLT processor to combine an XML page
> > and an XSL stylesheet into a JSP file.
> > ...
> >
> > II) Embedded XSL precompilation. Similar to the above, but the servlet engine
> > builds the JSP/servlet on the fly.
> > ...
> >
> > III) XSL filtering. A servlet/jsp generates an XML document which then gets
> > processed by an XSL stylesheet.
> > ...
> >
> > IV) XSL tags
> > ...
> >
> > Have I missed or misrepresented any?
> >
> > Scott Ferguson
> > Caucho Technology
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html