viewport-011 (AB)

Test nested p:viewport and correct propagation of p:iteration-size and p:iteration-position.

Test ab-viewport-011.xml is expected to pass.

The pipeline


      <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()"/>
            
            
            <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 xmlns=""/>
                        </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>
   
MorganaXProc passing XML Calabash failing

Inputs

port = source


      <doc>
         <sub>
            <para/>
            <para/>
            <para/>
         </sub>
         <sub>
            <para/>
            <para/>
            <para/>
            <para/>
         </sub>
      </doc>
   

Schematron validation


      <s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron">
         <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>
   

Revision history

18 Sep 2019, Achim Berndzen

Additional tests for p:viewport (partly ported from 1.0)