Tests p:document with a binary document.
Test ab-p-document027.xml is expected to pass.
<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>
<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>
Added attribute 'queryBinding' to schematron's schema.
Changed test from p:document-properties-document() to p:document-properties().
Fixed result document
(
c:document-properties
, not
p:document-properties
)
More tests.