AB for-each 013

Tests connections to loop's parent scope.

Test ab-for-each-013.xml is expected to pass.

The pipeline


<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="pipeline" version="3.0">
   <p:input port="source"/>
   <p:output port="result" sequence="true"/>
   <p:variable name="var" select="42"/>
   <p:identity name="producer">
      <p:with-input>
         <doc/>
      </p:with-input>
   </p:identity>
   <p:for-each>
      <p:with-input select="/doc/para">
         <p:pipe step="pipeline" port="source"/>
      </p:with-input>
      <p:add-attribute attribute-name="att" attribute-value="{$var}">
         <p:with-input pipe="@producer"/>
      </p:add-attribute>
   </p:for-each>
   <p:wrap-sequence wrapper="wrapper"/>
</p:declare-step>
MorganaXProc passing XML Calabash failing

Inputs

port = source


<doc>
   <title>Some title</title>
   <para>Paragraph 1.</para>
   <para>Paragraph 2.</para>
   <para>Paragraph 3.</para>
</doc>

Schematron validation


<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="wrapper">The pipeline root is not wrapper.</s:assert>
         <s:assert test="count(wrapper/*)=3">Wrapper does not have three children.</s:assert>
         <s:assert test="count(wrapper/doc)=3">Wrapper does not have three children named 'doc'.</s:assert>
         <s:assert test="wrapper/doc[1]/@att='42'">Value of doc[1]/@att is not 42.</s:assert>
         <s:assert test="wrapper/doc[2]/@att='42'">Value of doc[2]/@att is not 42.</s:assert>
         <s:assert test="wrapper/doc[3]/@att='42'">Value of doc[3]/@att is not 42.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2021, Achim Berndzen

Added attribute 'queryBinding' to schematron's schema.

25 May 2019, Achim Berndzen

Initial test