<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="ab-cast-content-type-007.xml"
        name="ab-cast-content-type-007.xml"
        expected="pass">
   <t:info>
      <t:title>cast-content-type 007 (AB)</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2021-06-10</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Added attribute 'queryBinding' to schematron's schema.</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2019-12-27</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Initial tests for the new iteration of p:cast-content-type</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml">
      <p>Tests casting from an xml content type to a binary document (c:data) .</p>
   </t:description>
   <t:pipeline>
      <p:declare-step xmlns:c="http://www.w3.org/ns/xproc-step"
                      xmlns:p="http://www.w3.org/ns/xproc"
                      name="pipeline"
                      version="3.0">
         <p:output port="result"/>
         <p:cast-content-type content-type="application/octet-stream">
            <p:with-input>
               <p:inline document-properties="map{'base-uri' : 'http://xproc-test.org',                         'serialization' : map{},                         'additional' : 'property'}">
                  <c:data content-type="application/octet-stream">SSBhbSBqdXN0IGEgdGV4dC4=</c:data>
               </p:inline>
            </p:with-input>
         </p:cast-content-type>
         <p:cast-content-type content-type="application/xml">
            <p:with-input select="p:document-properties(.)"/>
         </p:cast-content-type>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
         <s:ns prefix="fn" uri="http://www.w3.org/2005/xpath-functions"/>
         <s:pattern>
            <s:rule context="/">
               <s:assert test="fn:map">Root element is not 'fn:map'.</s:assert>
               <s:assert test="fn:map/fn:string[@key='base-uri']='http://xproc-test.org'">The base-uri property is not correct.</s:assert>
               <s:assert test="fn:map/fn:string[@key='content-type']='application/octet-stream'">The content-type property is not correct.</s:assert>
               <s:assert test="fn:map/fn:string[@key='additional']='property'">The additional property is not correct.</s:assert>
               <s:assert test="not(fn:map/fn:map[@key='serialization'])">There should be is no serialization property.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="ab-cast-content-type-007.xml">
      <map xmlns="http://www.w3.org/2005/xpath-functions">
         <string key="base-uri">http://xproc-test.org</string>
         <string key="additional">property</string>
         <string key="content-type">application/octet-stream</string>
      </map>
   </t:result>
</t:test>
