<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass"
        xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <t:info>
      <t:title>p:document 029</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>2018-10-05T08:21:42-05:00</t:date>
            <t:author>
               <t:name>Norman Walsh</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Fix ab-p-document029.xml</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2018-10-04T18:13:39+02:00</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>One new and one corrected test.</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2018-08-29T15:54:35+02:00</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Now I have all tests where p:document needs a content-type according to the new specs</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 p:document with json document is correctly loaded.</p>
   </t:description>
   <t:pipeline>
      <p:declare-step version="3.0"
                      xmlns:p="http://www.w3.org/ns/xproc">
         <p:output port="result"/>
         <p:cast-content-type content-type="application/xml">
            <p:with-input>
               <p:document href="../documents/JSon-doc1.json"
                           content-type="application/json"/>
            </p:with-input>
         </p:cast-content-type>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <s:schema queryBinding="xslt2"
                xmlns:s="http://purl.oclc.org/dsdl/schematron"
                xmlns="http://www.w3.org/1999/xhtml">
         <s:ns uri="http://www.w3.org/2005/xpath-functions"
               prefix="x"/>
         <s:pattern>
            <s:rule context="/">
               <s:assert test="x:map">There is no root element 'map' (in xpath-functions-namespace).</s:assert>
               <s:assert test="count(x:map/*)=1">'map' does not have exactly one child element.</s:assert>
               <s:assert test="x:map/x:string">'map' does not have a child element named 'string'.</s:assert>
               <s:assert test="x:map/x:string/text()='value'">'map/string' does not have a text node child 'value'.</s:assert>
               <s:assert test="count(x:map/x:string/@*)=1">'map/string' does not have exactly one attribute.</s:assert>
               <s:assert test="x:map/x:string/@key">'map/string' does not have an attribute named 'key'.</s:assert>
               <s:assert test="x:map/x:string/@key='key'">Attribute 'key' does not have the text value of 'key'.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
</t:test>