p:add-xml-base 006 (NW)
Test p:add-xml-base with all=true and relative=false when
a descendant element already has a relative xml:base attribute.
Test is expected to pass.
The pipeline
<p:declare-step xmlns:err="http://www.w3.org/ns/xproc-error"
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>
<document xml:base="http://example.com/documents/document.xml">
<child1/>
<child2 xml:base="c/chapter.xml">
<grandchild1 xml:base="s/section.xml"/>
</child2>
</document>
</p:with-input>
</p:identity>
<p:add-xml-base all="true" relative="false"/>
</p:declare-step>
Result
<document xmlns:err="http://www.w3.org/ns/xproc-error"
xmlns:t="http://xproc.org/ns/testsuite/3.0"
xml:base="http://example.com/documents/document.xml">
<child1 xml:base="http://example.com/documents/document.xml"/>
<child2 xml:base="http://example.com/documents/c/chapter.xml">
<grandchild1 xml:base="http://example.com/documents/c/s/section.xml"/>
</child2>
</document>
Schematron checks
<s:schema xmlns="http://www.w3.org/1999/xhtml"
xmlns:err="http://www.w3.org/ns/xproc-error"
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="document">Root element is not 'document'.</s:assert>
<s:assert test="document/@xml:base = 'http://example.com/documents/document.xml'">document has the wrong base URI.</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="/document">
<s:assert test="child1">Missing child1</s:assert>
<s:assert test="child2">Missing child2</s:assert>
<s:assert test="child1/@xml:base = 'http://example.com/documents/document.xml'">child1 has the wrong base URI.</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="/document/child2">
<s:assert test="@xml:base = 'http://example.com/documents/c/chapter.xml'">child2 has the wrong base URI.</s:assert>
<s:assert test="grandchild1">Missing grandchild1</s:assert>
<s:assert test="grandchild1/@xml:base = 'http://example.com/documents/c/s/section.xml'">grandchild1 has the wrong base URI.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 09 Dec 2025, Norm Tovey-Walsh
- Created test for p:add-xml-base.