p:set-properties-034 (AB)

Tests p:set-properties changes 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:set-properties properties="map{'base-uri': 'file:///something'}">
      <p:with-input>
         <doc>
            <element xml:base="http://me-string"/>
         </doc>
      </p:with-input>
   </p:set-properties>
   <p:identity>
      <p:with-input>
         <result>
            <root-uri>{base-uri(/)}</root-uri>
            <element-uri>{base-uri(/*)}</element-uri>
            <element-with-xml-base>{base-uri(doc/element)}</element-with-xml-base>
            <document-prop>{p:document-property(., 'base-uri')}</document-prop>
         </result>
      </p:with-input>
   </p:identity>
</p:declare-step>

Result

<result xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <root-uri>file:///something</root-uri>
   <element-uri>file:///something</element-uri>
   <element-with-xml-base>http://me-string</element-with-xml-base>
   <document-prop>file:///something</document-prop>
</result>

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:ns uri="http://www.w3.org/2005/xpath-functions"
         prefix="j"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="result">Root element is not 'result'.</s:assert>
         <s:assert test="result/root-uri/text()='file:///something'">The base-uri of root is not right.</s:assert>
         <s:assert test="result/element-uri/text()='file:///something'">The element-uri of root is not right.</s:assert>
         <s:assert test="result/element-with-xml-base/text()='http://me-string'">The base-uri of element with xml:base is not right.</s:assert>
         <s:assert test="result/document-prop/text()='file:///something'">The base-uri document-property is not right.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

01 Feb 2023, Achim Berndzen
Test for base-uri in p:set-properties