basex-001

Tests that BaseX can be used as the default query processor.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:basex="https://basex.org/"
                xmlns:cx="http://xmlcalabash.com/ns/extensions" xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0" expand-text="false" name="main"
                version="3.0">
   <p:output port="result" sequence="true"/>
   <p:xquery cx:processor="https://basex.org/"
             parameters="map{'name': 'elem',                             'basex:host': 'basex',                             'basex:username': 'admin',                             'basex:password': 'admin'}">
      <p:with-input>
         <p:empty/>
      </p:with-input>
      <p:with-input port="query">
         <p:inline content-type="text/plain">
declare variable $name external;
element { $name } { 3 + 4 }
      </p:inline>
      </p:with-input>
   </p:xquery>
</p:declare-step>

Result

<elem xmlns:t="http://xproc.org/ns/testsuite/3.0">7</elem>

Schematron checks

<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron"
          xmlns:t="http://xproc.org/ns/testsuite/3.0" queryBinding="xslt2">
   <s:ns prefix="svg" uri="http://www.w3.org/2000/svg"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="elem">The root is wrong.</s:assert>
         <s:assert test="string(elem) = '7'">The doc is wrong.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

16 Aug 2025, Norm Tovey-Walsh
Created test.