nw-base-uri-030
Test that the result of p:validate-with-relax-ng *has* a base URI on the
result port but not on the report port.
Test is expected to pass.
The pipeline
<p:declare-step xmlns:c="http://www.w3.org/ns/xproc-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:validate-with-relax-ng name="validate">
<p:with-input port="source">
<doc>
<title>Title</title>
<p>Some paragraph.</p>
</doc>
</p:with-input>
<p:with-input port="schema">
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
<ref name="doc"/>
</start>
<define name="doc">
<element name="doc">
<optional>
<ref name="title"/>
</optional>
<zeroOrMore>
<ref name="p"/>
</zeroOrMore>
</element>
</define>
<define name="title">
<element name="title">
<text/>
</element>
</define>
<define name="p">
<element name="p">
<text/>
</element>
</define>
</grammar>
</p:with-input>
</p:validate-with-relax-ng>
<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>
Result
<wrapper xmlns:t="http://xproc.org/ns/testsuite/3.0">
<map xmlns="http://www.w3.org/2005/xpath-functions">
<string key="content-type">application/xml</string>
<string key="base-uri">file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/tests/nw-base-uri-030.xml</string>
</map>
<map xmlns="http://www.w3.org/2005/xpath-functions">
<string key="content-type">application/xml</string>
</map>
</wrapper>
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 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