<?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:edit/eat:recipe"/>

	<xsl:template match="xweb:x-data" mode="page-title">
		<xsl:value-of select="key('i18n','choose-system.title')"/>
	</xsl:template>
	
	<xsl:template match="xweb:x-data" mode="page-body">
		<div class="intro">
			<xsl:value-of select="key('i18n','choose-system.intro')"/>
		</div>
                
        <form method="post" action="{$web-context}{$ctx/xweb:path}">
			<table class="form">
				<tr>
					<th>
						<xsl:value-of select="key('i18n','recipe.system.displayName')"/>
					</th>
					<td>
						<select name="recipe.system.systemId">
							<xsl:apply-templates select="$aux/*/eat:system"/>
						</select>
					</td>
				</tr>
				<tr>
					<td></td>
					<td>
						<input type="submit" name="_target1" value="{key('i18n','continue.displayName')}"/>
						<xsl:text> </xsl:text>
						<input type="submit" name="_cancel" value="{key('i18n','cancel.displayName')}"/>
					</td>
				</tr>
			</table>
        </form>
    </xsl:template>
    
    <xsl:template match="eat:system">
	    	<option value="{@systemId}">
	    		<xsl:if test="@systemId = $recipe/@systemId">
	    			<xsl:attribute name="selected">selected</xsl:attribute>
	    		</xsl:if>
	    		<xsl:value-of select="."/>
	    	</option>
    </xsl:template>
    
</xsl:stylesheet>
