p:document 027

Tests p:document with a binary document.

Test ab-p-document027.xml is expected to pass.

The pipeline


<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
   <p:output port="result"/>
   <p:identity name="producer">
      <p:with-input href="../documents/ab-binary.bin"/>
   </p:identity>
   <p:cast-content-type content-type="application/xml" name="props">
      <p:with-input select="p:document-properties(.)"/>
   </p:cast-content-type>
   <p:cast-content-type content-type="application/xml" name="cast">
      <p:with-input pipe="@producer"/>
   </p:cast-content-type>
   <p:wrap-sequence wrapper="result">
      <p:with-input pipe="@props @cast"/>
   </p:wrap-sequence>
</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:ns uri="http://www.w3.org/2005/xpath-functions" prefix="j"/>
   <s:ns uri="http://www.w3.org/ns/xproc-step" prefix="c"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="result">Root element is not result.</s:assert>
         <s:assert test="/result/j:map">There is no element j:map.</s:assert>
         <s:assert test="/result/j:map/j:string[@key='content-type']/text() = 'application/octet-stream'">Content-type is not 'application/octet-stream'.</s:assert>
         <s:assert test="ends-with(/result/j:map/j:string[@key='base-uri']/text(),'/documents/ab-binary.bin')">Base-uri does not end with '/documents/ab-binary.bin'.</s:assert>
      </s:rule>
      <s:rule context="/result/c:data">
         <s:assert test="@content-type='application/octet-stream'">@content-type is not 'application/octet-stream'.</s:assert>
         <s:assert test="@encoding='base64'">@encoding is not 'base64'.</s:assert>
         <s:assert test="text()='SSBhbSBhIHRleHQgZG9jdW1lbnQ='">Base 64 encoding does not represent original document.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2021, Achim Berndzen

Added attribute 'queryBinding' to schematron's schema.

23 Nov 2019, Achim Berndzen

Changed test from p:document-properties-document() to p:document-properties().

22 Oct 2018, Norman Walsh

Fixed result document ( c:document-properties, not p:document-properties)

25 Apr 2018 18:11, Achim Berndzen

More tests.