<?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:variable name="localization"      select="document('localization.xml')/strings/group[@name='report']//string"/>
	
	<xsl:template match="/">
		<xsl:for-each select="/ReportTemplateList//Template">
			<xsl:apply-templates select=".">
				<xsl:with-param name="pos"><xsl:value-of select="position()"/></xsl:with-param>
			</xsl:apply-templates>
		</xsl:for-each>
	</xsl:template>	

	<xsl:template match="Template">
		<xsl:param name="pos"/>
		<xsl:variable name="row_toggle_style">
			<xsl:choose>
				<xsl:when test="1 = ($pos mod 2)">data1</xsl:when>
				<xsl:otherwise>data2</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<tr><td>
				<xsl:attribute name="class"><xsl:value-of select="$row_toggle_style"/>b</xsl:attribute>
				<input type="checkbox" name="chkItems" onclick="jsItems_Click(fmMain.chkSelectAll, fmMain.chkItems, true);">
					<xsl:attribute name="value"><xsl:value-of select="@id"/></xsl:attribute>
				</input></td>
			<td>
				<xsl:attribute name="class"><xsl:value-of select="$row_toggle_style"/>b</xsl:attribute>
				<a><xsl:attribute name="href">javascript:jsEditItem("<xsl:value-of select="@id"/>");</xsl:attribute>
				<xsl:value-of select="@name"/></a></td>
			<td>
				<xsl:attribute name="class"><xsl:value-of select="$row_toggle_style"/>b</xsl:attribute>
				<xsl:value-of select="$localization[@name=current()/@frequency]"/></td>
			<td>
				<xsl:attribute name="class"><xsl:value-of select="$row_toggle_style"/>b</xsl:attribute>
				<a><xsl:attribute name="href">javascript:jsListItem('<xsl:value-of select="@id"/>');</xsl:attribute>
				<xsl:value-of select="$localization[@name='list_report']"/></a></td>
			<td align="center">
				<xsl:attribute name="class"><xsl:value-of select="$row_toggle_style"/></xsl:attribute>
				<xsl:apply-templates select="@enable"/></td></tr>
	</xsl:template>

	<xsl:template match="@enable">
		<a>
			<xsl:attribute name="href">javascript:jsSetToggleEnable('<xsl:value-of select="../@id"/>');</xsl:attribute>
			<xsl:element name="img">
				<xsl:attribute name="src">
					<xsl:choose>
						<xsl:when test=". = 'true'">images/icon_enabled.gif</xsl:when>
						<xsl:otherwise>images/icon_disabled.gif</xsl:otherwise>	
					</xsl:choose>
				</xsl:attribute>
        <xsl:attribute name="class">vAlignMid</xsl:attribute>
			</xsl:element>
		</a>
	</xsl:template>
	
</xsl:stylesheet>
