p:if-034 (AB)

Test p:if with a sequence as DRP and test="false()".

Test is expected to pass.

The pipeline

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0" version="3.0">
   <p:output port="result"/>
   <p:identity>
      <p:with-input>
         <doc/>
         <doc/>
      </p:with-input>
   </p:identity>
   <p:if test="false()" name="if">
      <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>

Result

<result xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <doc/>
   <doc/>
</result>

Schematron checks

<s:schema xmlns="http://www.w3.org/1999/xhtml"
          xmlns:s="http://purl.oclc.org/dsdl/schematron" xmlns:t="http://xproc.org/ns/testsuite/3.0"
          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:rule>
   </s:pattern>
</s:schema>

Revision history

10 Dec 2023, Achim Berndzen
New tests