Test for p:insert 007 (AB)
Tests p:insert document as last child.
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="div" position="last-child">
<p:with-input port="source">
<doc>
<div>
<p>First paragraph.</p>
<p>Middle paragraph.</p>
<p>Last paragraph.</p>
</div>
</doc>
</p:with-input>
<p:with-input port="insertion">
<p>New after paragraph.</p>
</p:with-input>
</p:insert>
</p:declare-step>
Result
<doc xmlns:t="http://xproc.org/ns/testsuite/3.0">
<div>
<p>First paragraph.</p>
<p>Middle paragraph.</p>
<p>Last paragraph.</p>
<p>New after paragraph.</p>
</div>
</doc>
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="doc">The root element is not 'doc'.</s:assert>
<s:assert test="doc/div">Root element does not have child element 'div'.</s:assert>
<s:assert test="doc/div/p[1]='First paragraph.'">p[1] is not 'First paragraph.'.</s:assert>
<s:assert test="doc/div/p[2]='Middle paragraph.'">p[2] is not 'Middle paragraph.'.</s:assert>
<s:assert test="doc/div/p[3]='Last paragraph.'">p[3] is not 'Last paragraph.'.</s:assert>
<s:assert test="doc/div/p[4]='New after paragraph.'">p[4] is not 'New after paragraph.'.</s:assert>
<s:assert test="count(doc/div/p)=4">Element 'div' does not have exactly 4 p children.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 10 Jun 2021, Achim Berndzen
- Added attribute 'queryBinding' to schematron's schema.
- 22 Mar 2019, Achim Berndzen
- Ported tests from 1.0 test suite