nw-inline-unique-001

Tests that a p:inline that appears in a loop returns distinct documents on each iteration and not the same node multiple times.

Test nw-inline-unique-001.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"/>
   <p:option name="num" as="xs:integer" select="3"/>
   <p:for-each>
      <p:with-input select="1 to $num">
         <p:inline/>
      </p:with-input>
      <p:identity>
         <p:with-input>
            <output/>
         </p:with-input>
      </p:identity>
   </p:for-each>
   <p:variable name="elements" select="collection()/*" collection="true"/>
   <p:identity>
      <p:with-input>
         <count>{count($elements)}</count>
      </p:with-input>
   </p:identity>
</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="count">The root element is incorrect.</s:assert>
         <s:assert test="count = 3">The count is incorrect.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

21 Jul 2026, Norm Tovey-Walsh

Initial test