<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass"
        xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <t:info>
      <t:title>JSON merge 001(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-10-13</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Added tests for p:json-merge</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml">
      <p>Simple test, joining together three maps with different keys.</p>
   </t:description>
   <t:pipeline>
      <p:declare-step version="3.0"
                      xmlns:p="http://www.w3.org/ns/xproc">
         <p:output port="result"/>
         <p:json-merge>
            <p:with-input expand-text="false">
               <p:inline content-type="application/json">{"key1" : "value1", "key2" : "value2"}</p:inline>
               <p:inline content-type="application/json">{"key3" : "value3"}</p:inline>
               <p:inline content-type="application/json">{"key4" : "value4"}</p:inline>
            </p:with-input>
         </p:json-merge>
         <p:cast-content-type content-type="application/xml"/>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <s:schema queryBinding="xslt2"
                xmlns:s="http://purl.oclc.org/dsdl/schematron">
         <s:ns prefix="map"
               uri="http://www.w3.org/2005/xpath-functions"/>
         <s:pattern>
            <s:rule context="/">
               <s:assert test="map:map">The document node is not 'map:map'.</s:assert>
               <s:assert test="count(map:map/*)=4">Element 'map:map' does not have four children.</s:assert>
               <s:assert test="count(map:map/map:string)=4">Element 'map:map' does not have four children 'map:string'.</s:assert>
               <s:assert test="map:map/map:string[@key='key1']='value1'">Element 'string' with @key1 does not have text child 'value1'.</s:assert>
               <s:assert test="map:map/map:string[@key='key2']='value2'">Element 'string' with @key2 does not have text child 'value2'.</s:assert>
               <s:assert test="map:map/map:string[@key='key3']='value3'">Element 'string' with @key3 does not have text child 'value3'.</s:assert>
               <s:assert test="map:map/map:string[@key='key4']='value4'">Element 'string' with @key4 does not have text child 'value4'.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
</t:test>