[xslt] libxslt: xsl:include/import cache?
- From: Elizabeth Mattijsen <liz dijkmat nl>
- To: xslt gnome org
- Subject: [xslt] libxslt: xsl:include/import cache?
- Date: Tue, 04 Dec 2001 00:31:18 +0100
I've been looking for ways to reduce the memory usage of a web-server that
will have a _lot_ of stylesheets, many of which will be referring to the
same "subroutine" templates by using <xsl:include>.
I understand that <xsl:include> is basically inserting the XML at the
position where it is called. So, each time a stylesheet is included with
<xsl:include>, new memory is allocated and used (as far as I can see, anyway).
I've been looking at the following lines in "libxslt/imports.c":
------------------------------------------------------------------
include = xsltLoadStyleDocument(style, URI);
if (include == NULL) {
xsltPrintErrorContext(NULL, style, cur);
xsltGenericError(xsltGenericErrorContext,
"xsl:include : unable to load %s\n", URI);
goto error;
}
oldDoc = style->doc;
style->doc = include->doc;
xsltParseStylesheetProcess(style, include->doc);
style->doc = oldDoc;
--------------------------------------------------------------------
From this I conclude that for a given URI, memory is allocated and a
pointer is returned by xsltLoadStyleDocument(). And then later that
pointer is used to integrate into the "parent" stylesheet.
Would it be _too_ simplistic to create a memory cache, keyed to URI, that
would save the "include" pointer and return that if the stylesheet at that
URI was already loaded before? And this save a _lot_ of memory when
multiple stylesheets use the same stylesheet through <xsl:include>?
Or are there other issues that would prevent this from working?
Elizabeth Mattijsen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]