find-006

Tests cx:find without any queries.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
                xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0" name="main" version="3.0"
                expand-text="false">
   <p:import href="https://xmlcalabash.com/ext/library/find.xpl"/>
   <p:output port="result"/>
   <cx:find path="../documents/find"
            jsonpath="$..book[?(@.isbn)]"/>
</p:declare-step>

Result

<c:directory xmlns:c="http://www.w3.org/ns/xproc-step"
             xmlns:t="http://xproc.org/ns/testsuite/3.0"
             xml:base="file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/extra-suite/test-suite/documents/find/" name="find">
   <c:file xml:base="bookstore.json"
           name="bookstore.json"/>
</c:directory>

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="c"
         uri="http://www.w3.org/ns/xproc-step"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="c:directory">The root isn’t a directory.</s:assert>
      </s:rule>
   </s:pattern>
   <s:pattern>
      <s:rule context="/c:directory">
         <s:assert test="ends-with(@xml:base, '/documents/find/')">Wrong path.</s:assert>
         <s:assert test="count(c:file) = 1">Wrong number of files in find/</s:assert>
         <s:assert test="count(c:directory) = 0">Wrong number of directories in find/</s:assert>
         <s:assert test="c:file[@name='bookstore.json']">No bookstore.json</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

11 May 2025, Norm Tovey-Walsh
Created test.