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:identity name="props">
                <p:with-input select="p:document-properties-document(.)"/>
            </p:identity>
            <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 failing

Schematron validation


      <s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron">
         <s:ns uri="http://www.w3.org/ns/xproc" prefix="p"/>
         <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/c:document-properties">There is no element c:document-properties.</s:assert>
               <s:assert test="/result/c:document-properties/content-type = 'application/octet-stream'">Content-type is not 'application/octet-stream'.</s:assert>
               <s:assert test="ends-with(/result/c:document-properties/base-uri,'/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

22 Oct 2018, Norman Walsh

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

25 Apr 2018 18:11, Achim Berndzen

More tests.