<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="jsonpath-001.xml"
        name="jsonpath-001.xml"
        expected="pass">
   <t:info>
      <t:title>jsonpath-001</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2025-05-11</t:date>
            <t:author>
               <t:name>Norm Tovey-Walsh</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Created test.</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml">
      <p>Tests a JSONPath definite query.</p>
   </t:description>
   <t:pipeline>
      <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/jsonpath.xpl"/>
         <p:output port="result"/>
         <cx:jsonpath query="$.store.book[1].author">
            <p:with-input href="../documents/find/bookstore.json"/>
         </cx:jsonpath>
         <p:cast-content-type content-type="application/xml"/>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <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:string">The root is not a string.</s:assert>
               <s:assert test="fn:string = 'Evelyn Waugh'">The author is incorrect.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="jsonpath-001.xml">
      <string xmlns="http://www.w3.org/2005/xpath-functions">Evelyn Waugh</string>
   </t:result>
</t:test>
