<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="/ab-archive-manifest-016.xml"
        name="ab-archive-manifest-016.xml"
        expected="pass">
   <t:info>
      <t:title>p:archive-manifest 016 (AB)</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2021-10-19</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Additional test for p:archive-manifest</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml">
      <p>Tests path in @href is correctly resolved in p:archive-manifest</p>
   </t:description>
   <t:pipeline>
      <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="pipeline" version="3.0">
         <p:output port="result"/>
         <p:archive-manifest>
            <p:with-input href="../documents/archive.zip"/>
         </p:archive-manifest>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <s:schema xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://purl.oclc.org/dsdl/schematron"
                queryBinding="xslt2">
         <s:ns prefix="c" uri="http://www.w3.org/ns/xproc-step"/>
         <s:pattern>
            <s:rule context="/">
               <s:assert test="c:archive">Root element is not 'c:archive'.</s:assert>
               <s:assert test="ends-with(c:archive/c:entry[@name='doc.xml']/@href,'/documents/archive.zip/doc.xml')">c:entry/@href for 'doc.xml' is not correct.</s:assert>
               <s:assert test="ends-with(c:archive/c:entry[@name='folder/doc.xml']/@href,'/documents/archive.zip/folder/doc.xml')">c:entry/@href for 'folder/doc.xml' is not correct.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="ab-archive-manifest-016.xml">
      <c:archive xmlns:c="http://www.w3.org/ns/xproc-step" format="zip">
         <c:entry xmlns:cx="http://xmlcalabash.com/ns/extensions"
                  name="doc.xml"
                  content-type="application/xml"
                  cx:size="47"
                  cx:mode="33188"
                  cx:mode-string="rw-r--r--"
                  cx:last-modified="2019-08-23T17:19:02Z"
                  cx:external-attributes="2175008768"
                  method="deflated"
                  href="file:///woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/documents/archive.zip/doc.xml"/>
         <c:entry xmlns:cx="http://xmlcalabash.com/ns/extensions"
                  name="text.txt"
                  content-type="text/plain"
                  cx:size="20"
                  cx:mode="33188"
                  cx:mode-string="rw-r--r--"
                  cx:last-modified="2019-08-23T17:46:36Z"
                  cx:external-attributes="2175008768"
                  method="deflated"
                  href="file:///woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/documents/archive.zip/text.txt"/>
         <c:entry xmlns:cx="http://xmlcalabash.com/ns/extensions"
                  name="folder/doc.xml"
                  content-type="application/xml"
                  cx:size="47"
                  cx:mode="33188"
                  cx:mode-string="rw-r--r--"
                  cx:last-modified="2019-08-23T17:19:02Z"
                  cx:external-attributes="2175008768"
                  method="deflated"
                  href="file:///woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/documents/archive.zip/folder/doc.xml"/>
         <c:entry xmlns:cx="http://xmlcalabash.com/ns/extensions"
                  name="folder/text.txt"
                  content-type="text/plain"
                  cx:size="20"
                  cx:mode="33188"
                  cx:mode-string="rw-r--r--"
                  cx:last-modified="2019-08-23T17:46:36Z"
                  cx:external-attributes="2175008768"
                  method="deflated"
                  href="file:///woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/documents/archive.zip/folder/text.txt"/>
         <c:entry xmlns:cx="http://xmlcalabash.com/ns/extensions"
                  name="fish.jpg"
                  content-type="image/jpeg"
                  cx:size="93971"
                  cx:mode="33188"
                  cx:mode-string="rw-r--r--"
                  cx:last-modified="2019-08-23T17:42:08Z"
                  cx:external-attributes="2175008768"
                  method="deflated"
                  href="file:///woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/documents/archive.zip/fish.jpg"/>
         <c:entry xmlns:cx="http://xmlcalabash.com/ns/extensions"
                  name="folder/fish.jpg"
                  content-type="image/jpeg"
                  cx:size="93971"
                  cx:mode="33188"
                  cx:mode-string="rw-r--r--"
                  cx:last-modified="2019-08-23T17:42:08Z"
                  cx:external-attributes="2175008768"
                  method="deflated"
                  href="file:///woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/documents/archive.zip/folder/fish.jpg"/>
         <c:entry xmlns:cx="http://xmlcalabash.com/ns/extensions"
                  name="folder/json.json"
                  content-type="application/json"
                  cx:size="19"
                  cx:mode="33188"
                  cx:mode-string="rw-r--r--"
                  cx:last-modified="2019-08-23T17:48:38Z"
                  cx:external-attributes="2175008768"
                  method="deflated"
                  href="file:///woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/documents/archive.zip/folder/json.json"/>
         <c:entry xmlns:cx="http://xmlcalabash.com/ns/extensions"
                  name="json.json"
                  content-type="application/json"
                  cx:size="19"
                  cx:mode="33188"
                  cx:mode-string="rw-r--r--"
                  cx:last-modified="2019-08-23T17:48:38Z"
                  cx:external-attributes="2175008768"
                  method="deflated"
                  href="file:///woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/documents/archive.zip/json.json"/>
         <c:entry xmlns:cx="http://xmlcalabash.com/ns/extensions"
                  name="html.html"
                  content-type="text/html"
                  cx:size="178"
                  cx:mode="33188"
                  cx:mode-string="rw-r--r--"
                  cx:last-modified="2019-08-23T18:02:10Z"
                  cx:external-attributes="2175008768"
                  method="deflated"
                  href="file:///woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/documents/archive.zip/html.html"/>
         <c:entry xmlns:cx="http://xmlcalabash.com/ns/extensions"
                  name="folder/html.html"
                  content-type="text/html"
                  cx:size="178"
                  cx:mode="33188"
                  cx:mode-string="rw-r--r--"
                  cx:last-modified="2019-08-23T18:02:10Z"
                  cx:external-attributes="2175008768"
                  method="deflated"
                  href="file:///woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/documents/archive.zip/folder/html.html"/>
      </c:archive>
   </t:result>
</t:test>
