JSON merge 014(AB)

Joining map and JSON string with conflict in keys, explicit strategy combine.

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

The pipeline


      <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0" exclude-inline-prefixes="xs">
         <p:output port="result"/>
         
         <p:json-merge key="'key1'" duplicates="combine">
            <p:with-input expand-text="false">
               <p:inline content-type="application/json">{"key1" : "value"}</p:inline>
               <p:inline content-type="application/json">"one"</p:inline>
            </p:with-input>
         </p:json-merge>         
         
         <p:variable name="seq" as="xs:string+" select=".?key1"/>
         
         <p:identity>
            <p:with-input>
               <result xmlns="">
                  <value1>{$seq[1]}</value1>
                  <value2>{$seq[2]}</value2>
               </result>
            </p:with-input>
         </p:identity>
         
      </p:declare-step>
   
MorganaXProc passing XML Calabash failing

Schematron validation


      <s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron">
         <s:pattern>
            <s:rule context="/">
               <s:assert test="result">The document node is not 'result'.</s:assert>
               <s:assert test="result/value1 = 'value'">First value is not 'value'.</s:assert>
               <s:assert test="result/value2 = 'one'">Second value is not 'one'.</s:assert>
             </s:rule>
         </s:pattern>
      </s:schema>
   

Revision history

13 Oct 2019, Achim Berndzen

Added tests for p:json-merge