xinclude-001
Hopefully, a test that finally, once and for all, really and truly this time,
demonstrates that
issue #321
is resolved.
Test is expected to pass.
The pipeline
<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:t="http://xproc.org/ns/testsuite/3.0" name="main" version="3.0"
expand-text="false">
<p:output port="result"/>
<p:xinclude>
<p:with-input href="../documents/xinclude-321.xml"/>
</p:xinclude>
<p:add-xml-base relative="false"/>
</p:declare-step>
Result
<top-level 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/extra-suite/test-suite/documents/xinclude-321.xml">
<top/>
<second-level xml:base="file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/extra-suite/test-suite/documents/subdir/second-level.xml">
<second/>
<example xml:base="http://example.com/path">
<example/>
</example>
<third-level xml:base="file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/extra-suite/test-suite/documents/subdir/subdir/third-level.xml">
<third/>
<fourth-level xml:base="file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/extra-suite/test-suite/documents/subdir/subdir/fourth-level.xml">
<fourth/>
</fourth-level>
<third/>
</third-level>
<second/>
</second-level>
<top/>
</top-level>
Schematron checks
<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron"
xmlns:t="http://xproc.org/ns/testsuite/3.0" queryBinding="xslt2">
<s:ns prefix="c"
uri="http://www.w3.org/ns/xproc-step"/>
<s:pattern>
<s:rule context="/">
<s:assert test="top-level">The root isn’t top-level.</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="top-level">
<s:assert test="ends-with(base-uri(.), '/documents/xinclude-321.xml')">Wrong top-level base URI</s:assert>
<s:assert test="second-level">There’s no second level.</s:assert>
<s:assert test="top">There are no top elements.</s:assert>
<s:assert test="empty(top[not(ends-with(base-uri(.), '/documents/xinclude-321.xml'))])">Wrong base URI on top element(s).</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="second-level">
<s:assert test="ends-with(base-uri(.), '/documents/subdir/second-level.xml')">Wrong second-level base URI</s:assert>
<s:assert test="example">There’s no example element.</s:assert>
<s:assert test="third-level">There’s no third level.</s:assert>
<s:assert test="second">There are no second elements.</s:assert>
<s:assert test="empty(second[not(ends-with(base-uri(.), '/documents/subdir/second-level.xml'))])">Wrong base URI on second element(s).</s:assert>
<s:assert test="empty(.//example[base-uri(.) != 'http://example.com/path'])">Wrong example base URI.</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="third-level">
<s:assert test="ends-with(base-uri(.), '/documents/subdir/subdir/third-level.xml')">Wrong third-level base URI</s:assert>
<s:assert test="fourth-level">There’s no fourth level.</s:assert>
<s:assert test="third">There are no third elements.</s:assert>
<s:assert test="empty(third[not(ends-with(base-uri(.), '/subdir/subdir/third-level.xml'))])">Wrong base URI on third element(s).</s:assert>
</s:rule>
</s:pattern>
<s:pattern>
<s:rule context="fourth-level">
<s:assert test="ends-with(base-uri(.), '/documents/subdir/subdir/fourth-level.xml')">Wrong fourth-level base URI</s:assert>
<s:assert test="fourth">There are no third elements.</s:assert>
<s:assert test="empty(fourth[not(ends-with(base-uri(.), '/subdir/subdir/fourth-level.xml'))])">Wrong base URI on fourth element(s).</s:assert>
</s:rule>
</s:pattern>
</s:schema>
Revision history
- 21 May 2025, Norm Tovey-Walsh
- Created test.