SAXONICA |
An option is available in the Configuration
to indicate that calls to the doc()
or document()
functions with constant string arguments should be evaluated when a query or
stylesheet is compiled, rather than at run-time. This option is intended for use when a reference or lookup
document is used by all queries and transformations. Using this option has a number of effects:
The URI is resolved using the compile-time URIResolver rather than the run-time URIResolver
The document
is loaded into a document pool held by the Configuration
, whose memory is released only when
the Configuration
itself ceases to exist;
all queries and transformations using this document share the same copy;
any updates to the document that occur between compile-time and run-time have no effect.
The option is selected by using Configuration.setConfigurationProperty()
\
or TransformerFactory.setAttribute()
with the property name FeatureKeys.PRE_EVALUATE_DOC_FUNCTION
.
This option is not available from the command line because it has no useful effect with a single-shot
compile-and-run interface.
This option has no effect if the URI supplied to the doc()
or document()
function
includes a fragment identifier.
It is also possible to preload a specific document into the shared document pool from the Java application
by using the call
config.getDocumentPool().add(doc, uri)
. When the doc()
or document()
function is called, the shared document pool is first checked to see if the requested document is
already present. The DocumentPool
object also has a discard()
method which causes the document
to be released from the pool.