<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aqs="http://www.exchangenetwork.net/schema/AQS/Submission/2">
	<xsl:output method="html"/>
	<xsl:template match="/">
		<html>
			<head>
				<title>Raw Data Report</title>

<!-- #EndEditable -->

<STYLE TYPE="text/css">
     P.breakhere {page-break-before: always}
</STYLE>
			</head>
			<center>
				<hr/>
				<h2>Raw Data Report</h2>
				<hr/>
			</center>
			<body>
				<xsl:apply-templates/>
			</body>
		</html>
	</xsl:template>
	<xsl:template match="aqs:FileGenerationPurposeCode">
		File Generation Date: <xsl:value-of select="aqs:FileGenerationDateTime"/>
	</xsl:template>
	<xsl:template match="aqs:FacilitySiteList" name="tempSite">
		<xsl:variable name="varTribal" select="aqs:SiteIdentifierDetails/aqs:TribalCode"/>
		<xsl:variable name="varState" select="aqs:SiteIdentifierDetails/aqs:StateCode"/>
		<xsl:variable name="varCounty" select="aqs:SiteIdentifierDetails/aqs:CountyCode|aqsSiteIdentifierDetails/aqs:TribalCode"/>
		<xsl:variable name="varSite" select="aqs:SiteIdentifierDetails/aqs:FacilitySiteIdentifier"/>
		<table width="100%">
			<xsl:for-each select="aqs:MonitorList">
				<xsl:variable name="varSubIdent" select="aqs:MonitorIdentifierDetails/aqs:SubstanceIdentifier"/>
				<xsl:variable name="varSOC" select="aqs:MonitorIdentifierDetails/aqs:SubstanceOccurrenceCode"/>
				<xsl:for-each select="aqs:RawDataList">
					<xsl:variable name="varDuration" select="aqs:TransactionProtocolDetails/aqs:DurationCode"/>
					<xsl:variable name="varFrequency" select="aqs:TransactionProtocolDetails/aqs:FrequencyCode"/>
					<xsl:variable name="varMethod" select="aqs:TransactionProtocolDetails/aqs:MethodIdentifierCode"/>
					<xsl:variable name="varUnit" select="aqs:TransactionProtocolDetails/aqs:MeasureUnitCode"/>
					<tr>
						<td>
							<b>
								<font size="1">Tribe Code</font>
							</b>
						</td>
						<td>
							<b>
								<font size="1">State Code</font>
							</b>
						</td>
						<td>
							<b>
								<font size="1">County Code</font>
							</b>
						</td>
						<td>
							<b>
								<font size="1">Site</font>
							</b>
						</td>
						<td>
							<b>
								<font size="1">Sub Code</font>
							</b>
						</td>
						<td>
							<b>
								<font size="1">SOC</font>
							</b>
						</td>
						<td>
							<b>
								<font size="1">Dur Code</font>
							</b>
						</td>
						<td>
							<b>
								<font size="1">Freq Code</font>
							</b>
						</td>
						<td>
							<b>
								<font size="1">Meth Code</font>
							</b>
						</td>
						<td>
							<b>
								<font size="1">Unit Code</font>
							</b>
						</td>
						<td>
							<b>
								<font size="1">Date</font>
							</b>
						</td>
						<td>
							<b>
								<font size="1">Time</font>
							</b>
						</td>
						<td>
							<b>
								<font size="1">Sample Value</font>
							</b>
						</td>
						<td>
							<b>
								<font size="1">Uncertainty Value</font>
							</b>
						</td>
						<td>
							<b>
								<font size="1">Null Data Code</font>
							</b>
						</td>
						<td>
							<b>
								<font size="1">Qualifier Code</font>
							</b>
						</td>
						<td>
							<b>
								<font size="1">Action Indicator</font>
							</b>
						</td>
					</tr>
					<xsl:for-each select="aqs:RawResults">
						<tr>
							<xsl:choose>
								<xsl:when test="$varTribal">
									<td>
										<font size="1">
											<xsl:value-of select="$varTribal"/>
										</font>
									</td>
								</xsl:when>
								<xsl:otherwise>
									<td>
										<font size="1">-</font>
									</td>
								</xsl:otherwise>
							</xsl:choose>
							<xsl:choose>
								<xsl:when test="$varState">
									<td>
										<font size="1">
											<xsl:value-of select="$varState"/>
										</font>
									</td>
								</xsl:when>
								<xsl:otherwise>
									<td>
										<font size="1">-</font>
									</td>
								</xsl:otherwise>
							</xsl:choose>
							<td>
								<font size="1">
									<xsl:value-of select="$varCounty"/>
								</font>
							</td>
							<td>
								<font size="1">
									<xsl:value-of select="$varSite"/>
								</font>
							</td>
							<td>
								<font size="1">
									<xsl:value-of select="$varSubIdent"/>
								</font>
							</td>
							<td>
								<font size="1">
									<xsl:value-of select="$varSOC"/>
								</font>
							</td>
							<td>
								<font size="1">
									<xsl:value-of select="$varDuration"/>
								</font>
							</td>
							<td>
								<font size="1">
									<xsl:value-of select="$varFrequency"/>
								</font>
							</td>
							<td>
								<font size="1">
									<xsl:value-of select="$varMethod"/>
								</font>
							</td>
							<td>
								<font size="1">
									<xsl:value-of select="$varUnit"/>
								</font>
							</td>
							<td>
								<font size="1">
									<xsl:value-of select="aqs:SampleCollectionStartDate"/>
								</font>
							</td>
							<td>
								<font size="1">
									<xsl:value-of select="aqs:SampleCollectionStartTime"/>
								</font>
							</td>
							<td>
								<font size="1">
									<xsl:value-of select="aqs:RawValueDetails/aqs:MeasureValue"/>
								</font>
							</td>
							<td>
								<font size="1">
									<xsl:value-of select="aqs:RawValueDetails/aqs:UncertaintyValue"/>
								</font>
							</td>
							<td>
								<font size="1">
									<xsl:value-of select="aqs:RawValueDetails/aqs:NullDataCode"/>
								</font>
							</td>
							<td>
								<font size="1">
									<xsl:value-of select="aqs:RawValueDetails/aqs:ResultQualifierCode"/>
								</font>
							</td>
							<td>
								<font size="1">
									<xsl:value-of select="aqs:ActionCode"/>
								</font>
							</td>
						</tr>
					</xsl:for-each>
				</xsl:for-each>
			</xsl:for-each>
		</table>
		<hr/>
		<P CLASS="breakhere"/>
	</xsl:template>
</xsl:stylesheet>
