p:split-sequence-009 (AB)

Tests p:split-sequence

Test ab-split-sequence-009.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 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" initial-only="true">
      <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>
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="count(result/matched/*)=2">Element 'matched' does not have two children.</s:assert>
         <s:assert test="count(result/matched/one)=2">All children of element 'matched' should be 'one'.</s:assert>
         <s:assert test="count(result/not-matched/*)=3">Element 'not-matched' does not have three children.</s:assert>
         <s:assert test="count(result/not-matched/two)=2">Two children of element 'not-matched' should be 'two'.</s:assert>
         <s:assert test="count(result/not-matched/one)=1">One child of element 'not-matched' should be 'one'.</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