<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass"
        xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <t:info>
      <t:title>p:namespace-rename-009 (AB)</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2021-06-10</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Added attribute 'queryBinding' to schematron's schema.</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2019-05-17</t:date>
            <t:author>
               <t:name>Achim Berndzen</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Ported tests for p:namespace-rename</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml">
      <p>Tests p:namespace-rename</p>
   </t:description>
   <t:input port="source">
      <d:doc bar:attr1="val1"
             x:attr2="val2"
              xmlns:bar="http://bar.com"
              xmlns:x="http://test.com"
             xmlns:d="http://bar.com">
         <p/>
         <p:p xmlns:p="http://bar.com"/>
      </d:doc>
   </t:input>
   <t:pipeline>
      <p:declare-step version="3.0"
                      xmlns:p="http://www.w3.org/ns/xproc">
         <p:input port="source"/>
         <p:output port="result"/>
         <p:namespace-rename from="http://bar.com"
                             to="http://foo.com"
                             apply-to="elements"/>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <s:schema queryBinding="xslt2"
                xmlns:s="http://purl.oclc.org/dsdl/schematron"
                xmlns="http://www.w3.org/1999/xhtml">
         <s:ns uri="http://test.com"
               prefix="x"/>
         <s:ns uri="http://foo.com"
               prefix="foo"/>
         <s:ns uri="http://bar.com"
               prefix="bar"/>
         <s:pattern>
            <s:rule context="/">
               <s:assert test="foo:doc">The root element is not 'Q{http://foo.com}doc'.</s:assert>
               <s:assert test="*/@x:attr2">Root does not have an attribute Q{http://test.com}attr2.</s:assert>
               <s:assert test="*/@bar:attr1">Root does not have an attribute Q{http://bar.com}attr1.</s:assert>
               <s:assert test="foo:doc/foo:p">Root does not have a child 'Q{http://foo.com}p'.</s:assert>
               <s:assert test="foo:doc/p">Root does not have a child 'p' in no namespace.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
</t:test>