<?xml version="1.0" encoding="UTF-8"?>
<t:test xmlns:err="http://www.w3.org/ns/xproc-error"
        expected="fail" code="err:XS0008"
        xmlns:t="http://xproc.org/ns/testsuite/3.0">
  <t:info>
    <t:title>message-009</t:title>
    <t:revision-history>
      <t:revision>
        <t:date>2025-08-24</t:date>
        <t:author>
          <t:name>Norm Tovey-Walsh</t:name>
        </t:author>
        <t:description xmlns="http://www.w3.org/1999/xhtml">
          <p>Created test.</p>
        </t:description>
      </t:revision>
    </t:revision-history>
  </t:info>
  <t:description xmlns="http://www.w3.org/1999/xhtml">
    <p>Tests that message on p:when is forbidden.</p>
  </t:description>
  <t:pipeline>
    <p:declare-step version="3.0"
                    xmlns:err="http://www.w3.org/ns/xproc-error"
                    xmlns:cx="http://xmlcalabash.com/ns/extensions"
                    xmlns:s="http://purl.oclc.org/dsdl/schematron"
                    xmlns:p="http://www.w3.org/ns/xproc">
      <p:import href="https://xmlcalabash.com/ext/library/pipeline-messages.xpl"/>
      <p:output port="result"/>

      <p:identity>
        <p:with-input><doc/></p:with-input>
      </p:identity>

      <p:choose name="dep">
        <p:when test="true()" message="Element is {node-name(/*)}">
          <p:identity/>
        </p:when>
      </p:choose>

      <cx:pipeline-messages p:depends="dep" level="info"/>
    </p:declare-step>
  </t:pipeline>
</t:test>
