p:xquery 006 (AB)

Tests p:xquery

Test ab-xquery-006.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:xquery>
      <p:with-input port="source">
         <p:inline document-properties="map{'base-uri' : 'http://xproc-test/primary'}">
            <document>
               <title>Some Title</title>
               <para>Some paragraph.</para>
            </document>
         </p:inline>
         <p:inline document-properties="map{'base-uri' : 'http://xproc-test/secondary'}">
            <document>
               <title>Some Other Title</title>
               <para>Some other paragraph.</para>
            </document>
         </p:inline>
      </p:with-input>
      <p:with-input port="query">
         <c:query xmlns:c="http://www.w3.org/ns/xproc-step">
                  &lt;result&gt;{{collection()}}&lt;/result&gt;
               </c:query>
      </p:with-input>
   </p:xquery>
</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/document)=2">Root element does not have 2 children 'document'.</s:assert>
      </s:rule>
      <s:rule context="document[1]">
         <s:assert test="title/text()='Some Title'">Title of document[1] is not 'Some Title'.</s:assert>
         <s:assert test="para/text()='Some paragraph.'">Para of document[1] is not 'Some paragraph.'</s:assert>
      </s:rule>
      <s:rule context="document[2]">
         <s:assert test="title/text()='Some Other Title'">Title of document[2] is not 'Some Other Title'.</s:assert>
         <s:assert test="para/text()='Some other paragraph.'">Para of document[2] is not 'Some other paragraph.'</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

01 Jul 2022, Achim Berndzen

Added base-uri to source documents to make sure every doc in default collection has a different one.

10 Jun 2021, Achim Berndzen

Added attribute 'queryBinding' to schematron's schema.

13 Sep 2019, Achim Berndzen

Tests for p:xquery (Partly ported from 1.0)