Features: webaccess

p:document 004

Tests p:document set document-property 'base-uri' correct: Relative uri in @href: Base uri of p:document to be used.

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:identity>
      <p:with-input>
         <p:document href="test-suite.html"
                     xml:base="https://xproc.org/"/>
      </p:with-input>
   </p:identity>
   <p:cast-content-type content-type="application/xml">
      <p:with-input select="p:document-properties(.)"/>
   </p:cast-content-type>
</p:declare-step>

Result

<map xmlns="http://www.w3.org/2005/xpath-functions"
     xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <string key="x-fastly-request-id">7aa3635512e59d356a5439e8334581a68496c5d5</string>
   <string key="x-proxy-cache">MISS</string>
   <string key="content-type">text/html</string>
   <string key="via">1.1 varnish</string>
   <string key="x-github-request-id">C068:223EF1:ACC190:AE264D:685441A5</string>
   <string key="date">Thu, 19 Jun 2025 18:05:49 GMT</string>
   <string key="x-cache">HIT</string>
   <string key="access-control-allow-origin">*</string>
   <string key="server">GitHub.com</string>
   <string key="last-modified">Fri, 30 May 2025 08:31:17 GMT</string>
   <string key="x-cache-hits">0</string>
   <string key="x-served-by">cache-fra-eddf8230064-FRA</string>
   <string key="accept-ranges">bytes</string>
   <string key="connection">keep-alive</string>
   <string key="age">124</string>
   <string key="vary">Accept-Encoding</string>
   <string key="cache-control">max-age=600</string>
   <string key="x-timer">S1750356349.011503,VS0,VE2</string>
   <string key="base-uri">https://xproc.org/test-suite.html</string>
   <string key="expires">Thu, 19 Jun 2025 17:08:13 GMT</string>
   <string key="etag">W/"68396cd5-958"</string>
</map>

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/ns/xproc" prefix="p"/>
   <s:ns prefix="j"
         uri="http://www.w3.org/2005/xpath-functions"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="j:map">The document root is not map.</s:assert>
         <s:assert test="starts-with(j:map/j:string[@key='content-type']/text(), 'text/html')">Content type is not text/html.</s:assert>
         <s:assert test="j:map/j:string[@key='base-uri']/text() = 'https://xproc.org/test-suite.html'">The base-uri property is not correct.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

14 Oct 2024, Achim Berndzen
Changed test, so an existing resource is resolved.
10 Jun 2021, Achim Berndzen
Added attribute 'queryBinding' to schematron's schema.
18 Nov 2019, Achim Berndzen
Changed test from p:document-properties-document() to p:document-properties()
31 Aug 2019, Achim Berndzen
Change target for http-request to xproc.org.
22 Oct 2018, Norman Walsh
Fixed result document ( c:document-properties, not p:document-properties)
03 Apr 2018, Achim Berndzen
Some new tests.