cache-004

Tests that document replacement can raise an error.

Test is expected to fail with error code cxerr:XI0037.

The pipeline

<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
                xmlns:cxerr="http://xmlcalabash.com/ns/error"
                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"
                 p:depends="cache-pre-add" fail-if-in-cache="true"
                 href="https://xmlcalabash.com/does/not/exist.xml">
      <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>

Revision history

29 Nov 2024, Norm Tovey-Walsh
Created test.