compile-cache-006
Tests that the cache is used for iXML grammars with NineML.
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:s="http://purl.oclc.org/dsdl/schematron"
xmlns:t="http://xproc.org/ns/testsuite/3.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="3.0">
<p:import href="https://xmlcalabash.com/ext/library/pipeline-messages.xpl"/>
<p:output port="result"/>
<p:option name="cache" static="true" select="'true'"/>
<p:invisible-xml cx:cache-grammar="{$cache}">
<p:with-input port="grammar"
href="../documents/grammar.ixml"/>
<p:with-input port="source">
<p:inline content-type="text/plain">123</p:inline>
</p:with-input>
</p:invisible-xml>
<p:invisible-xml name="cached"
cx:cache-grammar="{$cache}">
<p:with-input port="grammar"
href="../documents/grammar.ixml"/>
<p:with-input port="source" select="/S/text()"/>
</p:invisible-xml>
<cx:pipeline-messages name="messages"
p:depends="cached" level="debug"/>
<p:wrap-sequence wrapper="wrapper">
<p:with-input pipe="@cached @messages"/>
</p:wrap-sequence>
</p:declare-step>
Result
<wrapper xmlns:t="http://xproc.org/ns/testsuite/3.0">
<S>123</S>
<cx:messages xmlns:cx="http://xmlcalabash.com/ns/extensions">
<cx:message date="2026-03-08T19:35:03+00:00"
level="DEBUG"
message="Invisible XML implementation: nineml"/>
<cx:message date="2026-03-08T19:35:03+00:00"
level="DEBUG"
message="Using NineML for p:invisible-xml"/>
<cx:message date="2026-03-08T19:35:03+00:00"
level="DEBUG"
message="Caching compiled resource: !invisible-xml|file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/extra-suite/test-suite/documents/grammar.ixml"/>
<cx:message date="2026-03-08T19:35:03+00:00"
level="DEBUG"
message="Invisible XML implementation: nineml"/>
<cx:message date="2026-03-08T19:35:03+00:00"
level="DEBUG"
message="Using cached resource: !invisible-xml|file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/extra-suite/test-suite/documents/grammar.ixml"/>
</cx:messages>
</wrapper>
Schematron checks
<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron"
xmlns:t="http://xproc.org/ns/testsuite/3.0" queryBinding="xslt2">
<s:ns prefix="cx"
uri="http://xmlcalabash.com/ns/extensions"/>
<s:pattern>
<s:rule context="/">
<s:assert test="wrapper">The document root is not correct.</s:assert>
<s:assert test="wrapper/S">No para</s:assert>
<s:assert test="wrapper/cx:messages">No messages</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="wrapper/S">
<s:assert test=". = '123'">The result is wrong</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="/wrapper/cx:messages">
<s:assert test="cx:message[@level='DEBUG' and @message = 'Using NineML for p:invisible-xml']">
>No caching message.</s:assert>
<s:assert test="cx:message[@level='DEBUG' and matches(@message, 'Caching compiled.*documents/grammar\.ixml')]">No caching message.</s:assert>
<s:assert test="cx:message[@level='DEBUG' and matches(@message, 'Using cached.*documents/grammar\.ixml')]">No using cached message.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 21 Jan 2026, Norm Tovey-Walsh
- Created test.