<?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 XSLT 2.0 #003</t:title>

<t:pipeline>
<p:declare-step version='1.0' xmlns:p="http://www.w3.org/ns/xproc"
		xmlns:px="http://example.org/ns/pipelines"
		xmlns:c="http://www.w3.org/ns/xproc-step"
		xmlns:cx="http://com.xmlcalabash/ns/extensions"
		xmlns:xs="http://www.w3.org/2001/XMLSchema"
		exclude-inline-prefixes="px c cx xs"
		name="main">
<p:output port="result" sequence="true"/>

<p:identity>
  <p:input port="source">
    <p:inline><doc/></p:inline>
    <p:inline><doc/></p:inline>
    <p:inline><not-doc/></p:inline>
    <p:inline><doc/></p:inline>
  </p:input>
</p:identity>

<p:xslt version="2.0">
  <p:input port="parameters">
    <p:empty/>
  </p:input>
  <p:input port="stylesheet">
<p:inline><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="2.0">

<xsl:template match="/">
  <div>
    <p>
      <xsl:text>There are </xsl:text>
      <xsl:value-of select="count(collection())"/>
      <xsl:text> documents in the default collection.</xsl:text>
    </p>
    <p>
      <xsl:text>Only </xsl:text>
      <xsl:value-of select="count(collection()/*[self::doc])"/>
      <xsl:text> are &lt;doc&gt; documents.</xsl:text>
    </p>
  </div>
</xsl:template>

</xsl:stylesheet></p:inline>
  </p:input>
</p:xslt>

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

<t:output port="result">
<div>
   <p>There are 4 documents in the default collection.</p>
   <p>Only 3 are &lt;doc&gt; documents.</p>
</div>
</t:output>

</t:test>


