<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
	<xsl:output method="xml" indent="yes" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
	<xsl:param name="message"/>
	<xsl:param name="pageTitle">MPE</xsl:param>
	<xsl:include href="namedtemplates.xsl"/>
	<xsl:template match="/">
		<html>
			<head>
				<title>
					<xsl:value-of select="$web_title"/>
				</title>
				<xsl:call-template name="common_imports"/>
			</head>
			<body onload="window.defaultStatus=''; StartFloat();">
				<xsl:call-template name="initROPage">
					<xsl:with-param name="pageName">advmpe.py</xsl:with-param>
					<xsl:with-param name="message" select="$message"/>
				</xsl:call-template>
				<div id="displayresults">
					<h1 class="display">MPE</h1>
					<xsl:apply-templates/>
				</div>
			</body>
		</html>
	</xsl:template>
	<xsl:template match="configuration/mpe">
		<div class="row">
			<div class="generalcell">
				Enabled: </div>
			<div class="largegeneralcell">
				<xsl:value-of select="enable"/>
			</div>
		</div>
		<xsl:choose>
			<xsl:when test="enable='Yes'">
				<div class="row">
					<div class="generalcell">Max Rate:</div>
					<div class="largegeneralcell">
						<xsl:value-of select="max_rate"/>
					</div>
				</div>
				<br/>
				<br/>
			</xsl:when>
			<xsl:otherwise/>
		</xsl:choose>
		<xsl:choose>
			<xsl:when test="enable='Yes'">
				<h2>
					<b>Current Routes</b>
				</h2>
				<table class="mpe_display">
					<tr class="row">
						<td class="headerroutecell">Route</td>
						<td class="headerroutecell">Name</td>
						<td class="headerroutecell">IP Address</td>
						<td class="headerroutecell">PID</td>
						<td class="headerroutecell">Max Rate</td>
						<td class="headerroutecell">RX bytes</td>
					</tr>
					<xsl:for-each select="current_routes/route">
						<xsl:variable name="index" select="@index"/>
						<tr class="row">
							<td class="routecell">
								<xsl:value-of select="@index"/>
							</td>
							<td class="routecell">
								<xsl:value-of select="name"/>
							</td>
							<td class="routecell">
								<xsl:value-of select="inet_addr"/>
							</td>
							<td class="routecell">
								<xsl:value-of select="pid"/>
							</td>
							<td class="routecell">
								<xsl:value-of select="max_rate"/>
							</td>
							<td class="routecell">
								<xsl:value-of select="/configuration/status/mpe/active_routes/route[@index=$index]/rx_bytes"/>
							</td>
						</tr>
					</xsl:for-each>
				</table>
			</xsl:when>
			<xsl:otherwise/>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="text()">
	</xsl:template>
</xsl:stylesheet>
