p:if-012 (AB)

Test p:if with a sequence as DRP.

Test ab-if-012.xml is expected to pass.

The pipeline


<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
   <p:output port="result"/>
   <p:identity>
      <p:with-input>
         <doc/>
         <doc/>
      </p:with-input>
   </p:identity>
   <p:if test="/true" name="if">
      <p:with-input>
         <true/>
      </p:with-input>
      <p:for-each>
         <p:add-attribute match="/doc" attribute-name="a" attribute-value="{p:iteration-position()}"/>
      </p:for-each>
   </p:if>
   <p:wrap-sequence wrapper="result"/>
</p:declare-step>
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:pattern>
      <s:rule context="/">
         <s:assert test="/result">Root element is not 'result'.</s:assert>
         <s:assert test="count(/result/*)=2">Root should only have one child.</s:assert>
         <s:assert test="/result/*[1]/name()='doc'">First child of 'result' is not 'doc'.</s:assert>
         <s:assert test="/result/*[2]/name()='doc'">Second child of 'result' is not 'doc'.</s:assert>
         <s:assert test="/result/doc[1]/@a='1'">On first child @a!=1.</s:assert>
         <s:assert test="/result/doc[2]/@a='2'">On second child @a!=2.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2021, Achim Berndzen

Added attribute 'queryBinding' to schematron's schema.

06 Apr 2019, Achim Berndzen

New tests