Saxon server-side use - caching modules?
Added by Anonymous over 19 years ago
Legacy ID: #3139033 Legacy Poster: Alexander Jerusalem (ajeru)
Hi, I'm writing a Servlet that caches javax.xml.transform.Templates instances for reuse by incoming requests. I'm slightly concerned about the scalability of this approach for a particular scenario: Say I have 200 small stylesheets, each of which imports the same large xslt file mylibrary.xsl. My assumption would be that in this case the compiled representation of mylibrary.xsl is kept in memory as part of the compiled representation of each of my 200 stylesheets and that it is recompiled 200 times. Is that correct? If yes, is there a way around this, for example by caching the compiled representation of mylibrary.xsl only once and making it accessible to each stylesheet? For short, is it possible to have per module (in the XQuery sense) caching instead of per stylesheet caching? Thanks, Alexander
Replies (3)
Please register to reply
RE: Saxon server-side use - caching modules? - Added by Anonymous over 19 years ago
Legacy ID: #3139163 Legacy Poster: Michael Kay (mhkay)
The way XSLT is defined doesn't really encourage separate compilation of modules, unfortunately. For example mylibrary.xsl needn't even be a valid stylesheet in its own right: it can contain references to variables or named templates that are defined only in the modules that import it. This doesn't mean that separate compilation is theoretically impossible, but it's certainly difficult and Saxon doesn't do it. I don't know whether this actually makes it infeasible to cache your 200 stylesheets: you'd have to look at the actual sizes involved.
RE: Saxon server-side use - caching modules? - Added by Anonymous over 19 years ago
Legacy ID: #3139180 Legacy Poster: Alexander Jerusalem (ajeru)
Thank's for your reply, Michael! Is the situation the same for XQuery?
RE: Saxon server-side use - caching modules? - Added by Anonymous over 19 years ago
Legacy ID: #3139253 Legacy Poster: Michael Kay (mhkay)
With XQuery, independent compilation of modules is a much more feasible proposition; I just haven't got around to doing it yet.
Please register to reply