p:add-xml-base 005 (NW)

Test p:add-xml-base where the scheme changes.

Test nw-add-xml-base-005.xml 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" version="3.0">
   <p:output port="result"/>
   <p:identity>
      <p:with-input href="../documents/doc-with-entities.xml"/>
   </p:identity>
   <p:set-attributes attributes="map {'xml:base': 'https://tests.xproc.org/documents/book.xml'}"/>
   <p:add-xml-base/>
</p:declare-step>
MorganaXProc passing

Schematron validation


<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" queryBinding="xslt2">
   <s:pattern>
      <s:rule context="/">
         <s:assert test="book">Root element is not 'book'.</s:assert>
         <s:assert test="book/@xml:base = 'https://tests.xproc.org/documents/book.xml'">
                    &gt;Document element base URI is incorrect</s:assert>
         <s:assert test="empty(book/preface/@xml:base)">Preface should not have an xml:base attribute</s:assert>
         <s:assert test="ends-with(book/chapter[@label='1']/@xml:base,                                     '/documents/subdir/chap1.xml')">First chapter base URI doesn’t have the correct suffix</s:assert>
         <s:assert test="ends-with(book/chapter[@label='2']/@xml:base,                                     '/documents/chap2.xml')">Second chapter base URI doesn’t have the correct suffix</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

29 Apr 2024, Norm Tovey-Walsh

Created test for p:add-xml-base.