<?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 p:namespaces #009</t:title>

<t:description xmlns="http://www.w3.org/1999/xhtml">                                                              
  <p>Tests the following rule from the section 5.7.5 of the XProc
  specification: "If the select attribute was used to specify the
  value and it evaluated to a node-set, then the in-scope
  namespaces from the first node in the selected node-set
  (or, if it's not an element, its parent) are used."</p>
</t:description>     


<t:input port="source">
<doc xmlns:h="http://www.w3.org/1999/xhtml"/>
</t:input>

<t:pipeline>
<p:pipeline version="1.0" name="pipeline">

<p:variable name="irrelevant" select="/not-there"/>

<p:try>
  <p:group>
    <p:delete>
      <p:with-option name="match" select="'h:del'">
        <p:namespaces binding="irrelevant"/>
      </p:with-option>
      <p:input port="source">
        <p:inline>
          <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
              <title>Some title</title>
            </head>
            <body>
              <h1>Some title</h1>
              <p>Some <del>deleted</del>text.</p>
            </body>
          </html>
        </p:inline>
      </p:input>
    </p:delete>
  </p:group>
  <p:catch>
    <p:identity>
      <p:input port="source">
        <p:inline>
          <message>Catch caught XPath failure.</message>
        </p:inline>
      </p:input>
    </p:identity>
  </p:catch>
</p:try>

</p:pipeline>

</t:pipeline>

<t:output port="result">
    <message>Catch caught XPath failure.</message>
</t:output>

</t:test>

