AB for-each 005

Test evaluation of variables in the context of a p:for-each (ported from 1.0-testsuite/for-each-005)

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

The pipeline

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="3.0">
   <p:output port="result"/>
   <p:input port="source">
            <para id="x1">Some paragraph.</para>
            <para id="x2">Some paragraph.</para>
            <para id="x3">Some paragraph.</para>
   <p:for-each name="loop">
      <p:with-input select="/doc/para"/>
      <p:variable name="q" select="/para/@id" as="xs:string">
         <p:pipe step="loop" port="current"/>
         <p:when test="$q = 'x2'">
               <p:with-input port="source">
   <p:wrap-sequence wrapper="newdoc"/>
MorganaXProc passing XML Calabash passing

Schematron validation

<s:schema xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
      <s:rule context="/">
         <s:assert test="newdoc">The document root is not 'newdoc'.</s:assert>
         <s:assert test="newdoc/para">The root element does not have a child 'para'</s:assert>
         <s:assert test="count(newdoc/para)=1">The root element does not have ONE child 'para'.</s:assert>
         <s:assert test="newdoc/para/@id='x2'">The para element with @id='x2' was not selected.</s:assert>
         <s:assert test="newdoc/para='Some paragraph.'">The content of para element is not 'Some pharagraph.'</s:assert>

Revision history

10 Jun 2021, Achim Berndzen

Added attribute 'queryBinding' to schematron's schema.

20 Jul 2019, Achim Berndzen

Fixed test by declaring xs-namespace.

09 Jan 2019, Achim Berndzen

Initial test