<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass" features="http-collector p:directory-list"
        xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <t:info>
      <t:title>http-directory-list-001</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2026-10-12</t:date>
            <t:author>
               <t:name>Norm Tovey-Walsh</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Initial commit.</p>
            </t:description>
         </t:revision>       
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml">
      <p>Tests p:directory-list with an http URI</p>
   </t:description>
   
   <t:pipeline>
      <p:declare-step version="3.0"
                      xmlns:p="http://www.w3.org/ns/xproc"
                      xmlns:c="http://www.w3.org/ns/xproc-step">
         <p:output port="result"/>
         <p:option name="WHOST" select="'http://localhost:8246'" static="true"/>
         <p:directory-list path="{$WHOST}/docs/web/index.html" max-depth="unbounded"/>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <s:schema queryBinding="xslt2"
                xmlns:s="http://purl.oclc.org/dsdl/schematron"
                xmlns="http://www.w3.org/1999/xhtml">
         <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:rule>
         </s:pattern>
         <s:pattern>
           <s:rule context="/c:directory">
             <s:assert test="c:file/@xml:base='css/style.css'">style.css missing</s:assert>
             <s:assert test="c:file/@xml:base='js/script.js'">script.js missing</s:assert>
             <s:assert test="c:directory[not(@xml:base) and @name='web.html']">No web directory</s:assert>
             <s:assert test="c:directory[@name='web.html']//c:directory[@name='a.html']">No a.html</s:assert>
             <s:assert test="c:directory[@name='web.html']//c:directory[@name='b.html']">No b.html</s:assert>
             <s:assert test="c:directory[@name='web.html']//c:directory[@name='c.html']">No c.html</s:assert>
           </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
</t:test>
