p:archive-manifest 010 (AB)

Tests p:archive-manifest: Relative-to creates absolute uris for href. Its resolve to base-uri of element.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:t="http://xproc.org/ns/testsuite/3.0"
                xmlns:xs="http://www.w3.org/2001/XMLSchema" name="pipeline" version="3.0">
   <p:output port="result"/>
   <p:archive-manifest>
      <p:with-option name="relative-to"
                     select="xs:anyURI('test/')"
                     xml:base="http://xproc.org/ns/testsuite/3.0/"/>
      <p:with-input href="../documents/archive.zip"/>
   </p:archive-manifest>
</p:declare-step>

Result

<c:archive xmlns:c="http://www.w3.org/ns/xproc-step"
           xmlns:t="http://xproc.org/ns/testsuite/3.0" 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="http://xproc.org/ns/testsuite/3.0/test/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="http://xproc.org/ns/testsuite/3.0/test/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="http://xproc.org/ns/testsuite/3.0/test/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="http://xproc.org/ns/testsuite/3.0/test/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="http://xproc.org/ns/testsuite/3.0/test/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="http://xproc.org/ns/testsuite/3.0/test/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="http://xproc.org/ns/testsuite/3.0/test/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="http://xproc.org/ns/testsuite/3.0/test/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="http://xproc.org/ns/testsuite/3.0/test/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="http://xproc.org/ns/testsuite/3.0/test/folder/html.html"/>
</c:archive>

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 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="count(c:archive/c:entry)=10">Element 'c:archive' does not have 10 children named 'c:entry'</s:assert>
         <s:assert test="c:archive/c:entry/@href='http://xproc.org/ns/testsuite/3.0/test/doc.xml'">Value 'href' for 'doc.xml' is wrong.</s:assert>
         <s:assert test="c:archive/c:entry/@href='http://xproc.org/ns/testsuite/3.0/test/fish.jpg'">Value 'href' for 'fish.jpg' is wrong.</s:assert>
         <s:assert test="c:archive/c:entry/@href='http://xproc.org/ns/testsuite/3.0/test/html.html'">Value 'href' for 'html.html' is wrong.</s:assert>
         <s:assert test="c:archive/c:entry/@href='http://xproc.org/ns/testsuite/3.0/test/json.json'">Value 'href' for 'json.json' is wrong.</s:assert>
         <s:assert test="c:archive/c:entry/@href='http://xproc.org/ns/testsuite/3.0/test/text.txt'">Value 'href' for 'text.txt' is wrong.</s:assert>
         <s:assert test="c:archive/c:entry/@href='http://xproc.org/ns/testsuite/3.0/test/folder/doc.xml'">Value 'href' for 'folder/doc.xml' is wrong.</s:assert>
         <s:assert test="c:archive/c:entry/@href='http://xproc.org/ns/testsuite/3.0/test/folder/fish.jpg'">Value 'href' for 'folder/fish.jpg' is wrong.</s:assert>
         <s:assert test="c:archive/c:entry/@href='http://xproc.org/ns/testsuite/3.0/test/folder/html.html'">Value 'href' for 'folder/html.html' is wrong.</s:assert>
         <s:assert test="c:archive/c:entry/@href='http://xproc.org/ns/testsuite/3.0/test/folder/json.json'">Value 'href' for 'folder/json.json' is wrong.</s:assert>
         <s:assert test="c:archive/c:entry/@href='http://xproc.org/ns/testsuite/3.0/test/folder/text.txt'">Value 'href' for 'folder/text.txt' is wrong.</s:assert>
         <s:assert test="count(c:archive/c:entry/@name)=10">Every c:entry must have an attribute 'name'.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2021, Achim Berndzen
Added attribute 'queryBinding' to schematron's schema.
28 Mar 2021, Achim Berndzen
Fixed typing bug in test.
24 Nov 2019, Achim Berndzen
Additional tests for p:archive-manifest