<?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">Inputs</xsl:param>
	<xsl:include href="namedtemplates.xsl"/>
	<xsl:template match="configuration">
		<html>
			<head>
				<title>
					<xsl:value-of select="$web_title"/>
				</title>
				<style type="text/css" media="all">@import url(/design.css);</style>
				<!--		                <xsl:element name="meta">
                     <xsl:attribute name="http-equiv">refresh</xsl:attribute>
                     <xsl:attribute name="content"><xsl:value-of select="(user_data/auto_logout_time * 60)+ 5"/>;URL=inputs.py</xsl:attribute>
                </xsl:element>
-->
				<xsl:call-template name="common_imports"/>
			</head>
			<body onload="window.defaultStatus=''; StartFloat();">
				<xsl:call-template name="initROPage">
					<xsl:with-param name="pageName">inputs.py</xsl:with-param>
					<xsl:with-param name="message" select="$message"/>
				</xsl:call-template>
				<div id="displayresults">
					<div id="rows">
						<h1 class="display">Inputs</h1>
						<table>
							<tr class="headerrow">
								<td class="inputscells">Input</td>
								<td class="inputscells">State</td>
								<td class="inputscells">Format</td>
								<td class="inputscells">Mode</td>
								<td class="inputscells">Data Rate</td>
								<td class="inputscells">Fill Rate</td>
								<td class="inputscells">Total Rate</td>
							</tr>
							<xsl:apply-templates mode="dostatus"/>
						</table>
					</div>
				</div>
			</body>
		</html>
	</xsl:template>
	<xsl:template match="status" mode="dostatus">
		<xsl:for-each select="port">
			<tr class="{translate(state, ' ', '')}row">
				<xsl:call-template name="inputRow">
					<xsl:with-param name="index" select="@index"/>
					<xsl:with-param name="format" select="format"/>
				</xsl:call-template>
				<td class="inputscells">
					<xsl:choose>
						<xsl:when test="data_rate">
							<xsl:value-of select="data_rate"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text>0.0</xsl:text>
						</xsl:otherwise>
					</xsl:choose>
				</td>
				<td class="inputscells">
					<xsl:choose>
						<xsl:when test="fill_rate">
							<xsl:value-of select="fill_rate"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text>0.0</xsl:text>
						</xsl:otherwise>
					</xsl:choose>
				</td>
				<td class="inputscells">
					<xsl:choose>
						<xsl:when test="total_rate">
							<xsl:value-of select="total_rate"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text>0.0</xsl:text>
						</xsl:otherwise>
					</xsl:choose>
				</td>
			</tr>
		</xsl:for-each>
	</xsl:template>
	<xsl:template match="text()" mode="dostatus"/>
	<xsl:template name="inputRow">
		<xsl:param name="index"/>
		<xsl:param name="format"/>
		<td class="inputscells">
			<xsl:value-of select="$index"/>
		</td>
		<td class="inputscells">
			<xsl:value-of select="state"/>
		</td>
		<td class="inputscells">
			<xsl:choose>
				<xsl:when test="$format">
					<xsl:value-of select="$format"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>none</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</td>
		<td class="inputscells">
			<xsl:choose>
				<xsl:when test="/configuration/port[@index=$index]/mode = 'CLSM'">
					<xsl:value-of select="/configuration/port[@index=$index]/mode"/>-<xsl:value-of select="/configuration/port[@index=$index]/clsm/group"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="/configuration/port[@index=$index]/mode"/>
				</xsl:otherwise>
			</xsl:choose>
		</td>
		<!--td class="cell">
						<xsl:value-of select="/configuration/port[@index=$index]/redundancy/role"/>
					</td-->
	</xsl:template>
</xsl:stylesheet>
