xmlunit-003

Tests that documents can be similar.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
                xmlns:cxerr="http://xmlcalabash.com/ns/error" xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0" name="main" version="3.0">
   <p:import href="https://xmlcalabash.com/ext/library/xmlunit.xpl"/>
   <p:output port="result" sequence="true"/>
   <cx:xmlunit check-for="similarity"
               element-selector="by-name-and-text">
      <p:with-input port="source">
         <flowers>
            <flower>Daisy</flower>
            <flower>Roses</flower>
            <flower>Crocus</flower>
         </flowers>
      </p:with-input>
      <p:with-input port="alternate">
         <flowers>
            <flower>Roses</flower>
            <flower>Daisy</flower>
            <flower>Crocus</flower>
         </flowers>
      </p:with-input>
   </cx:xmlunit>
</p:declare-step>

Result

<flowers xmlns:cx="http://xmlcalabash.com/ns/extensions"
         xmlns:cxerr="http://xmlcalabash.com/ns/error" xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <flower>Daisy</flower>
   <flower>Roses</flower>
   <flower>Crocus</flower>
</flowers>

Schematron checks

<s:schema xmlns:cxerr="http://xmlcalabash.com/ns/error"
          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="flowers">The output is wrong.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

21 Feb 2025, Norm Tovey-Walsh
Created test.