Test nested
p:for-each
and correct
propagation of p:iteration-size and p:iteration-position.(ported from 1.0-testsuite/for-each-011)
Test ab-for-each-011.xml is expected to pass.
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
<p:input port="source" sequence="true"/>
<p:output port="result"/>
<p:for-each>
<p:variable name="p1" select="p:iteration-position()"/>
<p:variable name="s1" select="p:iteration-size()"/>
<!-- a p:group wrapper to tests that p:iteration-position
and p:iteration-size are not affected -->
<p:group>
<p:variable name="p2" select="p:iteration-position()"/>
<p:variable name="s2" select="p:iteration-size()"/>
<p:for-each>
<p:with-input select="/doc/para"/>
<p:variable name="p3" select="p:iteration-position()"/>
<p:variable name="s3" select="p:iteration-size()"/>
<p:add-attribute match="item" attribute-name="pos">
<p:with-input port="source">
<p:inline>
<item/>
</p:inline>
</p:with-input>
<p:with-option name="attribute-value" select="concat($p1, ',', $s1, '-', $p2, ',', $s2, '-', $p3, ',', $s3)"/>
</p:add-attribute>
</p:for-each>
</p:group>
</p:for-each>
<p:wrap-sequence wrapper="result"/>
</p:declare-step>
<doc>
<para/>
<para/>
<para/>
</doc>
<doc>
<para/>
<para/>
<para/>
<para/>
</doc>
<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="result">The pipeline root is not result.</s:assert>
<s:assert test="count(result/item)=7">Root element does not have exactly 7 children named 'item'.</s:assert>
<s:assert test="result/item[1]/@pos='1,2-1,2-1,3'">Attribute pos of item[1] is not '1,2-1,2-1,3'.</s:assert>
<s:assert test="result/item[2]/@pos='1,2-1,2-2,3'">Attribute pos of item[2] is not '1,2-1,2-2,3'.</s:assert>
<s:assert test="result/item[3]/@pos='1,2-1,2-3,3'">Attribute pos of item[3] is not '1,2-1,2-3,3'.</s:assert>
<s:assert test="result/item[4]/@pos='2,2-2,2-1,4'">Attribute pos of item[4] is not '2,2-2,2-1,4'.</s:assert>
<s:assert test="result/item[5]/@pos='2,2-2,2-2,4'">Attribute pos of item[5] is not '2,2-2,2-2,4'.</s:assert>
<s:assert test="result/item[6]/@pos='2,2-2,2-3,4'">Attribute pos of item[6] is not '2,2-2,2-3,4'.</s:assert>
<s:assert test="result/item[7]/@pos='2,2-2,2-4,4'">Attribute pos of item[7] is not '2,2-2,2-4,4'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Added attribute 'queryBinding' to schematron's schema.
Initial test