[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSL processor authors - how about this approach?

Subject: Re: XSL processor authors - how about this approach?
From: Scott Ferguson <ferg@xxxxxxxxxx>
Date: Mon, 13 Mar 2000 17:11:23 -0800
scott ferguson caucho
Eric van der Vlist wrote:

> Dylan Walsh wrote:
> >
> > >Date: Wed, 08 Mar 2000 12:41:47 +0100
> > >From: Eric van der Vlist <vdv@xxxxxxxxxxxx>
> > >Subject: Re: NewBie Question - Dynamic XSL
> >
> > <snip>
> >
> > >In this architecture, the operation which is taking most of the cycles
> > >is the parsing of the XSLT sheet (which can take several seconds) and is
> > >most of the time cached.
> >
> > Has anyone considered this kind of solution for server-side XSL? :
> > Take the stylesheet, parse it and generate a custom servlet to perform this
> > transformation. Then everytime XML needs to be transformed, this servlet
> > could be run. This approach is a bit like JSP. You can do thorough
> > optimisation when creating the servlet. It may even be possible to identify
> > sheets that don't need random access, and switch to serial mode for those,
> > saving memory.
> > I would think that having custom generated Java code to move the data around
> > would be faster than trying to figure out the stylesheet at run time. Great
> > potential here for a performance boost?
> You're right.
> I think I have seen similar approaches mentioned by Resin
> (http://www.caucho.com/products/resin/index.html) and also in the Cocoon
> mailing list (but I don't think Cocoon is implementing this yet).

Well, Resin does load the generated stylesheet class directly and only recompiles
it if the XSL sources change.  But, as Mike Kay points out, the performance gain
is pretty minimal.  After all, you only need to compile the stylesheet once when
the server starts and most of the stylesheet processing time is spent doing other

The dynamic XSL idea would be pretty slow (at least for Resin), especially if
it's on a per-user preference basis. Instead, with Resin (or Cocoon), you would
probably use XML/XSL to generate a JSP page/Servlet to do the database lookup.

Part of the stylesheet might look something like:

<xsl:template match='/'>
  <jsp:useBean id='userPref' class='caucho.UserPrefBean'/>

<xsl:template match='author'>
   <xsl:attribute name='color'>&lt;%= userPref.getFavoriteColor()

userPref.init(request) does whatever database lookup is needed.  The generated
JSP file looks like:

<jsp:useBean id='userPref' class='caucho.UserPrefBean'/>


<font color='<%= userPref.getFavoriteColor()'>Kurt Vonnegut</font>

Once that's compiled into a servlet, it will run as fast as if you created the
JSP by hand, bypassing any further XSL processing.

Scott Ferguson
Caucho Technology

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

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.