<?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"/>
	
	<!-- layout variables -->
	<xsl:variable name="layout.global.nav.page" select="''"/>
	
	<!-- helper vars -->
	<xsl:variable name="recipe" select="xweb:x-data/xweb:x-model/eat:ui/eat:recipe"/>
	<xsl:variable name="meal" select="xweb:x-data/xweb:x-model/eat:ui/eat:meal"/>

	<xsl:template match="xweb:x-data" mode="page-title">
		<xsl:apply-templates select="$meal" mode="title"/>
	</xsl:template>
	
	<xsl:template match="xweb:x-data" mode="page-body">
		<div class="return-nav">
			<xsl:apply-templates select="$meal" mode="return-nav"/>
		</div>
		
		<table class="view">
			<xsl:apply-templates select="$recipe/eat:ingredient" mode="converted"/>
		</table>
	</xsl:template>
	
	<xsl:template match="eat:meal" mode="title">
		<xsl:value-of select="key('i18n','view-shopList.title')"/>
		<xsl:text> </xsl:text>
		<xsl:value-of select="eat:name"/>
	</xsl:template>
	
	<xsl:template match="eat:meal" mode="return-nav">
		<a class="back">
			<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="key('i18n','back.to')"/>
			<xsl:text> </xsl:text>
			<xsl:value-of select="eat:name"/>
		</a>
	</xsl:template>
    
</xsl:stylesheet>
