Re: [xsl] Caching source document as an optimizationI

Subject: Re: [xsl] Caching source document as an optimizationI
From: Joseph Kesselman <keshlam@xxxxxxxxxx>
Date: Wed, 5 Feb 2003 09:30:40 -0500
>In studying the Xalan docs, I come across references to source document 
>caching. In going through the APIs I don't see a reference to a 
>cacheable source interface. Can someone shed some light on this, please?

This question would be more at home on the Xalan list, since it's highly 
Xalan specific. I'd suggest we take it there if you want to pursue it 

Xalan's "document manager" layer may (or may not; this is 
implementation-dependent behavior) retain documents for the lifetime of an 
transformation and/or for the lifetime of an XPath Context. The intent is 
to improve performance when several calls to the XPath API are made 
against the same set of documents, and/or when a stylesheet uses 
document() several times to access the same URI.

The simple Xalan XPathAPI class _doesn't_ retain the cache past the end of 
the XPath's execution, but there's a separate CachedXPathAPI class which 
does so. Documents will be retained until the CachedXPathAPI object is 

The normal Xalan Transformer behavior is that documents are retained until 
the transformation ends. There is a hook -- OK, a kluge -- which can be 
used in some kinds of stylesheets to manually force a document out of the 
cache, which has some potentially ugly side effects but which can be used 
for cases where you are importing huge documents (or huge numbers of 
documents) briefly and are sure they can be discarded. This is strictly a 
short-term solution; the Xalan list has discussed some of our ideas on how 
we might improve both the model and the cache in the long run for better 
memory management.

Joe Kesselman  / IBM Research

 XSL-List info and archive:

Current Thread