<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:r="http://nwalsh.com/xmlns/extreme2006/recipes/"
		xmlns:saxon="http://saxon.sf.net/"
		version="2.0">

  <xsl:import-schema namespace="http://nwalsh.com/xmlns/extreme2006/recipes/"
		     schema-location="recipes.xsd"/>

  <xsl:output method="text"/>

  <xsl:template match="/">
    <xsl:variable name="bluefish-recipes"
		  select="for $recipe in r:recipeList/*
		            return for $ingr in $recipe//r:ingredient/r:name
			      return if (contains($ingr, 'Bluefish'))
			             then $recipe
				     else ()"/>

    <xsl:text>There are </xsl:text>
    <xsl:value-of select="count($bluefish-recipes)"/>
    <xsl:text> Bluefish recipes.</xsl:text>
  </xsl:template>

</xsl:stylesheet>
