<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
	<xsl:output method="html" indent="yes"/>
	<xsl:include href="Min.xsl"/>
	<xsl:include href="Style1.xsl"/>

	<xsl:template match="/">

		<!-- Call the cosmetic formatting template -->
		<xsl:call-template name="Style1"/>

			<html><body>
			<xsl:apply-templates/>
			</body></html>
	
	</xsl:template>
	
	
	<xsl:template match="weather">
		<h1>Temperatures for: 01/21/2001 - 01/28/2001</h1>
		<xsl:apply-templates/>
	</xsl:template>
	
	<xsl:template match="temperatures">
		<h2>City:	<xsl:value-of select="@city"/></h2>
		
		<!-- Display Table Headers -->
		<table border="1">
		<tr>
			<th>date</th>
			<th>Temperatue(F)</th>
		</tr>
		
		<!-- Display each temperature for the city as a row in the table -->
		<xsl:for-each select="temperature">
				<tr>
				<td><xsl:value-of select="@date"/></td>
				<td><xsl:value-of select="."/></td>
				</tr>
		</xsl:for-each>

		</table>
		
		
		<!-- Display Call the "Min" template to determine the 
		minimum temperature for the temperature nodes-->
		<xsl:variable name="nMinTemp">
			<xsl:call-template name="Min">
				<xsl:with-param name="list" select=".//temperature"/>
				<xsl:with-param name="nMin" select="'99999'"/>
			</xsl:call-template>
		</xsl:variable>
		
		<!-- Display the minimum temperature calculated by the Min template-->
		<h3>The lowest temperature is: <xsl:value-of select="$nMinTemp"/></h3>
			<br/>
	</xsl:template>
</xsl:stylesheet>
