seq-of-items-002

Test that type checking works for a sequence of nodes.

Test seq-of-items-002.xml is expected to pass.

The pipeline

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:xs="http://www.w3.org/2001/XMLSchema" name="main" version="3.0">
   <p:output port="result" primary="true" sequence="false"/>
   <p:input port="source" primary="true" sequence="true" content-types="application/xml">
      <p:inline>
         <doc/>
      </p:inline>
      <p:inline>
         <doc/>
      </p:inline>
   </p:input>
   <p:variable name="v" as="node()*" collection="true" select="collection()"/>
   <p:identity>
      <p:with-input select="count($v)">
         <p:inline>
            <doc/>
         </p:inline>
      </p:with-input>
   </p:identity>
   <p:cast-content-type content-type="application/xml"/>
</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:ns prefix="fn" uri="http://www.w3.org/2005/xpath-functions"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="fn:number = 2">The result is incorrect.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

03 Aug 2026, Norm Tovey-Walsh

Added test.