Choose 002

Test choose-002.xml is expected to pass.

The pipeline

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="main" version="3.0">
  <p:option name="match"/>
  <p:output port="result"/>

  <p:identity name="id">
    <p:with-input port="source">
      <p:inline document-properties="map { 'a': '1', 'b': '2' }">
        <doc/>
      </p:inline>
    </p:with-input>
  </p:identity>


  <p:choose name="choose">
    <p:when test="p:document-property(., 'a') = $match">
      <p:identity>
        <p:with-input port="source">
          <p:inline><doc>one</doc></p:inline>
        </p:with-input>
      </p:identity>
    </p:when>
    <p:when test="p:document-property(., 'b') = $match">
      <p:identity>
        <p:with-input port="source">
          <p:inline><doc>two</doc></p:inline>
        </p:with-input>
      </p:identity>
    </p:when>
    <p:otherwise>
      <p:identity>
        <p:with-input port="source">
          <p:inline><doc>none</doc></p:inline>
        </p:with-input>
      </p:identity>
    </p:otherwise>
  </p:choose>

</p:declare-step>
MorganaXProc passing XML Calabash failing

Options

$match

select = '2'

Schematron validation

<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron">
   <s:ns prefix="c" uri="http://www.w3.org/ns/xproc-step"/>

   <s:pattern>
     <s:rule context="/*">
       <s:assert test="self::doc">The pipeline root is not doc.</s:assert>
       <s:assert test=". = 'two'">The result isn't "two"</s:assert>
     </s:rule>
   </s:pattern>
</s:schema>

Revision history

24 Sep 2017 17:47, Norman Walsh

Port my test suite; add documentation and schemas