p:split-sequence-008 (AB)

Tests p:split-sequence

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" name="pipeline" version="3.0">
   <p:output port="result"/>
   <p:identity name="one">
      <p:with-input port="source">
         <one/>
      </p:with-input>
   </p:identity>
   <p:identity name="two">
      <p:with-input>
         <two/>
      </p:with-input>
   </p:identity>
   <p:split-sequence name="splitter" test="/one">
      <p:with-input pipe="@one @one @two @two @one"/>
   </p:split-sequence>
   <p:wrap-sequence name="matched" wrapper="matched">
      <p:with-input pipe="matched"/>
   </p:wrap-sequence>
   <p:wrap-sequence name="not-matched"
                    wrapper="not-matched">
      <p:with-input pipe="not-matched@splitter"/>
   </p:wrap-sequence>
   <p:wrap-sequence wrapper="result">
      <p:with-input pipe="@matched @not-matched"/>
   </p:wrap-sequence>
</p:declare-step>

Result

<result xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <matched>
      <one/>
      <one/>
      <one/>
   </matched>
   <not-matched>
      <two/>
      <two/>
   </not-matched>
</result>

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="result">Root element is not 'result'.</s:assert>
         <s:assert test="count(result/matched/*)=3">Element 'matched' does not have three children.</s:assert>
         <s:assert test="count(result/matched/one)=3">All children of element 'matched' should be 'one'.</s:assert>
         <s:assert test="count(result/not-matched/*)=2">Element 'not-matched' does not have two children.</s:assert>
         <s:assert test="count(result/not-matched/two)=2">All children of element 'not-matched' should be 'two'.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2021, Achim Berndzen
Added attribute 'queryBinding' to schematron's schema.
22 May 2019, Achim Berndzen
Additional tests for p:split-sequence