p:namespace-rename-009 (AB)
Tests p:namespace-rename
Test is expected to pass.
Input: source
<d:doc xmlns:bar="http://bar.com" xmlns:d="http://bar.com"
xmlns:t="http://xproc.org/ns/testsuite/3.0" xmlns:x="http://test.com" bar:attr1="val1"
x:attr2="val2">
<p/>
<p:p xmlns:p="http://bar.com"/>
</d:doc>
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"/>
<p:output port="result"/>
<p:namespace-rename from="http://bar.com"
to="http://foo.com" apply-to="elements"/>
</p:declare-step>
Result
<_1:doc xmlns:_1="http://foo.com" xmlns:bar="http://bar.com"
xmlns:t="http://xproc.org/ns/testsuite/3.0" xmlns:x="http://test.com" bar:attr1="val1"
x:attr2="val2">
<p xmlns:d="http://bar.com"/>
<p:p xmlns:p="http://foo.com"/>
</_1:doc>
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="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>
Revision history
- 10 Jun 2021, Achim Berndzen
- Added attribute 'queryBinding' to schematron's schema.
- 17 May 2019, Achim Berndzen
- Ported tests for p:namespace-rename