Declare-step-011 (AB)

Tests a step is visible to itself for recursive call.

Test ab-declare-step-011.xml is expected to pass.

The pipeline


      <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
         <p:output port="result"/>
         
         <p:declare-step type="Q{http://dummy}step" name="step">
            <p:input port="source" sequence="true"/>
            <p:output port="result" sequence="true"/>
            <p:option name="counter" as="xs:integer" required="true"/>            
            <p:choose>
               <p:when test="$counter = 0">
                  <p:identity/>
               </p:when>
               <p:otherwise>
                  <x:step xmlns:x="http://dummy" counter="{$counter -1}" name="recursion">
                     <p:with-input xmlns:x="http://dummy">
                        <p:inline xmlns:x="http://dummy"><element xmlns:x="http://dummy" xmlns=""/></p:inline>
                        <p:pipe xmlns:x="http://dummy" step="step" port="source"/>
                     </p:with-input>
                  </x:step>
                  
               </p:otherwise>
            </p:choose>
         </p:declare-step>
         
         <x:step xmlns:x="http://dummy" counter="3">
            <p:with-input xmlns:x="http://dummy"><p:empty xmlns:x="http://dummy"/></p:with-input>
         </x:step>
         
         <p:wrap-sequence wrapper="result"/>
      </p:declare-step>
   
MorganaXProc passing

Schematron validation


      <s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron">
         <s:pattern>
            <s:rule context="/">
               <s:assert test="result">The document root is not 'result'.</s:assert>
               <s:assert test="count(result/*) = 3">Result does not have three children.</s:assert>
               <s:assert test="count(result/element)=3">Result does not have three 'element' children.</s:assert>
             </s:rule>
         </s:pattern>
      </s:schema>
   

Revision history

25 Feb 2019, Achim Berndzen

Added new tests for p:declare-step and p:import.