Julie Basu wrote:

> Oracle's JSP engine (http://technet.oracle.com/tech/java/servlets/) supports
> applying
> a stylesheet to a generated JSP page using the <jml:transform tag>.

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.  I know of a site that has the same basic content
(the xml) but several different styles (each with an xsl).  Right now, they've got a
JSP file for each style.  They're looking at xml/xsl -> JSP precompilation to make
their life more sane.

  + servlet engine independent
  + as fast as JSP
  - requires some extra make/build steps to create the jsp

II) Embedded XSL precompilation.  Similar to the above, but the servlet engine
builds the JSP/servlet on the fly.

Cocoon: generates servlets from XML and XSL.
Resin's XTP: generates JSP from XML and XSL.

  + as fast as JSP
  + No extra build step and therefore no additional make/workspace configuration.
  - Debugging is somewhat trickier because tracking the bug back to XSL is an extra
step.
  - Experimental, requires special tags to generate executable code (e.g.
jsp:expression)

III) XSL filtering.  A servlet/jsp generates an XML document which then gets
processed by an XSL stylesheet.  Most servlet engines will support this because most
support some sort of servlet chaining/filtering.  The basic technique is to set the
contentType to a special content-type.  For example, in Resin you can use:

<%@ page contentType="x-application/xsl" %>
<?xml-stylesheet href='my-stylesheet.xsl'?>
<top>
  ...

  + Supported by most servlet engines (and servlet filtering is part of the Servlet
2.3 plans?)
  + Conceptually simple, no special tags required (and no precompilation step to
muddle debugging).
  - Performance penalty because the XML must be parsed and the stylesheet must run
on each request.

IV) XSL tags -- this is the Oracle technique (and Microsoft in ASP?)  The contents
of a JSP 1.1 tag is transformed by a XSL stylesheet.

  + Flexible.  The other techniques apply a single stylesheet to the whole page.
This lets you use different stylesheets for small chunks.
  + Conceptually simple.
  +/- Since it uses the standard taglib and it should work with any XSLT processor,
it should be easily implemented in any servlet engine.  But it's only currently
supported in Oracle that I know of.
  - Performance penalty because the stylesheet must run for each request.

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

Reply via email to