JSON merge 004(AB)

Simple test, joining together three maps with conflicting keys and 'use-last'.

Test ab-json-merge-004.xml is expected to pass.

The pipeline


<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
   <p:output port="result"/>
   <p:json-merge duplicates="use-last">
      <p:with-input expand-text="false">
         <p:inline content-type="application/json">{"key1" : "value1"}</p:inline>
         <p:inline content-type="application/json">{"key1" : "value2"}</p:inline>
         <p:inline content-type="application/json">{"key3" : "value3"}</p:inline>
      </p:with-input>
   </p:json-merge>
   <p:cast-content-type content-type="application/xml"/>
</p:declare-step>
MorganaXProc passing XML Calabash passing

Schematron validation


<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/*)=2">Element 'map:map' does not have two children.</s:assert>
         <s:assert test="count(map:map/map:string)=2">Element 'map:map' does not have two children 'map:string'.</s:assert>
         <s:assert test="map:map/map:string[@key='key1']='value2'">Element 'string' with @key1 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:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2021, Achim Berndzen

Added attribute 'queryBinding' to schematron's schema.

13 Oct 2019, Achim Berndzen

Added tests for p:json-merge