nw-xinclude-003

Tests that the base URI is preserved correctly in nested inclusions.

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" name="pipeline" version="3.0">
   <p:output port="result"/>
   <p:xinclude fixup-xml-base="true">
      <p:with-input href="../documents/four.xml"/>
   </p:xinclude>
   <p:add-xml-base/>
</p:declare-step>

Result

<four xmlns:t="http://xproc.org/ns/testsuite/3.0"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xml:base="file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/documents/four.xml">
   <three xml:base="three.xml">
      <two xml:base="two.xml">
         <one xml:base="one.xml"/>
      </two>
   </three>
</four>

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:pattern>
      <s:rule context="/">
         <s:assert test="four">Root element is not 'four'.</s:assert>
         <s:assert test="ends-with(four/@xml:base, 'four.xml')">Four has wrong base uri.</s:assert>
         <s:assert test="ends-with(four/three/@xml:base, 'three.xml')">Three has wrong base uri.</s:assert>
         <s:assert test="ends-with(four/three/two/@xml:base, 'two.xml')">Two has wrong base uri.</s:assert>
         <s:assert test="ends-with(four/three/two/one/@xml:base, 'one.xml')">One has wrong base uri.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

17 May 2025, Norm Tovey-Walsh
Initial commit.