<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="/ab-insert-009.xml"
        name="ab-insert-009.xml"
        expected="pass">
   <t:info>
      <t:title>Test for p:insert 009 (AB)</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2021-06-10</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Added attribute 'queryBinding' to schematron's schema.</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2019-06-30</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Fixed schematron to cover trailing whitespace node.</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2019-03-22</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Ported tests from 1.0 test suite</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml">
      <p>Tests p:insert multiple documents after a specific PI</p>
   </t:description>
   <t:pipeline>
      <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
         <p:output port="result"/>
         <p:insert match="processing-instruction('that')" position="after">
            <p:with-input>
               <p:inline>
                  <root><?that is a pi?></root>
               </p:inline>
            </p:with-input>
            <p:with-input port="insertion">
               <p:inline>
                  <root1/>
               </p:inline>
               <p:inline>
                  <root2/>
               </p:inline>
            </p:with-input>
         </p:insert>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <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="root">The root element is not 'root'.</s:assert>
               <s:assert test="root/child::node()[1] instance of text()">First child is not text().</s:assert>
               <s:assert test="root/child::node()[2] instance of processing-instruction('that')">Second child is not PI.</s:assert>
               <s:assert test="root/*[1]/name()='root1'">Name of the first element of root is not 'root1'.</s:assert>
               <s:assert test="root/*[2]/name()='root2'">Name of the second element of root is not 'root2'.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="ab-insert-009.xml">
      <root><?that is a pi?>
         <root1/>
         <root2/>
      </root>
   </t:result>
</t:test>
