Features: p:directory-lists3-collector,

p:directory-list (S3) 038 (AB)

Tests p:directory-list: Examples from spec

Test is expected to pass.

The pipeline

<p:declare-step xmlns:c="http://www.w3.org/ns/xproc-step"
                xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0" version="3.0">
   <p:output port="result"/>
   <p:directory-list path="s3://xmlcalabash-mock1/testfolder"
                     max-depth="unbounded"
                     include-filter="(\w+/){{2,3}}.+\.txt$"/>
</p:declare-step>

Result

<c:directory xmlns:c="http://www.w3.org/ns/xproc-step"
             xmlns:t="http://xproc.org/ns/testsuite/3.0" name="testfolder"
             xml:base="s3://xmlcalabash-mock1/testfolder/">
   <c:directory name="a" xml:base="a/">
      <c:directory name="a" xml:base="a/">
         <c:directory name="b" xml:base="b/">
            <c:file name="something.txt"
                    xml:base="something.txt"/>
         </c:directory>
      </c:directory>
   </c:directory>
</c:directory>

Filesystem environment

DirectoryPermFilenameLast-modifiedSizeEncodingContents (abbreviated)
  .rwxa/a/b/something.txt0
  .rwxa/a/file.xml0
  .rwxfile2.txt0
  .rwxfile3.txt0
folder2/folder3drwx
somethingdrwx

Schematron checks

<s:schema xmlns="http://www.w3.org/1999/xhtml"
          xmlns:s="http://purl.oclc.org/dsdl/schematron" xmlns:t="http://xproc.org/ns/testsuite/3.0"
          queryBinding="xslt2">
   <s:ns uri="http://www.w3.org/ns/xproc-step"
         prefix="c"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="c:directory">Root element is not c:directory.</s:assert>
         <s:assert test="c:directory/@name='testfolder'">Root does not have attribute 'name' with 'testfolder'.</s:assert>
         <s:assert test="count(c:directory//c:file)=1">Only one file element should be present.</s:assert>
         <s:assert test="c:directory//c:file/@name='something.txt'">The file element does not have @name with 'something.txt'.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

25 Oct 2026, Norm Tovey-Walsh
Transformed mechanically from ab-directory-list-038.xml