[xsl] External XML Document Caching

Subject: [xsl] External XML Document Caching
From: raulvk <raulvk.soa@xxxxxxxxx>
Date: Fri, 21 Nov 2008 18:25:24 +0000
Hi everyone,

We are using XSL to carry out XML-to-XML tranformation and one of the
main functionalities we are using it for is to map specific values of
the source message to predetermined values in the result message by
using a lookup table implemented in XML. (Please check out
http://www.stylusstudio.com/xsllist/200811/post40460.html for a more
detailed explanation).

In this case, the lookup table is implemented in an external XML file
(not inside the stylesheet, as is in the referenced post).

Since the external XML file is going to be accessed VERY frequently,
and it will be accessed from multiple stylesheets (it is reusable), I
really don't want the XML file being loaded from disk into memory and
being parsed every single time it is accessed, since this can cause
serious performance problems.

The external file is accessed via the document('...') function.

My question number 1: Do XSLT processors cache external referenced XML files?

Question number 2: Do you recommend any strategies to optimise the
query to the external XML file? I have considered the following, but I
am unsure as how each of them can improve performance:
   - Using the xsl:key + key function on the external document('...') file.
   - Implement the lookup table in a XSL file, specifying the mappings
outside the <xsl:templates> so that they are not rendered. The XSL
file would offer a named template to recover the desired mapping. The
stylesheets that want to obtain a mapping would <xsl:import> the
appropriate mapping stylesheet and invoke the template at the point
where the value should be inserted.

Any clues?

Many thanks in advance!


Current Thread