p:archive 038 (AB)
Tests p:archive: Tests 'update' one entry is changed, but a new entry is added.
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>
<p:with-input port="source">
<p:inline document-properties="map{'base-uri' : 'http://test/one.xml'}">
<doc-a/>
</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'}">
<p:with-input port="source">
<p:inline document-properties="map{'base-uri' : 'http://test/one.xml'}">
<doc-new/>
</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" pipe="result"/>
</p:archive>
<p:unarchive relative-to="folder"/>
<p:wrap-sequence wrapper="wrapper"/>
</p:declare-step>
Result
<wrapper xmlns:t="http://xproc.org/ns/testsuite/3.0">
<doc-new xmlns:c="http://www.w3.org/ns/xproc-step"/>
<doc-b xmlns:c="http://www.w3.org/ns/xproc-step"/>
</wrapper>
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:pattern>
<s:rule context="/">
<s:assert test="wrapper">Root element is not wrapper</s:assert>
<s:assert test="count(wrapper/*)=2">Wrapper should only have two child elements.</s:assert>
<s:assert test="wrapper/doc-new">There is no child 'doc-new' in wrapper.</s:assert>
<s:assert test="wrapper/doc-b">There is no child 'doc-b' in wrapper.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 10 Jun 2021, Achim Berndzen
- Added attribute 'queryBinding' to schematron's schema.
- 22 Nov 2019, Achim Berndzen
- Added relative-to option to p:unarchive, because archive does not
have a valid base uri.
- 01 Sep 2019, Achim Berndzen
- Tests for p:archive