<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="config" select="document('AdminConfig.xml')"/>
    <xsl:template match="/SCHEDULE">
        <HTML>
            <HEAD>
                <TITLE>
                    The Schedule Table
                </TITLE>
            </HEAD>
            <BODY STYLE="background-color:white" topmargin="0" leftmargin="0">
			
			<div style="position:absolute;font-size:160;topmargin:120;font-family:Times New Roman;
      z-index:-1">
					<font>
								<xsl:attribute name="color">
									<xsl:value-of select='$config//WATERCOLOR'/>
								</xsl:attribute>
			<xsl:value-of select='$config//WATERCHAR'/>
					</font>
			</div>
                <TABLE BORDER="1" cellpadding="0" cellspacing="0" style="table-layout:fixed" width="100%">
                    <col width="90"></col>
                    <TR >
						<xsl:attribute name="bgcolor">
							<xsl:value-of select='$config//HEDBGCOLOR'/>
						</xsl:attribute>
						<th>
							<font>
								<xsl:attribute name="color">
									<xsl:value-of select='$config//HEDFONTCLR'/>
								</xsl:attribute>
							Date</font>
						</th>
                        <th><font>
								<xsl:attribute name="color">
									<xsl:value-of select='$config//HEDFONTCLR'/>
								</xsl:attribute>
							Starting Time</font></th>
                        <th><font>
								<xsl:attribute name="color">
									<xsl:value-of select='$config//HEDFONTCLR'/>
								</xsl:attribute>
							Ending Time</font></th>
						<th><font>
								<xsl:attribute name="color">
									<xsl:value-of select='$config//HEDFONTCLR'/>
								</xsl:attribute>
							Duration</font></th>
						<th><font>
								<xsl:attribute name="color">
									<xsl:value-of select='$config//HEDFONTCLR'/>
								</xsl:attribute>
							Program Name</font></th>
						<th><font>
								<xsl:attribute name="color">
									<xsl:value-of select='$config//HEDFONTCLR'/>
								</xsl:attribute>
							Rating</font></th>
							<xsl:if test="COMMENTS/@ChannelALL = 'TRUE'">
						<th><font>
								<xsl:attribute name="color">
									<xsl:value-of select='$config//HEDFONTCLR'/>
								</xsl:attribute>
						Channel</font></th>
							</xsl:if>
                    </TR>
                    <xsl:apply-templates/>
                </TABLE>
            </BODY>
        </HTML>
    </xsl:template>
   
    <xsl:template match="ROW">
       <TR onmouseover="this.style.color = 'red'" onmouseout="this.style.color = 'black' ">
			<xsl:if test="position() mod 2 = 0">
       				<xsl:attribute name="bgcolor">
       				<xsl:value-of select='$config//ATDTABGCLR'/>
       				</xsl:attribute>
			</xsl:if>
			<xsl:if test="position() mod 2 = 1">
       				<xsl:attribute name="bgcolor">
       				<xsl:value-of select='$config//DTABGCOLOR'/>
       				</xsl:attribute>
			</xsl:if>
			<TD><xsl:value-of select="@DateValue"/></TD>
			<TD><xsl:value-of select="@start_datetime"/></TD>
			<TD><xsl:value-of select="@end_datetime"/></TD>
			<TD><xsl:value-of select="@air_duration"/></TD>
			<TD>
					<xsl:value-of select="@program_name"/>
			</TD>
			<TD><xsl:value-of select="@content_rating"/></TD>
			<xsl:if test="//COMMENTS/@ChannelALL = 'TRUE'">
				<TD><xsl:value-of select="@channel_name"/></TD>
			</xsl:if>
       </TR>
   </xsl:template>
    <xsl:template match="UNAVAILABLE">
       <TR>
			<TD colspan="6"><font size="5"><xsl:value-of select="@TRUE"/></font></TD>		
       </TR>
   </xsl:template>
   <xsl:template match="COMMENTS">
   <xsl:if test="$config//DEBUGMODE = 'TRUE'">
	   <TR>
	    <TD colspan="6"><P align="center">The following is debug table for the administrator</P>
	    </TD>
	   </TR>
       <TR>
			<TD>Start Date in User Time Zone</TD>
			<TD>Start Time in User Time Zone</TD>
			<TD>SQL interval Based, UTC Start Date/Time</TD>
			<TD>SQL interval Based, UTC End Date/Time</TD>
			<TD>SQL Channel</TD>
			<TD>User Time Zone Offset to UTC</TD>			
       </TR>
       <TR>
			<TD><xsl:value-of select="@CHECK"/></TD>
			<TD><xsl:value-of select="@Test"/></TD>
			<TD><xsl:value-of select="@DateTimeChoose1"/></TD>
			<TD><xsl:value-of select="@DateTimeChoose2"/></TD>
			<TD><xsl:value-of select="@ChannelChoose"/></TD>
			<TD><xsl:value-of select="@ZoneChoose"/></TD>			
       </TR>
     </xsl:if>
   </xsl:template>
</xsl:stylesheet>


