<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:x="http://pathfinder-xml/AirportAggregatorService.xsd">
	<xsl:output method="html" indent="yes"/>

	<xsl:template match="/">
		<html>
			<head>
				<link rel="stylesheet" type="text/css" href="../pfxml.css"/>
			</head>
			<body>
				<xsl:apply-templates select="x:AirportAggregatorGetDetailOnAirportResponse/x:AggregatedAirport"/>
			</body>
		</html>
	</xsl:template>

	<xsl:template match="x:AirportAggregatorGetDetailOnAirportResponse/x:AggregatedAirport">
		<table width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td class="tablehead">
					<xsl:value-of select="@IATACode"/> - <xsl:value-of select="@City"/> Airport Details
				</td>
				<td class="tablehead" align="right">
					<a href="airport.xsl">Stylesheet</a>
				</td>
			</tr>
		</table>
		<table width="600" cellpadding="0" cellspacing="0">
			<tr>
				<td class="tablerow" width="200">Airport Name</td>
				<td class="tablerow"><xsl:value-of select="@Name"/></td>
			</tr>
			<tr>
				<td class="tablerow">Location</td>
				<td class="tablerow">
					<xsl:value-of select="@Street1"/> <xsl:value-of select="@Street2"/>,
					<xsl:value-of select="@City"/>, <xsl:value-of select="@StateCode"/>,
					<xsl:value-of select="@PostalCode"/>, <xsl:value-of select="@CountryCode"/>
				</td>
			</tr>
			<tr>
				<td class="tablerow">Longitude</td>
				<td class="tablerow"><xsl:value-of select="@Longitude"/></td>
			</tr>
			<tr>
				<td class="tablerow">Latitude</td>
				<td class="tablerow"><xsl:value-of select="@Latitude"/></td>
			</tr>
		</table>
		<br/>
		
		<table width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td class="tablehead">Delay Information</td>
			</tr>
		</table>
		<table width="600" cellpadding="0" cellspacing="0">
			<xsl:apply-templates select="x:GeneralArrivalDelay"/>
			<xsl:apply-templates select="x:GeneralDepartureDelay"/>
			<xsl:apply-templates select="x:GroundDelay"/>
			<xsl:apply-templates select="x:GroundStopDelay"/>
			<xsl:apply-templates select="x:ClosedDelay"/>
		</table>
		<br/>
		
		<xsl:apply-templates select="x:MetarReport"/>
		<br/>
		
		<xsl:apply-templates select="x:WeatherForecast"/>
	</xsl:template>
	
	<xsl:template match="x:GeneralArrivalDelay">
		<tr>
			<td class="tablerow" width="200">General Arrival Delay</td>
			<td class="tablerow"><xsl:value-of select="x:Description"/></td>
		</tr>
	</xsl:template>

	<xsl:template match="x:GeneralDepartureDelay">
		<tr>
			<td class="tablerow" width="200">General Departure Delay</td>
			<td class="tablerow"><xsl:value-of select="x:Description"/></td>
		</tr>
	</xsl:template>
	
	<xsl:template match="x:GroundDelay">
		<tr>
			<td class="tablerow" width="200">Ground Delay</td>
			<td class="tablerow"><xsl:value-of select="x:Description"/></td>
		</tr>
	</xsl:template>
	
	<xsl:template match="x:GroundStopDelay">
		<tr>
			<td class="tablerow" width="200">Ground Stop Delay</td>
			<td class="tablerow"><xsl:value-of select="x:Description"/></td>
		</tr>
	</xsl:template>
	
	<xsl:template match="x:ClosedDelay">
		<tr>
			<td class="tablerow">Closed Delay</td>
			<td class="tablerow"><xsl:value-of select="x:Description"/></td>
		</tr>
	</xsl:template>

	<xsl:template match="x:MetarReport">
		<table width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td colspan="2" class="tablehead">Current Conditions</td>
			</tr>
		</table>
		<table width="600" cellpadding="0" cellspacing="0">
			<tr>
				<td class="tablerow" width="200">Temperature</td>
				<td class="tablerow"><xsl:value-of select="@Temperature"/> degrees F</td>
			</tr>
			<tr>
				<td class="tablerow">Dew Point</td>
				<td class="tablerow"><xsl:value-of select="@DewPoint"/> degrees F</td>
			</tr>
			<tr>
				<td class="tablerow">Barometer</td>
				<td class="tablerow"><xsl:value-of select="@Altimeter"/>"</td>
			</tr>
			<tr>
				<td class="tablerow">Sea Level Pressure</td>
				<td class="tablerow"><xsl:value-of select="@SeaLevelPressure"/>"</td>
			</tr>
			<tr>
				<td class="tablerow">Visibility</td>
				<td class="tablerow"><xsl:value-of select="@Visibility"/>"</td>
			</tr>
			<tr>
				<td class="tablerow">Wind</td>
				<td class="tablerow">Wind direction is <xsl:value-of select="@WindDirection"/>. Speed is <xsl:value-of select="@WindSpeed"/>.</td>
			</tr>
			<tr>
				<td class="tablerow">Sky Conditions</td>
				<td class="tablerow">
					<xsl:for-each select="x:SkyCondition">
						<xsl:value-of select="."/><xsl:text> </xsl:text>
					</xsl:for-each>
				</td>
			</tr>
			<tr>
				<td class="tablerow">Present Conditions</td>
				<td class="tablerow">
					<xsl:for-each select="x:PresentWeatherCondition">
						<xsl:value-of select="."/><xsl:text> </xsl:text>
					</xsl:for-each>
				</td>
			</tr>
			<tr>
				<td class="tablerow">Last Updated</td>
				<td class="tablerow"><xsl:value-of select="@IssueDate"/></td>
			</tr>
		</table>		
	</xsl:template>
	
	<xsl:template match="x:WeatherForecast">
		<table width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td class="tablehead">Extended Weather Forecast</td>
			</tr>
		</table>
		<table width="600" cellpadding="0" cellspacing="0">
			<tr>
				<td class="tablerow" width="200">Forecast Date</td>
				<td class="tablerow"><xsl:value-of select="@Date"/></td>
			</tr>
			<tr>
				<td class="tablerow">For Counties</td>
				<td class="tablerow">
					<xsl:for-each select="x:County">
						<xsl:value-of select="."/><xsl:text> </xsl:text>
					</xsl:for-each>
				</td>
			</tr>
			<tr>
				<td class="tablerow">For Cities</td>
				<td class="tablerow">
					<xsl:for-each select="x:City">
						<xsl:value-of select="."/><xsl:text> </xsl:text>
					</xsl:for-each>
				</td>
			</tr>
		</table>
		
		<br/>
		
		<table width="100%" cellpadding="0" cellspacing="0">
			<xsl:apply-templates select="x:WeatherDayForecast"/>
		</table>
	</xsl:template>
	
	<xsl:template match="x:WeatherDayForecast">	
		<tr>
			<td class="tablerow" width="200"><xsl:value-of select="@Day"/></td>
			<td class="tablerow"><xsl:value-of select="x:Forecast"/></td>
		</tr>			
		<xsl:if test="position() != last()">
			<tr>
				<td class="tablerow" width="200"><hr/></td>
				<td class="tablerow"><hr/></td>
			</tr>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>