p:compare 002 (NW)

Check if p:compare fails when the documents are different.

Test nw-compare-002.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="second"/>
            <element/>
         </doc>
      </p:with-input>
   </p:identity>
   <p:compare name="compare">
      <p:with-input port="source" pipe="@doc-a"/>
      <p:with-input port="alternate" pipe="@doc-b"/>
   </p:compare>
</p:declare-step>
MorganaXProc 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)='false'">Result is not ‘false’.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

26 Mar 2024, Norm Tovey-Walsh

Created test for p:compare.