p:namespace-rename-021 (AB)

Tests p:namespace-rename renames attributes correctly. (Implicit 'all')

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:input port="source">
      <some-document>
         <contents a="b"/>
      </some-document>
   </p:input>
   <p:output port="result"/>
   <p:namespace-rename to="#some-namespace"/>
</p:declare-step>

Result

<some-document xmlns="#some-namespace"
               xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <contents a="b"/>
</some-document>

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="#some-namespace" prefix="bar"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="bar:some-document">The root element is not 'Q{#some-namespace}some-document'.</s:assert>
         <s:assert test="bar:some-document/bar:contents">There is no child element 'Q{#some-namespace}contents'.</s:assert>
         <s:assert test="bar:some-document/bar:contents/@bar:a">There is attribute 'Q{#some-namespace}a' on element '*:contents'.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

28 Sep 2024, Achim Berndzen
Added test.