Test nested
p:viewport
and correct
propagation of p:iteration-size and p:iteration-position.
Test ab-viewport-011.xml is expected to pass.
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
<p:input port="source"/>
<p:output port="result"/>
<p:viewport match="sub">
<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:viewport match="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:viewport>
</p:group>
</p:viewport>
</p:declare-step>
<doc>
<sub>
<para/>
<para/>
<para/>
</sub>
<sub>
<para/>
<para/>
<para/>
<para/>
</sub>
</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="doc">The document root is not 'doc'.</s:assert>
<s:assert test="doc/sub[1]/item[1]/@pos='1,2-1,2-1,3'">sub[1]/item[1]/@pos is not '1,2-1,2-1,3'.</s:assert>
<s:assert test="doc/sub[1]/item[2]/@pos='1,2-1,2-2,3'">sub[1]/item[2]/@pos is not '1,2-1,2-2,3'.</s:assert>
<s:assert test="doc/sub[1]/item[3]/@pos='1,2-1,2-3,3'">sub[1]/item[3]/@pos is not '1,2-1,2-3,3'.</s:assert>
<s:assert test="doc/sub[2]/item[1]/@pos='2,2-2,2-1,4'">sub[2]/item[1]/@pos is not '2,2-2,2-1,4'.</s:assert>
<s:assert test="doc/sub[2]/item[2]/@pos='2,2-2,2-2,4'">sub[2]/item[2]/@pos is not '2,2-2,2-2,4'.</s:assert>
<s:assert test="doc/sub[2]/item[3]/@pos='2,2-2,2-3,4'">sub[2]/item[3]/@pos is not '2,2-2,2-3,4'.</s:assert>
<s:assert test="doc/sub[2]/item[4]/@pos='2,2-2,2-4,4'">sub[2]/item[4]/@pos is not '2,2-2,2-4,4'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Added attribute 'queryBinding' to schematron's schema.
Additional tests for p:viewport (partly ported from 1.0)