p:split-sequence-014 (AB)

Tests p:split-sequence accepts any document

Test ab-split-sequence-014.xml is expected to pass.

The pipeline


<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="pipeline" version="3.0">
   <p:output port="result"/>
   <p:identity>
      <p:with-input>
         <p:inline>
            <doc/>
         </p:inline>
         <p:inline content-type="text/html">
            <html xmlns="http://www.w3.org/1999/xhtml"/>
         </p:inline>
         <p:inline content-type="text/plain">This is a text.</p:inline>
         <p:inline content-type="application/json">{{"key" : "value"}}</p:inline>
         <p:inline content-type="application/octet-stream">0102030405</p:inline>
      </p:with-input>
   </p:identity>
   <p:split-sequence test="if (. instance of document-node()) then //* else false()" name="splitter"/>
   <p:for-each>
      <p:identity>
         <p:with-input>
            <content-type>{p:document-property(., 'content-type')}</content-type>
         </p:with-input>
      </p:identity>
   </p:for-each>
   <p:wrap-sequence wrapper="matched" name="matched-sequence"/>
   <p:for-each>
      <p:with-input pipe="not-matched@splitter"/>
      <p:identity>
         <p:with-input>
            <content-type>{p:document-property(., 'content-type')}</content-type>
         </p:with-input>
      </p:identity>
   </p:for-each>
   <p:wrap-sequence wrapper="not-matched" name="not-matched-sequence"/>
   <p:wrap-sequence wrapper="result">
      <p:with-input pipe="@matched-sequence @not-matched-sequence"/>
   </p:wrap-sequence>
</p:declare-step>
MorganaXProc passing XML Calabash passing

Schematron validation


<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="result">Root element is not 'result'.</s:assert>
         <s:assert test="result/matched/content-type[1]/text()='application/xml'">Content type is not 'application/xml'.</s:assert>
         <s:assert test="result/matched/content-type[2]/text()='text/html'">Content type is not 'text/html'.</s:assert>
         <s:assert test="result/not-matched/content-type[1]/text()='text/plain'">Content type is not 'text/plain'.</s:assert>
         <s:assert test="result/not-matched/content-type[2]/text()='application/json'">Content type is not 'application/json'.</s:assert>
         <s:assert test="result/not-matched/content-type[3]/text()='application/octet-stream'">Content type is not 'application/octet-stream'.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2021, Achim Berndzen

Added attribute 'queryBinding' to schematron's schema.

24 May 2020, Achim Berndzen

Additional tests for p:split-sequence