Title: RE: Caching XLS style sheets (MVC Architecture)

> I asked a question on an MVC application architecture
> using XLS, and got
> advice to cache XLS / XSLT style sheets, and pre
> compile them.
>
> Can someone give me some more background on this.
> How?
> What if the content is dynamic? (2 million items and
> 100,000  of styles
> + with any combination)
>
> Thanks in advance, 
> Vic

In terms of the MVC architecture, here are the appropriate
parts:

The Model -> The component responsible for holding any
precompiled stylesheets, caching them there, and retrieving
them with the appropriate keys(e.g. request path + browser
agent type). Maybe some other elementary operations such
as creating an XML Parser Pool to be used in a high
throughput scenario such as you suggest.

The Control -> A JSP Tag / Class /Servlet responsible for interpretting
the Input (XML with embedded PIs) and applying the XSL Transformation.
The model is then queried for any pre-cached instances or resources
used in the transforms.

The Display -> Output of JSP Page or Servlet  presented in a client
specific manner (e.g. HTML, WML, DHTML, etc). In the case of the JSP
Tag i would suggest a BodyTag implementation that interprets it's contents
as XML and hands them to the control. The Servlet scenario could take
arguments such as the XML Source and the XSL Stylesheet to apply and
hand them to the control.

In terms of dynamic content, it is not a problem. We have a very similar
situation and have succesfully implemented a solution along the lines
suggested above. If the content is dynamic it
needs to be generated via a processing mechanism (e.g batch process,
jsp request, etc.). The embedded XSL stylesheets however, i assume,
don't change and are static. As you encounter a uninterpreted stylesheet
you can interpret in on the fly and then cache it for further use. Then
the next time you encounter the same stylesheet, you won't need to
recompile it, just retrieve it from cache. Having dynamic content on
which to apply the stylesheet still allows you to cache/precompile
the styleheets. They are simply applied to the new content with which
they are associated.

Hope this helps.

Ted Rice
Apama, Inc.

Reply via email to