<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="/xpath-002.xml"
        name="xpath-002.xml"
        expected="pass">
   <t:info>
      <t:title>xpath-002</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2026-05-10</t:date>
            <t:author>
               <t:name>Norm Tovey-Walsh</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Fixed title.</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2025-01-03</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 that the cx:xpath step runs.</p>
   </t:description>
   <t:pipeline>
      <p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
                      xmlns:err="http://www.w3.org/ns/xproc-error"
                      xmlns:p="http://www.w3.org/ns/xproc"
                      version="3.0">
         <p:import href="https://xmlcalabash.com/ext/library/xpath.xpl"/>
         <p:output port="result"/>
         <cx:xpath parameters="map{'x': 7, 'y': 9, 'now': current-dateTime()}">
            <p:with-input>
               <doc>Test</doc>
               <doc>Test</doc>
               <doc>Test</doc>
            </p:with-input>
            <p:with-input port="xpath">
               <p:inline content-type="text/plain" expand-text="false">
count(collection())
          </p:inline>
            </p:with-input>
         </cx:xpath>
         <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:number">The result isn’t a number.</s:assert>
               <s:assert test="fn:number = '3'">The result isn’t 3.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="xpath-002.xml">
      <number xmlns="http://www.w3.org/2005/xpath-functions">3</number>
   </t:result>
</t:test>
