<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="/relative-anyuri-002.xml"
        name="relative-anyuri-002.xml"
        expected="pass">
   <t:info>
      <t:title>relative-anyuri-002</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2026-06-15</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 relative URI resolution is dependent on the XProc version attribute.
    (These tests should also be in the official test suite, but this is a temporary
    place holder. Also, I stole it from Achim. 🙂)</p>
   </t:description>
   <t:pipeline>
      <p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                      xmlns:test="http://example.com/test"
                      xmlns:xs="http://www.w3.org/2001/XMLSchema"
                      name="main"
                      version="3.2">
         <p:output port="result"/>
         <p:option name="uri" select="'somewhere.txt'"/>
         <p:declare-step type="test:step">
            <p:output port="result"/>
            <p:option name="uri1" required="true" as="xs:anyURI"/>
            <p:option name="uri2" required="true" as="xs:anyURI"/>
            <p:option name="uri3" required="true" as="xs:anyURI"/>
            <p:identity>
               <p:with-input>
                  <doc>
                     <uri1>{$uri1}</uri1>
                     <uri2>{$uri2}</uri2>
                     <uri3>{$uri3}</uri3>
                  </doc>
               </p:with-input>
            </p:identity>
         </p:declare-step>
         <test:step uri2="{$uri}" xml:base="http://step" uri3="somewhere-else.xpl">
            <p:with-option name="uri1" select="$uri" xml:base="http://with-option"/>
         </test:step>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
         <s:pattern>
            <s:rule context="/">
               <s:assert test="doc">The root is wrong.</s:assert>
            </s:rule>
         </s:pattern>
         <s:pattern>
            <s:rule context="/doc">
               <s:assert test="uri1 = 'http://with-option/somewhere.txt'">Wrong uri1</s:assert>
               <s:assert test="uri2 = 'http://step/somewhere.txt'">Wrong uri2</s:assert>
               <s:assert test="uri3 = 'http://step/somewhere-else.xpl'">Wrong uri3</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
   <t:result name="relative-anyuri-002.xml">
      <doc xmlns:test="http://example.com/test"
           xmlns:xs="http://www.w3.org/2001/XMLSchema">
         <uri1>http://with-option/somewhere.txt</uri1>
         <uri2>http://step/somewhere.txt</uri2>
         <uri3>http://step/somewhere-else.xpl</uri3>
      </doc>
   </t:result>
</t:test>
