p:validate-with-json-schema 001 (AB)
Tests p:validate-with-json-schema: Document is replicated on port "result".
Test is expected to pass.
The pipeline
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
xmlns:t="http://xproc.org/ns/testsuite/3.0" version="3.0">
<p:output port="result"/>
<p:validate-with-json-schema>
<p:with-input href="../documents/valid.json"/>
<p:with-input port="schema"
href="../documents/schema.json"/>
</p:validate-with-json-schema>
<p:cast-content-type content-type="application/xml"/>
</p:declare-step>
Result
<map xmlns="http://www.w3.org/2005/xpath-functions"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<string key="last_name">Doe</string>
<string key="first_name">Jane</string>
</map>
Schematron checks
<s:schema xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://purl.oclc.org/dsdl/schematron" xmlns:t="http://xproc.org/ns/testsuite/3.0"
queryBinding="xslt2">
<s:ns uri="http://www.w3.org/2005/xpath-functions"
prefix="fn"/>
<s:pattern>
<s:rule context="/">
<s:assert test="fn:map">The root element is not "map".</s:assert>
<s:assert test="fn:map/fn:string[@key='first_name']">There is no entry for 'first_name'.</s:assert>
<s:assert test="fn:map/fn:string[@key='last_name']">There is no entry for 'last_name'.</s:assert>
<s:assert test="fn:map/fn:string[@key='first_name']='Jane'">The string value for first_name is not 'Jane'.</s:assert>
<s:assert test="fn:map/fn:string[@key='last_name']='Doe'">The string value for last_name us not 'Doe'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 04 Sep 2022, Achim Berndzen
- Initial commit