p:compare 007 (NW)

Confirm that the result port on p:compare is primary.

Test 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:t="http://xproc.org/ns/testsuite/3.0" xmlns:test="http://test" version="3.0">
   <p:output port="result"/>
   <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">
      <p:with-input port="source" pipe="@doc-a"/>
      <p:with-input port="alternate" pipe="@doc-b"/>
   </p:compare>
</p:declare-step>

Result

<c:result xmlns:c="http://www.w3.org/ns/xproc-step"
          xmlns:t="http://xproc.org/ns/testsuite/3.0">true</c:result>

Schematron checks

<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" xmlns:t="http://xproc.org/ns/testsuite/3.0"
          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

04 Jun 2025, Norm Tovey-Walsh
Created test for p:compare.