Features: webaccess

ab-p-document 043 (AB)

Testing p:document: Redirects must be followed.

Test is expected to pass.

The pipeline

<p:declare-step xmlns:fn="http://www.w3.org/2005/xpath-functions"
                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:option name="WHOST"
             select="'http://localhost:8246'" static="true"/>
   <p:identity>
      <p:with-input>
         <p:document href="{$WHOST}/service/this-is-a"/>
      </p:with-input>
   </p:identity>
   <p:identity>
      <p:with-input>
         <result>
            <prop>{p:document-property(., 'base-uri')}</prop>
            <base>{fn:base-uri(.)}</base>
         </result>
      </p:with-input>
   </p:identity>
</p:declare-step>

Result

<result xmlns:fn="http://www.w3.org/2005/xpath-functions"
        xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <prop>http://apache2/service/this-is-d</prop>
   <base>http://apache2/service/this-is-d</base>
</result>

Schematron checks

<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron"
          xmlns:t="http://xproc.org/ns/testsuite/3.0" queryBinding="xslt2">
   <s:pattern>
      <s:rule context="/">
         <s:assert test="result">The document root is not 'result'.</s:assert>
         <s:assert test="result/prop">Document does not have a child element named 'prop'</s:assert>
         <s:assert test="ends-with(result/prop, '/service/this-is-d')">The text in element 'prop' is not right.</s:assert>
         <s:assert test="result/base">Document does not have a child element named 'base'</s:assert>
         <s:assert test="ends-with(result/base, '/service/this-is-d')">The text in element 'base' is not right.</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

23 May 2025, Norm Tovey-Walsh
Added static options for web server host and port.
17 Oct 2024, Norm Tovey-Walsh
Fixed typo.
14 Oct 2024, Achim Berndzen
Initial check in