<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:eat="http://msqr.us/xsd/ieat"
	xmlns:xweb="http://msqr.us/xsd/jaxb-web"
	exclude-result-prefixes="eat xweb">
	
    <!-- imports -->
	<xsl:import href="tmpl/default-layout.xsl"/>
	<xsl:import href="tmpl/display-recipe.xsl"/>
	
	<!-- layout variables -->
	<xsl:variable name="layout.global.nav.page" select="'meals'"/>
	
	
	<xsl:template match="xweb:x-data" mode="page-title">
		<xsl:value-of select="key('i18n','meals.home.title')"/>
	</xsl:template>
	
	<xsl:template match="xweb:x-data" mode="page-head-content">
		<link rel="stylesheet" type="text/css" href="{$web-context}/css/recipe-forms.css" media="screen"/>
	</xsl:template>
	
	<xsl:template match="xweb:x-data" mode="action-links">
		<a href="{$web-context}/addMeal.do" title="{key('i18n','link.meal.add.title')}">
			<xsl:value-of select="key('i18n','link.meal.add')"/>
		</a>
	</xsl:template>
	
	<xsl:template match="xweb:x-data" mode="page-body">
		<p><xsl:value-of select="key('i18n','meals.home.intro')" disable-output-escaping="yes"/></p>
		
		<xsl:if test="xweb:x-model/eat:ui/eat:meal">
			<ol>
				<xsl:apply-templates select="xweb:x-model/eat:ui/eat:meal" mode="list"/>
			</ol>
		</xsl:if>
	</xsl:template>
	
	<xsl:template match="eat:meal" mode="list">
		<li>
			<a class="go">
				<xsl:attribute name="href">
					<xsl:value-of select="$web-context"/>
					<xsl:text>/meal.do?mealId=</xsl:text>
					<xsl:value-of select="@mealId"/>
				</xsl:attribute>
				<xsl:value-of select="eat:name"/>
			</a>
		</li>
	</xsl:template>

</xsl:stylesheet>