<?xml-stylesheet type="text/xsl" href="/style/testcase.xsl"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite"
        xmlns:p="http://www.w3.org/ns/xproc"
        xmlns:c="http://www.w3.org/ns/xproc-step"
        xmlns:err="http://www.w3.org/ns/xproc-error">
  <t:title>Test for-each #008</t:title>
  
  <t:description xmlns="http://www.w3.org/1999/xhtml">
    <p>Test <code>p:for-each</code> with nested <code>p:output</code></p>
  </t:description>

  <t:pipeline>
    <p:declare-step version='1.0'>
      <p:output port="result" sequence="true"/>
      
      <p:for-each name="loop">
        <p:iteration-source>
          <p:inline><doc/></p:inline>
        </p:iteration-source>
        <p:output port="out" primary="true"/>
        <p:output port="out2" sequence="true" primary="false"/>
        <p:identity/>
      </p:for-each>

      <p:sink/>

      <p:count>
        <p:input port="source">
          <p:pipe step="loop" port="out2"/>
        </p:input>
      </p:count>
  
    </p:declare-step>
  </t:pipeline>

  <t:output port="result">
    <c:result>0</c:result>
  </t:output>
</t:test>
