p:xquery 005 (AB)

Tests p:xquery

Test ab-xquery-005.xml is expected to pass.

The pipeline


<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
   <p:input port="source"/>
   <p:output port="result"/>
   <p:xquery xmlns:test="http://www.test.com" parameters="map{'str' : 'Will', 'test:str' : 'Chris'}">
      <p:with-input port="query">
         <c:query xmlns:c="http://www.w3.org/ns/xproc-step">
                  declare namespace test = "http://www.test.com";
                  declare variable $str external;
                  declare variable $test:str external;
                  
                  for $author in //author[contains(firstname, $str) or contains(firstname, $test:str)]
                  order by $author/firstname
                  return $author
               </c:query>
      </p:with-input>
   </p:xquery>
   <p:wrap-sequence wrapper="wrapper"/>
</p:declare-step>
MorganaXProc passing XML Calabash passing

Inputs

port = source


<authors>
   <author>
      <firstname>William</firstname>
      <lastname>Shakespeare</lastname>
   </author>
   <author>
      <firstname>Christopher</firstname>
      <lastname>Marlowe</lastname>
   </author>
   <author>
      <firstname>Ben</firstname>
      <lastname>Johnson</lastname>
   </author>
</authors>

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="wrapper">Root element is not 'wrapper'.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

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)