If a parse fails, the implementation must indicate this, but it may also provide information about where the processing failed.

<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                version="3.1">
<p:output port="result"/>

<p:ixml fail-on-error="false">
  <p:with-input port="grammar">
    <p:inline content-type="text/plain">
date: s?, day, s, month, (s, year)? .
-s: -" "+ .
day: digit, digit? .
-digit: "0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9".
month: "January"; "February"; "March"; "April";
       "May"; "June"; "July"; "August";
       "September"; "October"; "November"; "December".
year: (digit, digit)?, digit, digit .
    </p:inline>
  </p:with-input>
  <p:with-input port="source">
    <p:inline content-type="text/plain">31 Mumble 2021</p:inline>
  </p:with-input>
</p:ixml>

</p:declare-step>

Here the output might be something like this:

<error xmlns:ixml="http://invisiblexml.org/NS"
       xmlns:ex="http://example.com/NS"
       ixml:state="failed" ex:lastChar="4">
<parse>
month ->  •  M  a  r  c  h
month ->  M  •  a  r  c  h
</parse>
<parse>
month ->  •  M  a  y
month ->  M  •  a  y
</parse>
</error>

In the case of failure, Invisible XML requires that the ixml:state attribute appear on the root element containing the token “failed”. It doesn’t constrain the implementation’s choice of the root element or the content of the document.