<?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-005</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2026-10-28</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 pointing to XML that’s really XHTML.</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" max-depth="unbounded"
                           exclude-filter="html/"/>
      </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="count(c:directory) = 1">Wrong number of directories</s:assert>
             <s:assert test="count(c:file) = 2">Wrong number of files</s:assert>
             <s:assert test="c:file[@name='style.css']">No style.css</s:assert>
             <s:assert test="c:file[@name='script.js']">No script.js</s:assert>
             <s:assert test="c:directory[@name='web.html']">No web.html</s:assert>
           </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
</t:test>
