Collection 004

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

Test nw-collection-004.xml is expected to pass.

The pipeline


<p:declare-step xmlns:ex="http://example.com/ns" xmlns:p="http://www.w3.org/ns/xproc" 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>

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="size=2">The size is wrong</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

31 Dec 2025, Norm Tovey-Walsh

Initial commit.