p-message-004
Tests that p:message outputs a map.
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:message name="message" test="true">
<p:with-option name="select"
select="map{'christmas': xs:date('2025-12-25'), 'present-count': 4, 'presents': ['socks','mittens','model train','sleigh'], 'coal': false()}"/>
<p:with-input>
<doc/>
</p:with-input>
</p:message>
<cx:pipeline-messages p:depends="message"
level="info" message-attribute="false"/>
</p:declare-step>
Result
<cx:messages xmlns:cx="http://xmlcalabash.com/ns/extensions"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<cx:message date="2025-12-14T15:59:51+00:00"
level="INFO">{
"christmas": "2025-12-25",
"coal": false,
"presents": [ "socks", "mittens", "model train", "sleigh" ],
"present-count": 4
}</cx:message>
</cx:messages>
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="cx:messages">The document root is not correct.</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="/cx:messages">
<s:assert test='cx:message[@level='INFO' and contains(., '
') and contains(., '"christmas":')]'>No message output.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 06 Dec 2025, Norm Tovey-Walsh
- Created test.