<?xml-stylesheet type="text/xsl" href="/style/testcase.xsl"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite"
        xmlns:p="http://www.w3.org/ns/xproc"
        xmlns:c="http://www.w3.org/ns/xproc-step"
        xmlns:err="http://www.w3.org/ns/xproc-error">

<t:title>Test exec-007</t:title>

<t:pipeline>
  <p:declare-step version='1.0'>
    <p:output port="result"/>
  
    <p:exec name="exec" command="/bin/cat" args="i-do-not.exist" errors-is-xml="false" wrap-error-lines="true">
      <p:input port="source">
        <p:empty/>
      </p:input>
    </p:exec>

    <p:sink/>

    <p:choose>
      <p:xpath-context>
        <p:pipe step="exec" port="errors"/>
      </p:xpath-context>
      <p:when test="/c:result/c:line[string-length(.) &gt; 0]">
        <p:identity>
          <p:input port="source">
            <p:inline><success/></p:inline>
          </p:input>
        </p:identity>
      </p:when>
      <p:otherwise>
        <p:identity>
          <p:input port="source">
            <p:inline><failure/></p:inline>
          </p:input>
        </p:identity>
      </p:otherwise>
    </p:choose>

  </p:declare-step>
</t:pipeline>

<t:output port="result">
<success/>
</t:output>

</t:test>

