Collection 004

Tests that a p:with-option can be passed a collection.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:ex="http://example.com/ns"
                xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0" exclude-inline-prefixes="ex"
                version="3.1">
   <p:output port="result"/>
   <p:declare-step type="ex:option-size">
      <p:output port="result"/>
      <p:option name="documents"/>
      <p:identity>
         <p:with-input>
            <p:inline>
               <size>{count($documents)}</size>
            </p:inline>
         </p:with-input>
      </p:identity>
   </p:declare-step>
   <ex:option-size>
      <p:with-option name="documents" collection="true"
                     select="collection()">
         <p:inline>
            <doc1/>
         </p:inline>
         <p:inline>
            <doc2/>
         </p:inline>
      </p:with-option>
   </ex:option-size>
</p:declare-step>

Result

<size xmlns:t="http://xproc.org/ns/testsuite/3.0">2</size>

Schematron checks

<s:schema xmlns="http://www.w3.org/1999/xhtml"
          xmlns:s="http://purl.oclc.org/dsdl/schematron" xmlns:t="http://xproc.org/ns/testsuite/3.0"
          queryBinding="xslt2">
   <s:pattern>
      <s:rule context="/">
         <s:assert test="size=2">The size is wrong</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

31 Dec 2025, Norm Tovey-Walsh
Initial commit.