Add-attribute-018 (AB)
Tests that adding xml:base also changes element's base-uri.
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:output port="result"/>
<p:identity>
<p:with-input>
<doc xml:base-uri="http://some-uri"/>
</p:with-input>
</p:identity>
<p:add-attribute attribute-value="http://changed-uri"
attribute-name="xml:base"/>
<p:identity>
<p:with-input>
<result>{base-uri(/doc)}</result>
</p:with-input>
</p:identity>
</p:declare-step>
Result
<result xmlns:t="http://xproc.org/ns/testsuite/3.0">http://changed-uri</result>
Schematron checks
<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron"
xmlns:t="http://xproc.org/ns/testsuite/3.0" queryBinding="xslt2">
<s:pattern>
<s:rule context="/">
<s:assert test="result">The document root is not 'result'.</s:assert>
<s:assert test="result/text()='http://changed-uri'">Base-uri of element 'doc' is not 'http://changed-uri'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 10 Jun 2021, Achim Berndzen
- Added attribute 'queryBinding' to schematron's schema.
- 16 Feb 2019, Achim Berndzen
- Added new tests for p:add-attribute.