<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
	<xsl:template match="/">
		<script language="javascript">
			var bRefresh = false;
		</script>

		<xsl:for-each select="/ReportList/Report">
			<xsl:apply-templates select=".">
				<xsl:with-param name="pos" select="position()"/>
			</xsl:apply-templates>
			<xsl:if test="@status = 'PRT_IN_PROGRESS'">
				<script>bRefresh = true;</script>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<xsl:template match="Report">
		<xsl:param name="pos"/>
		<xsl:variable name="localization" select="document('localization.xml')/strings/group[@name='report']//string"/>
		<xsl:variable name="row_toggle_style">
			<xsl:choose>
				<xsl:when test="1 = ($pos mod 2)">data1b</xsl:when>
				<xsl:otherwise>data2b</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<tr><td><xsl:attribute name="class"><xsl:value-of select="$row_toggle_style"/></xsl:attribute>
				<input type="checkbox" name="chkItems" onclick="jsItems_Click(fmMain.chkSelectAll, fmMain.chkItems, true);">
				<xsl:attribute name="value"><xsl:value-of select="@report_id"/></xsl:attribute></input></td>

			<td><xsl:attribute name="class"><xsl:value-of select="$row_toggle_style"/></xsl:attribute>
				<xsl:value-of select="@template_name"/></td>

			<td><xsl:attribute name="class"><xsl:value-of select="$row_toggle_style"/></xsl:attribute>
				<xsl:value-of select="@generate_time"/></td>

			<td><xsl:attribute name="class"><xsl:value-of select="$row_toggle_style"/></xsl:attribute>
				<xsl:choose>
					<xsl:when test="@status != 'PRT_IN_PROGRESS'">
						<a><xsl:attribute name="href">javascript:jsViewItem('<xsl:value-of select="@template_id"/>', '<xsl:value-of select="@report_id"/>');</xsl:attribute>
						<xsl:value-of select="$localization[@name=current()/@status]"/></a>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$localization[@name=current()/@status]"/>
					</xsl:otherwise>
				</xsl:choose></td></tr>
	</xsl:template>

</xsl:stylesheet>
