<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="ab-document-properties-003.xml"
        name="ab-document-properties-003.xml"
        expected="pass">
   <t:info>
      <t:title>ab-document-properties-003</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2021-11-27</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Fixed test as consequence of pr#1042.</p>
            </t:description>
         </t:revision>
         <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-11-20</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Changed test from p:document-properties-document() to p:document-properties()</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2018-10-22</t:date>
            <t:author initials="ndw">
               <t:name>Norman Walsh</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Fixed result document
            (
                  <code>c:document-properties</code>, not 
                  <code>p:document-properties</code>)</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2018-04-25T18:11:02+02:00</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>More tests.</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml">
      <p>Tests document-properties() for a document loaded with doc()</p>
   </t:description>
   <t:pipeline>
      <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
         <p:output port="result"/>
         <p:cast-content-type content-type="application/xml">
            <p:with-input select="p:document-properties(doc('../documents/ab-doc.xml'))">
               <doc/>
            </p:with-input>
         </p:cast-content-type>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <s:schema xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://purl.oclc.org/dsdl/schematron"
                queryBinding="xslt2">
         <s:ns prefix="j" uri="http://www.w3.org/2005/xpath-functions"/>
         <s:pattern>
            <s:rule context="/">
               <s:assert test="j:map">The root is not j:map.</s:assert>
               <s:assert test="j:map/j:string[@key='content-type']/text() = 'application/xml'">Content-type is not application/xml.</s:assert>
               <s:assert test="ends-with(j:map/j:string[@key='base-uri']/text(), '/documents/ab-doc.xml')">Base-uri is not correct.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="ab-document-properties-003.xml">
      <map xmlns="http://www.w3.org/2005/xpath-functions">
         <string key="base-uri">file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/documents/ab-doc.xml</string>
         <string key="content-type">application/xml</string>
      </map>
   </t:result>
</t:test>
