<?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 xquery-006</t:title>

<t:description xmlns="http://www.w3.org/1999/xhtml">
  <p>Tests that the default collection is set properly
  in the static XQuery context.</p>  
</t:description>

<t:input port="source">
  <t:document>
    <document>
      <title>Some Title</title>
      <para>Some paragraph.</para>
    </document>
  </t:document>

  <t:document>
    <document>
      <title>Some Other Title</title>
      <para>Some other paragraph.</para>
    </document>
  </t:document>
</t:input>

<t:pipeline>
  <p:declare-step version='1.0'>
    <p:input port="source" sequence="true"/>
    <p:output port="result"/>
    
    <p:xquery>
      <p:input port="query">
        <p:inline>
          <c:query>
            <![CDATA[<result>{collection()}</result>]]>
          </c:query>
        </p:inline>
      </p:input>
      <p:input port="parameters">
        <p:empty/>
      </p:input>
    </p:xquery>

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

<t:output port="result">
  <result>
    <document>
      <title>Some Title</title>
      <para>Some paragraph.</para>
    </document>
    <document>
      <title>Some Other Title</title>
      <para>Some other paragraph.</para>
    </document>
  </result>
</t:output>

</t:test>


