p:document 029

Tests p:document with json document is correctly loaded.

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:cast-content-type content-type="application/xml">
      <p:with-input>
         <p:document href="../documents/JSon-doc1.json"
                     content-type="application/json"/>
      </p:with-input>
   </p:cast-content-type>
</p:declare-step>

Result

<map xmlns="http://www.w3.org/2005/xpath-functions"
     xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <string key="key">value</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="x"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="x:map">There is no root element 'map' (in xpath-functions-namespace).</s:assert>
         <s:assert test="count(x:map/*)=1">'map' does not have exactly one child element.</s:assert>
         <s:assert test="x:map/x:string">'map' does not have a child element named 'string'.</s:assert>
         <s:assert test="x:map/x:string/text()='value'">'map/string' does not have a text node child 'value'.</s:assert>
         <s:assert test="count(x:map/x:string/@*)=1">'map/string' does not have exactly one attribute.</s:assert>
         <s:assert test="x:map/x:string/@key">'map/string' does not have an attribute named 'key'.</s:assert>
         <s:assert test="x:map/x:string/@key='key'">Attribute 'key' does not have the text value of 'key'.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

10 Jun 2021, Achim Berndzen
Added attribute 'queryBinding' to schematron's schema.
05 Oct 2018, Norman Walsh
Fix ab-p-document029.xml
04 Oct 2018, Achim Berndzen
One new and one corrected test.
29 Aug 2018, Achim Berndzen
Now I have all tests where p:document needs a content-type according to the new specs
25 Apr 2018, Achim Berndzen
More tests.