assertions-003

Tests a Schematron assertion.

Test is expected to pass.

Input: source

<doc xmlns:t="http://xproc.org/ns/testsuite/3.0"/>

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" version="3.0">
   <p:import href="https://xmlcalabash.com/ext/library/pipeline-messages.xpl"/>
   <p:input port="source"
            cx:assertions="'input-correct'"/>
   <p:output port="result"
             cx:assertions="'output-correct'"/>
   <p:identity name="identity"/>
   <cx:pipeline-messages p:depends="identity"
                         level="info" clear="true"/>
   <p:pipeinfo>
      <s:schema queryBinding="xslt2"
                xml:id="input-correct">
         <s:pattern>
            <s:rule context="/">
               <s:report test="doc">The source document is a doc</s:report>
               <s:assert test="doc">The source document is not a doc</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
      <s:schema queryBinding="xslt2"
                xml:id="output-correct">
         <s:pattern>
            <s:rule context="/">
               <s:report test="doc">The result document is a doc</s:report>
               <s:assert test="doc">The result document is not a doc</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </p:pipeinfo>
</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-06-19T18:02:11X" level="INFO"
               message="Report on p:declare-step/source: The source document is a doc"/>
</cx:messages>

Revision history

27 Dec 2024, Norm Tovey-Walsh
Created test.