Subject: Re: [xsl] Xsl Include cached? From: "Abel Braaksma (online)" <abel.online@xxxxxxxxx> Date: Tue, 31 Jul 2007 01:53:50 +0200 (CEST) |
> Do any xslt processors cache xsl:include? If not, what strategies > can one use to speed this process up? > > seems that xsl:include doesn't cache include files and everything is > brought in file by file at compile time. Having to stuff one > stylesheet with every callable template in my application reads > like a monolithic tome. If you mean that performance is an issue, consider that you can reuse the compiled stylesheet, that compiling a stylesheet takes about 20ms on a 2Ghz computer and that most the time goes into transforming the xml (unless the xml is really small of course). I've quite a lot of stylesheets and did some measurements in the past about xsl:include/import or one file. Real performance gains was not achieved by changing xsl:include order, size, number etc, but by optimizing the stylesheet itself. And, in a web server environment, of course by caching the stylesheet. > > Also, is there a mechanism to allow for stylesheets to be included > at the point of request instead of having include being at the root? > For example, PHP's require_once/include_once is a very nice feature. IIRC, require_once means that a module is required once and should be loaded only once. It helps with dependency resolution. AFAIK, require_once can only be used at the root level of a PHP script. This is the same what happens with XSLT. And since you can't control the order of execution of an xslt stylesheet, it would not really make a difference (in terms of loading) whether the inclusion is done at some other level. Then again, inclusion and importing *must* be done at root level because of the semantics of the statements. For instance, an included file may use root level declarations. It would be an unrecoverable error if you were able to include these at some deeper nested level. If modularization is really an issue and you want to really control your stylesheet generation, consider creating the stylesheet with a stylesheet. That way you can include/import whatever and wherever you want, as long as the resulting stylesheet is still a compilable stylesheet. Cheers, -- Abel
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Xsl Include cached?, Robert Koberg | Thread | [xsl] Finding the current node type, Mark Anderson |
Re: [xsl] Finding the current node , David Carlisle | Date | RE: [xsl] Finding the current node , Michael Kay |
Month |