Name
cx:cache-add — Adds documents to the runtime cache.
Synopsis
Input port | Primary | Sequence | Content types |
---|---|---|---|
source | ✔ |
Output port | Primary | Sequence | Content types |
---|---|---|---|
result | ✔ |
Option name | Type | Default value |
---|---|---|
fail-if-in-cache | xs:boolean | false() |
href | xs:anyURI? | () |
Declaration
1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc">
| <p:option name="href" as="xs:anyURI?" select="()"/>
| <p:option name="fail-if-in-cache" as="xs:boolean" select="false()"/>
| <p:input port="source"/>
5 | <p:output port="result"/>
|</p:declare-step>
Description
XML Calabash maintains a cache of documents. If a step attempts to load a URI, and that URI is present in the cache, the cached value will always be returned. Some steps use the cache implicitly (for example, the validate steps update it to hold schema documents).
A pipeline can add a document to the cache explicitly with cx:cache-add
.
If the href
option is provided, it is used as the URI for
caching, otherwise the source document URI is used.
It is a
dynamic error (cxerr:XI0030
) if the source document does not have
a base URI and the href
option is not provided.
Irrespective of the cache URI, the step simply copies it’s source
document to the result port. (It does not change the document’s base URI,
even if an href
option is provided to the cx:cache-add
step.)
It is a dynamic error (cxerr:XI0037
) if the
fail-if-in-cache
option is true
and the
cache already contains a document with the URI being cached.
Options
There are two options.
href
The URI to cache. Defaults to the source document URI.
fail-if-in-cache
Determines whether the URI must not already exist in the cache.
Document properties
No properties are changed.