p:compare 003 (NW)

Check if p:compare succeeds when the documents are identical if fail-if-not-equal is true.

Test nw-compare-003.xml is expected to pass.

The pipeline


<p:declare-step xmlns:err="http://www.w3.org/ns/xproc-error" xmlns:p="http://www.w3.org/ns/xproc" xmlns:test="http://test" version="3.0">
   <p:output port="result">
      <p:pipe step="compare" port="result"/>
   </p:output>
   <p:identity name="doc-a">
      <p:with-input>
         <doc>
            <element name="first"/>
            <element/>
         </doc>
      </p:with-input>
   </p:identity>
   <p:identity name="doc-b">
      <p:with-input>
         <doc>
            <element name="first"/>
            <element/>
         </doc>
      </p:with-input>
   </p:identity>
   <p:compare name="compare" fail-if-not-equal="true">
      <p:with-input port="source" pipe="@doc-a"/>
      <p:with-input port="alternate" pipe="@doc-b"/>
   </p:compare>
</p:declare-step>
MorganaXProc passing XML Calabash passing

Schematron validation


<s:schema xmlns="http://www.w3.org/1999/xhtml" xmlns:err="http://www.w3.org/ns/xproc-error" xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
   <s:ns prefix="c" uri="http://www.w3.org/ns/xproc-step"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="c:result">Root element is not 'c:result'.</s:assert>
         <s:assert test="string(c:result)='true'">Result is not ‘true’.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

26 Mar 2024, Norm Tovey-Walsh

Created test for p:compare.