p:unarchive 004 (AB)

Tests p:unarchive: Option 'format' set to xs:QName('zip').

Test ab-unarchive-004.xml is expected to pass.

The pipeline


<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:xs="http://www.w3.org/2001/XMLSchema" name="pipeline" version="3.0">
   <p:output port="result" serialization="map{'indent' : true()}"/>
   <p:unarchive>
      <p:with-option name="format" select="xs:QName('zip')"/>
      <p:with-input href="../documents/archive.zip"/>
   </p:unarchive>
   <p:for-each>
      <p:variable name="base-uri" select="p:document-property(., 'base-uri')"/>
      <p:add-attribute attribute-name="content-type" attribute-value="{p:document-property(., 'content-type')}">
         <p:with-input>
            <entry/>
         </p:with-input>
      </p:add-attribute>
      <p:add-attribute attribute-name="base-uri" attribute-value="{$base-uri}"/>
   </p:for-each>
   <p:wrap-sequence wrapper="result"/>
</p:declare-step>
MorganaXProc passing XML Calabash passing

Schematron validation


<s:schema xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
   <s:pattern>
      <s:rule context="/">
         <s:assert test="result">Root element is not 'result'.</s:assert>
         <s:assert test="count(result/entry)=10">Element 'c:archive' does not have 10 children named 'entry'</s:assert>
         <s:assert test="result/entry[ends-with(@base-uri, 'documents/archive.zip/doc.xml')]/@content-type='application/xml'">There is no entry for 'doc.xml' with 'application/xml'.</s:assert>
         <s:assert test="result/entry[ends-with(@base-uri, 'documents/archive.zip/text.txt')]/@content-type='text/plain'">Content-type of 'text.text' is not 'text/plain'.</s:assert>
         <s:assert test="result/entry[ends-with(@base-uri, 'documents/archive.zip/json.json')]/@content-type='application/json'">Content-type of 'json.json' is not 'application/json'.</s:assert>
         <s:assert test="result/entry[ends-with(@base-uri, 'documents/archive.zip/html.html')]/@content-type='text/html'">Content-type of 'html.html' is not 'text/html'.</s:assert>
         <s:assert test="result/entry[ends-with(@base-uri, 'documents/archive.zip/fish.jpg')]/@content-type='image/jpeg' or                                result/entry[ends-with(@base-uri, 'documents/archive.zip/fish.jpg')]/@content-type='application/octet-stream'">Content-type of 'fish.jpg' is not 'image/jpg' or 'application/octet-stream'.</s:assert>
         <s:assert test="result/entry[ends-with(@base-uri, 'documents/archive.zip/folder/doc.xml')]/@content-type='application/xml'">Content-type of 'folder/doc.xml' is not 'application/xml'.</s:assert>
         <s:assert test="result/entry[ends-with(@base-uri, 'documents/archive.zip/folder/text.txt')]/@content-type='text/plain'">Content-type of 'folder/text.text' is not 'text/plain'.</s:assert>
         <s:assert test="result/entry[ends-with(@base-uri, 'documents/archive.zip/folder/json.json')]/@content-type='application/json'">Content-type of 'folder/json.json' is not 'application/json'.</s:assert>
         <s:assert test="result/entry[ends-with(@base-uri, 'documents/archive.zip/folder/html.html')]/@content-type='text/html'">Content-type of 'folder/html.html' is not 'text/html'.</s:assert>
         <s:assert test="result/entry[ends-with(@base-uri, 'documents/archive.zip/folder/fish.jpg')]/@content-type='image/jpeg' or                                result/entry[ends-with(@base-uri, 'documents/archive.zip/folder/fish.jpg')]/@content-type='application/octet-stream'">Content-type of 'folder/fish.jpg' is not 'image/jpg' or 'application/octet-stream'.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2021, Achim Berndzen

Added attribute 'queryBinding' to schematron's schema.

14 Dec 2019, Achim Berndzen

Added declaration for prefix "xs".

18 Nov 2019, Achim Berndzen

Changed test from p:document-properties-document() to p:document-property(), and adopted absolute base uris.

25 Aug 2019, Achim Berndzen

Initial tests for p:unarchive