nw-ns-008

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

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.1">
   <p:input port="source">
      <p:inline>1</p:inline>
   </p:input>
   <p:output port="result"/>
   <p:try>
      <p:error>
         <p-alias:with-option 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>

Result

<c:errors xmlns:_1="http://my-ns"
          xmlns:c="http://www.w3.org/ns/xproc-step"
          xmlns:cx="http://xmlcalabash.com/ns/extensions"
          xmlns:fnerr="http://www.w3.org/2005/xqt-errors" xmlns:p="http://www.w3.org/ns/xproc"
          xmlns:t="http://xproc.org/ns/testsuite/3.0">
   <c:error name="!error" type="p:error"
            code="_1:my-error-code"
            href="file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/tests/nw-ns-008.xml" line="30" column="18">
      <cx:input-location href="file:/woodpecker/src/codeberg.org/xmlcalabash/xmlcalabash3/tests/3.0-test-suite/test-suite/tests/nw-ns-008.xml"/>
      <cx:message>(no message for error)</cx:message>
      <error-document>An error occurred.</error-document>
      <cx:stack-trace>
         <cx:stack-frame type="p:error" name="!error"/>
         <cx:stack-frame type="p:group" name="!group"/>
      </cx:stack-trace>
   </c:error>
</c:errors>

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="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