Test for p:insert 011 (AB)
Tests p:insert on multiple positions on different levels.
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="a" position="first-child">
<p:with-input>
<doc>
<a>
<a>
<a/>
</a>
</a>
</doc>
</p:with-input>
<p:with-input port="insertion">
<b/>
</p:with-input>
</p:insert>
</p:declare-step>
Result
<doc xmlns:t="http://xproc.org/ns/testsuite/3.0">
<a>
<b/>
<a>
<b/>
<a>
<b/>
</a>
</a>
</a>
</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/a">The root does not have a child 'a'.</s:assert>
<s:assert test="doc/a/*[1]/name()='b'">The first child of doc/a is not 'b'.</s:assert>
<s:assert test="doc/a/*[2]/name()='a'">The second child of doc/a is not 'a'.</s:assert>
<s:assert test="doc/a/a/*[1]/name()='b'">The first child of doc/a/a is not 'b'.</s:assert>
<s:assert test="doc/a/a/*[2]/name()='a'">The second child of doc/a/a is not 'a'.</s:assert>
<s:assert test="doc/a/a/a/b">Element doc/a/a/a does not have a child 'b'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 10 Jun 2021, Achim Berndzen
- Added attribute 'queryBinding' to schematron's schema.
- 23 Mar 2019, Achim Berndzen
- new tests.