cache-003
Tests that the document can be replaced in the cache.
Test is expected to pass.
The pipeline
<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
xmlns:err="http://www.w3.org/ns/xproc-error" xmlns:p="http://www.w3.org/ns/xproc"
xmlns:t="http://xproc.org/ns/testsuite/3.0" version="3.0">
<p:import href="https://xmlcalabash.com/ext/library/cache.xpl"/>
<p:output port="result"/>
<cx:cache-add name="cache-pre-add"
href="https://xmlcalabash.com/does/not/exist.xml">
<p:with-input>
<this-is-replaced/>
</p:with-input>
</cx:cache-add>
<cx:cache-add name="cache-add"
href="https://xmlcalabash.com/does/not/exist.xml" p:depends="cache-pre-add">
<p:with-input>
<does-so/>
</p:with-input>
</cx:cache-add>
<p:try>
<p:xinclude depends="cache-add">
<p:with-input>
<doc xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="https://xmlcalabash.com/does/not/exist.xml"/>
</doc>
</p:with-input>
</p:xinclude>
<p:catch code="err:XC0029">
<p:identity>
<p:with-input>
<fail/>
</p:with-input>
</p:identity>
</p:catch>
</p:try>
</p:declare-step>
Result
<doc xmlns:cx="http://xmlcalabash.com/ns/extensions"
xmlns:err="http://www.w3.org/ns/xproc-error" xmlns:t="http://xproc.org/ns/testsuite/3.0"
xmlns:xi="http://www.w3.org/2001/XInclude">
<does-so/>
</doc>
Schematron checks
<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron"
xmlns:t="http://xproc.org/ns/testsuite/3.0" queryBinding="xslt2">
<s:pattern>
<s:rule context="/">
<s:assert test="doc">The document root is not doc.</s:assert>
<s:assert test="doc/does-so">The document doesn’t contain does-so.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 29 Nov 2024, Norm Tovey-Walsh
- Created test.