<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="ab-json-merge-008.xml"
        name="ab-json-merge-008.xml"
        expected="pass">
   <t:info>
      <t:title>JSON merge 008(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>Joining together three json string, using default key generator.</p>
   </t:description>
   <t:pipeline>
      <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
         <p:output port="result"/>
         <p:json-merge>
            <p:with-input expand-text="false">
               <p:inline content-type="application/json">"one"</p:inline>
               <p:inline content-type="application/json">"two"</p:inline>
               <p:inline content-type="application/json">"three"</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 xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
         <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/*)=3">Element 'map:map' does not have three children.</s:assert>
               <s:assert test="count(map:map/map:string)=3">Element 'map:map' does not have three children 'map:string'.</s:assert>
               <s:assert test="map:map/map:string[@key='_1'] = 'one'">Value of string/@key='_1' is not one.</s:assert>
               <s:assert test="map:map/map:string[@key='_2'] = 'two'">Value of string/@key='_2' is not two.</s:assert>
               <s:assert test="map:map/map:string[@key='_3'] = 'three'">Value of string/@key='_3' is not three.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="ab-json-merge-008.xml">
      <map xmlns="http://www.w3.org/2005/xpath-functions">
         <string key="_1">one</string>
         <string key="_2">two</string>
         <string key="_3">three</string>
      </map>
   </t:result>
</t:test>
