Example test from RFC 6092.
Test json-patch-002.xml is expected to pass.
<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions" xmlns:p="http://www.w3.org/ns/xproc" name="main" version="3.0" expand-text="false">
<p:import href="https://xmlcalabash.com/ext/library/json-patch.xpl"/>
<p:output port="result"/>
<cx:json-patch cx:expand-text="false">
<p:with-input>
<p:inline content-type="application/json">{ "foo": ["bar", "baz"]}</p:inline>
</p:with-input>
<p:with-input port="patch">
<p:inline content-type="application/json">
[
{ "op": "add", "path": "/foo/1", "value": "qux" }
]
</p:inline>
</p:with-input>
</cx:json-patch>
<p:cast-content-type content-type="application/xml"/>
</p:declare-step>
<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
<s:ns prefix="fn" uri="http://www.w3.org/2005/xpath-functions"/>
<s:pattern>
<s:rule context="/">
<s:assert test="fn:map">The root is not map.</s:assert>
<s:assert test="count(fn:map/*) = 1">Wrong number of keys.</s:assert>
<s:assert test="exists(fn:map/fn:array[@key='foo'])">foo isn’t an array</s:assert>
<s:assert test="fn:map/fn:array[@key='foo']/fn:string[1] = 'bar'">foo[1] != bar</s:assert>
<s:assert test="fn:map/fn:array[@key='foo']/fn:string[2] = 'qux'">foo[2] != bar</s:assert>
<s:assert test="fn:map/fn:array[@key='foo']/fn:string[3] = 'baz'">foo[3] != bar</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Created test.