AB-recursion-001

Tests recursive call of XProc step.

Test ab-recursion-001.xml is expected to pass.

The pipeline


<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:test="http://test" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="3.0">
   <p:output port="result" serialization="map{'indent' : true()}"/>
   <p:declare-step type="test:recursive" name="recursive">
      <p:input port="source" sequence="true"/>
      <p:output port="result" sequence="true"/>
      <p:option name="count" as="xs:integer" required="true"/>
      <p:choose>
         <p:when test="$count=0">
            <p:identity/>
         </p:when>
         <p:otherwise>
            <p:identity>
               <p:with-input>
                  <p:pipe step="recursive" port="source"/>
                  <p:inline>
                     <entry/>
                  </p:inline>
               </p:with-input>
            </p:identity>
            <test:recursive count="{$count -1}"/>
         </p:otherwise>
      </p:choose>
   </p:declare-step>
   <test:recursive count="100">
      <p:with-input>
         <p:empty/>
      </p:with-input>
   </test:recursive>
   <p:wrap-sequence wrapper="result"/>
</p:declare-step>
MorganaXProc passing

Schematron validation


<s:schema xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
   <s:pattern>
      <s:rule context="/">
         <s:assert test="/result">The document root is not 'result'.</s:assert>
         <s:assert test="count(/result/entry)=100">Root element does not have 100 children named 'entry'.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2023, Achim Berndzen

Initial check in.