Test for p:insert 026 (AB)

Tests p:insert with default position 'after'

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:insert match="child::div/p[3]">
      <p:with-input port="source">
         <div>
            <p>First paragraph.</p>
            <p>Middle paragraph.</p>
            <p>Last paragraph.</p>
         </div>
      </p:with-input>
      <p:with-input port="insertion">
         <p:inline>
            <p>New after paragraph.</p>
         </p:inline>
      </p:with-input>
   </p:insert>
</p:declare-step>

Result

<div xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <p>First paragraph.</p>
   <p>Middle paragraph.</p>
   <p>Last paragraph.</p>
   <p>New after paragraph.</p>
</div>

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="div">The document root is not 'div'.</s:assert>
         <s:assert test="child::div/p[1]/text()='First paragraph.'">The text of the first p is not 'First paragraph'.</s:assert>
         <s:assert test="child::div/p[2]/text()='Middle paragraph.'">The text of the second p is not 'Middle paragraph'.</s:assert>
         <s:assert test="child::div/p[3]/text()='Last paragraph.'">The text of the third p is not 'Last paragraph'.</s:assert>
         <s:assert test="child::div/p[4]/text()='New after paragraph.'">The text of the last p is not 'New after paragraph'.</s:assert>
         <s:assert test="count(/div/p)=4">Root element does not have exactly four p-children.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2021, Achim Berndzen
Added attribute 'queryBinding' to schematron's schema.
13 Jun 2019, Achim Berndzen
New test for p:insert