Re: XSLT vs JSP

Subject: Re: XSLT vs JSP
From: Scott Ferguson <ferg@xxxxxxxxxx>
Date: Sat, 26 Jun 1999 18:28:44 +0000
> From: "James Tauber" <jtauber@xxxxxxxxxxx>
>
> > Does anyone know of any published studies of the advantages/disadvantages
> of
> > using XML/XSL to drive a dynamic web site versus using JSP?  Thanks.
>
> No, sorry, but I am concerned at JSPs (and ASPs before them) breaking XML
> well-formedness with the delimiters <% and %>

That's a silly thing to worry about, like saying that Lisp is better than C
because it uses '(' instead of '{', or that CSS is bad solely because it
doesn't use '<'.  Besides, JSP 1.0 has an XML encoding.

Here are some important differences:

1) JSP decided to leverage existing languages, like Java and JavaScript.  So
the number of extra tags is small.  XSLT decided to create yet another
programming language.   So it adds a number of new tags and significant
complexity to the pattern language.  Also, XSLT has lost the orthogonality
between the pattern language ('XQL') and the transformation langue
(xsl:template, etc.)

2) JSP creates dynamic content; it loves side effects.  It has direct access
to the servlet API, to the Java library, including beans and JDBC.  The entire
point is to process forms and interact with databases.  XSLT is essentially
static, side-effect free.   Oren's cool n-queens solution always produces the
same result.  It's cool from an implementation perspective, but it's
indistinguishable from a static page when a browser looks at it.

3) JSP produces a character stream.  XSLT products XML.  With JSP, there is no
'entity reference problem'.  You can produce HTML, TeX, PostScript, etc
without jumping through hoops.  On the other hand, if you want XML/DOM output
(as you do on the client side), you need to parse the output.

4) JSP jumbles content and style.  XSLT cleanly separates them.  So if you
redesign your site, you've got to change all the JSP pages.  With XSLT, you
can change the stylesheet, and *presto* your site has a new look.

The advantage of XSLT for a web site is that a non-technical writer can easily
publish XML pages; the stylesheet does all the technical work.  Take the
example of a sports club, a weblog, or an alumni web site.  The correspondant
can just create simple XML.  The XSL and the programming gurus can take care
of the formatting and navigation.

Disclosure: just so you know where my biases come from.  I'm looking at XSL
from a tool implementor's perspective, not a web site designer (though
I try...), i.e.  I've implemented JSP 1.0 and am finishing an XSLT
implementation.  In a week or two we'll have an announcement of a technology,
XTP (XML template pages), merging the capabilities of JSP and XSLT.

Scott Ferguson
Caucho Technology




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread