nw-base-uri-034

Test that the result of p:validate-with-dtd *has* a base URI on the result port but not on the report port.

Test nw-base-uri-034.xml is expected to pass.

It requires the following features: p-validate-with-dtd.

The pipeline

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
   <p:output port="result"/>
   <p:validate-with-dtd serialization="map{'doctype-system' : '../documents/address.dtd'}" name="validate">
      <p:with-input>
         <address>
            <first>Douglas</first>
            <last>Adams</last>
            <phone>42</phone>
         </address>
      </p:with-input>
   </p:validate-with-dtd>
   <p:cast-content-type content-type="application/xml" name="result-properties">
      <p:with-input select="p:document-properties(.)">
         <p:pipe step="validate" port="result"/>
      </p:with-input>
   </p:cast-content-type>
   <p:cast-content-type content-type="application/xml" name="report-properties">
      <p:with-input select="p:document-properties(.)">
         <p:pipe step="validate" port="report"/>
      </p:with-input>
   </p:cast-content-type>
   <p:wrap-sequence wrapper="wrapper">
      <p:with-input>
         <p:pipe step="result-properties"/>
         <p:pipe step="report-properties"/>
      </p:with-input>
   </p:wrap-sequence>
</p:declare-step>

Schematron validation

<s:schema xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
   <s:ns prefix="fn" uri="http://www.w3.org/2005/xpath-functions"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="wrapper">Document element is wrong</s:assert>
      </s:rule>
   </s:pattern>
   <s:pattern>
      <s:rule context="/wrapper">
         <s:assert test="exists(fn:map[1]/*[@key='base-uri'])">There should be a base-uri property on the result</s:assert>
         <s:assert test="not(exists(fn:map[2]/*[@key='base-uri']))">There should not be a base-uri property on the report</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

29 Jun 2026, Norm Tovey-Walsh

Created test