pack 007 (AB)

Testing correct handling of non element nodes by p:pack.

Test ab-pack-007.xml is expected to pass.

The pipeline


<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
   <p:output port="result"/>
   <p:pack wrapper="wrap">
      <p:with-input port="source">
         <p:inline>
                  <!-- comment1 -->
            <doc1/>
            <?pi1 target?>
         </p:inline>
      </p:with-input>
      <p:with-input port="alternate">
         <p:inline>
                  <?pi2?>
            <doc2/>
            <!-- comment2 -->
         </p:inline>
      </p:with-input>
   </p:pack>
   <p:wrap-sequence wrapper="doc"/>
</p:declare-step>
MorganaXProc passing XML Calabash passing

Schematron validation


<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
   <s:pattern>
      <s:rule context="/">
         <s:assert test="doc">The document root is not doc.</s:assert>
         <s:assert test="doc/wrap/child::node()[1] instance of text()">First child of wrap should be a text.</s:assert>
         <s:assert test="doc/wrap/child::node()[2] instance of comment()">Second child of wrap should be a comment.</s:assert>
         <s:assert test="doc/wrap/child::node()[3] instance of text()">Third child of wrap should be a text.</s:assert>
         <s:assert test="doc/wrap/child::node()[4] instance of element()">Forth child of wrap should be an element.</s:assert>
         <s:assert test="doc/wrap/child::node()[5] instance of text()">Fifth child of wrap should be a text.</s:assert>
         <s:assert test="doc/wrap/child::node()[6] instance of processing-instruction()">Sixth child of wrap should be a pi.</s:assert>
         <s:assert test="doc/wrap/child::node()[7] instance of text()">Seventh child of wrap should be a text.</s:assert>
         <s:assert test="doc/wrap/child::node()[8] instance of processing-instruction()">Eighth child of wrap should be an pi.</s:assert>
         <s:assert test="doc/wrap/child::node()[9] instance of text()">Ninth child of wrap should be a text.</s:assert>
         <s:assert test="doc/wrap/child::node()[10] instance of element()">Tenth child of wrap should be an element.</s:assert>
         <s:assert test="doc/wrap/child::node()[11] instance of text()">Eleventh child of wrap should be an element.</s:assert>
         <s:assert test="doc/wrap/child::node()[12] instance of comment()">Twelfth child of wrap should be a comment.</s:assert>
         <s:assert test="doc/wrap/child::node()[13] instance of text()">Thirteenths child of wrap should be a text.</s:assert>
         <s:assert test="count(doc/wrap/child::node())=13">Element 'wrap' should have 10 children.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2021, Achim Berndzen

Added attribute 'queryBinding' to schematron's schema.

25 Jul 2019, Achim Berndzen

Fixed test: Preceding/trailing whitespace is removed.

30 Jun 2019, Achim Berndzen

Fixed test to cover whitespace correctly.

06 May 2019, Achim Berndzen

Additional test for p:pack.