AB for-each 011

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.

The pipeline


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

Inputs

port = source


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

Schematron validation


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

Revision history

09 Jan 2019, Achim Berndzen

Initial test