p:archive 041 (AB)
Tests p:archive: Tests 'update' does not change method of the unchanged entries..
Test is expected to pass.
The pipeline
<p:declare-step xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:t="http://xproc.org/ns/testsuite/3.0" version="3.0">
<p:output port="result"/>
<p:archive parameters="map{'method' : 'deflated'}">
<p:with-input port="source">
<p:inline document-properties="map{'base-uri' : 'http://test/one.xml'}">
<doc-a/>
</p:inline>
<p:inline document-properties="map{'base-uri' : 'http://test/two.xml'}">
<doc-b/>
</p:inline>
</p:with-input>
<p:with-input port="manifest">
<p:empty/>
</p:with-input>
<p:with-input port="archive">
<p:empty/>
</p:with-input>
</p:archive>
<p:archive parameters="map{'command' : 'update', 'method' : 'none'}">
<p:with-input port="source">
<p:inline document-properties="map{'base-uri' : 'http://test/one.xml'}">
<doc-new/>
</p:inline>
</p:with-input>
<p:with-input port="manifest">
<p:empty/>
</p:with-input>
<p:with-input port="archive" pipe="result"/>
</p:archive>
<p:archive-manifest relative-to="http://xproc.org/ns/testsuite"/>
</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="one.xml" content-type="application/xml"
cx:size="125"
cx:file-creation-time="1601-01-01T00:00:00Z"
cx:last-access-time="1601-01-01T00:00:00Z" cx:last-modified="2025-06-19T18:05:46Z"
method="none" href="http://xproc.org/ns/one.xml"/>
<c:entry xmlns:cx="http://xmlcalabash.com/ns/extensions"
name="two.xml" content-type="application/xml"
cx:size="123"
cx:file-creation-time="1601-01-01T00:00:00Z"
cx:last-access-time="1601-01-01T00:00:00Z" cx:last-modified="2025-06-19T18:05:46Z"
method="deflated" href="http://xproc.org/ns/two.xml"/>
</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 uri="http://www.w3.org/ns/xproc-step"
prefix="c"/>
<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)=2">Root element does not have one child 'c:entry'.</s:assert>
<s:assert test="c:archive/c:entry/@name='one.xml'">There is no c:entry for 'one.xml'.</s:assert>
<s:assert test="c:archive/c:entry/@name='two.xml'">There is no c:entry for 'two.xml'.</s:assert>
<s:assert test="c:archive/c:entry[@name='one.xml']/@method='none'">Method for 'one.xml' is not 'none'.</s:assert>
<s:assert test="c:archive/c:entry[@name='two.xml']/@method='deflated'">Method for 'two.xml' is not 'deflated'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 10 Jun 2021, Achim Berndzen
- Added attribute 'queryBinding' to schematron's schema.
- 21 Dec 2019, Achim Berndzen
- Added option "relative-to" to p:archive-manifest
- 01 Sep 2019, Achim Berndzen
- Tests for p:archive