nw-ns-008

Tests for a non-XProc binding for p:. h/t Amanda Galtman.

Test nw-ns-008.xml is expected to pass.

The pipeline


<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.1">
   <p:input port="source">
      <p:inline>1</p:inline>
   </p:input>
   <p:output port="result"/>
   <p:try>
      <p:error>
            <!-- Note: The with-option element re-binds the 'p' prefix
            to a namespace different from the standard XProc one. -->
         <p-alias:with-option xmlns:p="http://my-ns" xmlns:p-alias="http://www.w3.org/ns/xproc" name="code" select="'p:my-error-code'"/>
         <p:with-input>
            <error-document>An error occurred.</error-document>
         </p:with-input>
      </p:error>
      <p:catch>
         <p:identity/>
      </p:catch>
   </p:try>
</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="c" uri="http://www.w3.org/ns/xproc-step"/>
   <s:ns prefix="err" uri="my-ns"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="c:errors">Not an error document</s:assert>
         <s:assert test="count(c:errors/c:error) = 1">Incorrect number of errors reported</s:assert>
      </s:rule>
   </s:pattern>
   <s:pattern>
      <s:rule context="c:error">
         <s:assert test="namespace-uri-from-QName(resolve-QName(@code, .))                                = 'http://my-ns'">Error code is in wrong namespace</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

25 Feb 2026, Norm Tovey-Walsh

Initial commit