<?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>Site and Monitor Data</title>
    <STYLE TYPE="text/css">P.breakhere {page-break-before: always}</STYLE>
   </head>
   <center>
    <h2>Site and Monitor Data</h2>
   </center>
   <body>
    <xsl:apply-templates/>
   </body>
  </html>
 </xsl:template>
 <xsl:template match="aqs:FileGenerationPurposeCode">
  <b>File Generation Date:</b>
  <xsl:value-of select="aqs:FileGenerationDateTime"/>
 </xsl:template>
 <xsl:template match="aqs:FacilitySiteList" name="tempSite">
  <hr/>
  <table border="0" width="100%">
   <tr>
    <i>
     <b>Site Information</b>
    </i>
   </tr>
   <tr>
    <td width="33%" valign="top">
     <table width="100%">
      <tr>
       <xsl:for-each select="aqs:SiteIdentifierDetails">
        <tr>
         <xsl:if test="aqs:TribalCode">
          Tribal Code:
          <xsl:value-of select="aqs:TribalCode"/>
         </xsl:if>
        </tr>
        <tr>
         <xsl:if test="aqs:StateCode">
          State Code:
          <xsl:value-of select="aqs:StateCode"/>
         </xsl:if>
        </tr>
        <tr>
         County Code:
         <xsl:value-of select="aqs:CountyCode"/>
        </tr>
        <tr>
         Site:
         <xsl:value-of select="aqs:FacilitySiteIdentifier"/>
        </tr>
       </xsl:for-each>
      </tr>
     </table>
    </td>
    <td width="66%" valign="top">
     <table width="100%">
      <xsl:for-each select="aqs:BasicSiteInformation">
       <tr>
        <td width="50%" valign="top">
         <table width="100%">
          <tr>
           Latitude:
           <xsl:value-of select="aqs:GeographicMonitoringLocation/aqs:LatitudeMeasure"/>
          </tr>
          <tr>
           Longitude:
           <xsl:value-of select="aqs:GeographicMonitoringLocation/aqs:LongitudeMeasure"/>
          </tr>
          <tr>
           Horizontal Datum:
           <xsl:value-of select="aqs:GeographicMonitoringLocation/aqs:HorizontalDatumIdentifier"/>
          </tr>
          <tr>
           Horizontal Accuracy Measure:
           <xsl:value-of select="aqs:GeographicMonitoringLocation/aqs:HorizontalAccuracyMeasure"/>
          </tr>
          <tr>
           Vertical Measure:
           <xsl:value-of select="aqs:GeographicMonitoringLocation/aqs:VerticalMeasure"/>
          </tr>
          <tr>
           Vertical Accuracy:
           <xsl:value-of select="aqs:GeographicMonitoringLocation/aqs:VerticalAccuracyMeasure"/>
          </tr>
          <tr>
           Support Agency Code:
           <xsl:value-of select="aqs:FacilitySiteDetails/aqs:SupportAgencyCode"/>
          </tr>
         </table>
        </td>
        <td width="50%" valign="top">
         <table width="100%">
          <tr>
           Site Established Data:
           <xsl:value-of select="aqs:FacilitySiteDetails/aqs:SiteEstablishedDate"/>
          </tr>
          <tr>
           Site Terminated Data:
           <xsl:value-of select="aqs:FacilitySiteDetails/aqs:SiteTerminatedData"/>
          </tr>
          <tr>
           Met Site Identifier:
           <xsl:value-of select="aqs:MetSiteIdentifier"/>
          </tr>
          <tr>
           Location Setting Identifier:
           <xsl:value-of select="aqs:FacilitySiteDetails/aqs:LocationSettingIdentifier"/>
          </tr>
          <tr>
           Met Site Type:
           <xsl:value-of select="aqs:MetSiteTypeCode"/>
          </tr>
          <tr>
           <xsl:choose>
            <xsl:when test="aqs:OpenPathMonitoringLocation">Open Path Monitor:
                                                            Yes</xsl:when>
            <xsl:otherwise>Open Path Monitor: No</xsl:otherwise>
           </xsl:choose>
          </tr>
          <tr>
           Action Code:
           <xsl:value-of select="aqs:ActionCode"/>
          </tr>
         </table>
        </td>
       </tr>
      </xsl:for-each>
     </table>
    </td>
   </tr>
  </table>
  <xsl:for-each select="aqs:MonitorList">
   <table width="100%">
    <tr>
     <td width="33%" valign="top" rowspan="3">
      <table width="100%">
       <tr align="center">
        <i>
         <b>Monitor Information</b>
        </i>
       </tr>
       <tr>
        Parameter Code:
        <xsl:value-of select="aqs:MonitorIdentifierDetails/aqs:SubstanceIdentifier"/>
       </tr>
       <tr>
        Substance Occurrence Code:
        <xsl:value-of select="aqs:MonitorIdentifierDetails/aqs:SubstanceOccurrenceCode"/>
       </tr>
       <tr>
        Measurement Scale Identifier:
        <xsl:value-of select="aqs:BasicMonitoringInformation/aqs:MeasurementScaleIdentifier"/>
       </tr>
       <tr>
        Monitor Close Date
        <xsl:value-of select="aqs:MonitorIdentifierDetails/aqs:MonitorCloseDate"/>
       </tr>
       <tr>
        Action Code:
        <xsl:value-of select="aqs:BasicMonitoringInformation/aqs:ActionCode"/>
       </tr>
      </table>
     </td>
     <td width="33%" valign="top">
      <table width="100%">
       <tr align="center">
        <i>
         <b>Monitor Type Information</b>
        </i>
       </tr>
       <xsl:choose>
        <xsl:when test="aqs:MonitorTypeInformation">
         <xsl:for-each select="aqs:MonitorTypeInformation">
          <tr>
           <b>
            <xsl:number count="aqs:MonitorTypeInformation" level="single"/>
            .
           </b>
           Monitor Type:
           <xsl:value-of select="aqs:MonitorTypeCode"/>
          </tr>
          <tr>
           Monitor Type Begin Date:
           <xsl:value-of select="aqs:MonitorTypeBeginDate"/>
          </tr>
          <tr>
           Monitor Type End Date:
           <xsl:value-of select="aqs:MonitorTypeEndDate"/>
          </tr>
          <tr>
           Action Code:
           <xsl:value-of select="aqs:ActionCode"/>
          </tr>
         </xsl:for-each>
        </xsl:when>
        <xsl:otherwise>
         <i>NONE</i>
        </xsl:otherwise>
       </xsl:choose>
      </table>
     </td>
     <td width="33%" valign="top">
      <table width="100%">
       <tr align="center">
        <i>
         <b>Monitor Agency Role</b>
        </i>
       </tr>
       <xsl:choose>
        <xsl:when test="aqs:MonitorAgencyRole">
         <xsl:for-each select="aqs:MonitorAgencyRole">
          <tr>
           <b>
            <xsl:number count="aqs:MonitorAgencyRole" level="single"/>
            .
           </b>
           Agency Role Identifier:
           <xsl:value-of select="aqs:AffiliationTypeText"/>
          </tr>
          <tr>
           Agency Code:
           <xsl:value-of select="aqs:AgencyCode"/>
          </tr>
          <tr>
           Agency Role Begin Date:
           <xsl:value-of select="aqs:AffiliationStartDate"/>
          </tr>
          <tr>
           Agency Role End Date:
           <xsl:value-of select="aqs:AffiliationEndDate"/>
          </tr>
          <tr>
           Action Code:
           <xsl:value-of select="aqs:ActionCode"/>
          </tr>
         </xsl:for-each>
        </xsl:when>
        <xsl:otherwise>
         <i>NONE</i>
        </xsl:otherwise>
       </xsl:choose>
      </table>
     </td>
    </tr>
    <tr>
     <td valign="top">
      <table width="100%">
       <tr align="center">
        <i>
         <b>Monitor Objective Information</b>
        </i>
       </tr>
       <xsl:choose>
        <xsl:when test="aqs:MonitorObjectiveInformation">
         <xsl:for-each select="aqs:MonitorObjectiveInformation">
          <tr>
           <b>
            <xsl:number count="aqs:MonitorObjectiveInformation" level="single"/>
            .
           </b>
           Monitor Objective Identifier:
           <xsl:value-of select="aqs:MonitorObjectiveIdentifier"/>
          </tr>
          <xsl:if test="aqs:UrbanAreaRepresentedCode">
           <tr>
            Urban Area Represented:
            <xsl:value-of select="aqs:UrbanAreaRepresentedCode"/>
           </tr>
          </xsl:if>
          <xsl:if test="aqs:MSARepresentedCode">
           <tr>
            MSA Represented:
            <xsl:value-of select="aqs:MSARepresentedCode"/>
           </tr>
          </xsl:if>
          <xsl:if test="aqs:CMSARepresentedCode">
           <tr>
            CMSA Represented:
            <xsl:value-of select="aqs:CMSARepresentedCode"/>
           </tr>
          </xsl:if>
          <xsl:if test="aqs:CBSARepresentedCode">
           <tr>
            CBSA Represented:
            <xsl:value-of select="aqs:CBSARepresentedCode"/>
           </tr>
          </xsl:if>
          <xsl:if test="aqs:CSARepresentedCode">
           <tr>
            CSA Represented:
            <xsl:value-of select="aqs:CSARepresentedCode"/>
           </tr>
          </xsl:if>
          <tr>
           Action Code:
           <xsl:value-of select="aqs:ActionCode"/>
          </tr>
         </xsl:for-each>
        </xsl:when>
        <xsl:otherwise>
         <i>NONE</i>
        </xsl:otherwise>
       </xsl:choose>
      </table>
     </td>
     <td valign="top">
      <table width="100%">
       <tr align="center">
        <i>
         <b>Monitor Sampling Schedule</b>
        </i>
       </tr>
       <xsl:choose>
        <xsl:when test="aqs:MonitorSamplingSchedule">
         <xsl:for-each select="aqs:MonitorSamplingSchedule">
          <tr>
           <b>
            <xsl:number count="aqs:MonitorSamplingSchedule" level="single"/>
            .
           </b>
           Frequency Code:
           <xsl:value-of select="aqs:FrequencyCode"/>
          </tr>
          <tr>
           RCF Begin Date:
           <xsl:value-of select="aqs:RCFBeginDate"/>
          </tr>
          <tr>
           RCF End Date:
           <xsl:value-of select="aqs:RCFEndDate"/>
          </tr>
          <tr>
           RCF January Code:
           <xsl:value-of select="aqs:RCFJanuaryCode"/>
          </tr>
          <tr>
           RCF February Code:
           <xsl:value-of select="aqs:RCFFebruaryCode"/>
          </tr>
          <tr>
           RCF March Code:
           <xsl:value-of select="aqs:RCFMarchCode"/>
          </tr>
          <tr>
           RCF April Code:
           <xsl:value-of select="aqs:RCFAprilCode"/>
          </tr>
          <tr>
           RCF May Code:
           <xsl:value-of select="aqs:RCFMayCode"/>
          </tr>
          <tr>
           RCF June Code:
           <xsl:value-of select="aqs:RCFJuneCode"/>
          </tr>
          <tr>
           RCF July Code:
           <xsl:value-of select="aqs:RCFJulyCode"/>
          </tr>
          <tr>
           RCF August Code:
           <xsl:value-of select="aqs:RCFAugustCode"/>
          </tr>
          <tr>
           RCF September Code:
           <xsl:value-of select="aqs:RCFSeptemberCode"/>
          </tr>
          <tr>
           RCF October Code:
           <xsl:value-of select="aqs:RCFOctober"/>
          </tr>
          <tr>
           RCF November Code:
           <xsl:value-of select="aqs:RCFNovemberCode"/>
          </tr>
          <tr>
           RCF December Code:
           <xsl:value-of select="aqs:RCFDecemberCode"/>
          </tr>
          <tr>
           Action Code:
           <xsl:value-of select="aqs:ActionCode"/>
          </tr>
         </xsl:for-each>
        </xsl:when>
        <xsl:otherwise>
         <i>NONE</i>
        </xsl:otherwise>
       </xsl:choose>
      </table>
     </td>
    </tr>
    <tr>
     <td valign="top">
      <table width="100%">
       <tr align="center">
        <i>
         <b>Monitor Collocation Information</b>
        </i>
       </tr>
       <xsl:choose>
        <xsl:when test="aqs:MonitorCollocationInformation">
         <xsl:for-each select="aqs:MonitorCollocationInformation">
          <tr>
           <b>
            <xsl:number count="aqs:MonitorCollocationInformation"
                        level="single"/>
            .
           </b>
           Collocation Begin Date:
           <xsl:value-of select="CollocationBeginDate"/>
          </tr>
          <tr>
           Collocation End Date:
           <xsl:value-of select="CollocationEndDate"/>
          </tr>
          <tr>
           Primary Monitor Indicator:
           <xsl:value-of select="aqs:PrimaryMonitorIndicator"/>
          </tr>
          <tr>
           Distance to Primary Monitor Measure Value:
           <xsl:value-of select="aqs:PrimaryMonitorDistanceMeasure"/>
          </tr>
          <tr>
           Action Code:
           <xsl:value-of select="aqs:ActionCode"/>
          </tr>
         </xsl:for-each>
        </xsl:when>
        <xsl:otherwise>
         <i>NONE</i>
        </xsl:otherwise>
       </xsl:choose>
      </table>
     </td>
     <td valign="top">
      <table width="100%">
       <tr align="center">
        <i>
         <b>Monitor Protocol</b>
        </i>
       </tr>
       <xsl:for-each select="aqs:MonitorProtocol">
        <tr>
         <b>
          <xsl:number count="aqs:MonitorProtocol"/>
          .
         </b>
         MPID Number:
         <xsl:value-of select="aqs:MonitorObjectiveIdentifier"/>
        </tr>
       </xsl:for-each>
       <xsl:choose>
        <xsl:when test="aqs:TransactionProtocolDetails">
         <xsl:for-each select="aqs:TransactionProtocolDetails">
          <tr>
           DurationCode:
           <xsl:value-of select="aqs:DurationCode"/>
          </tr>
          <tr>
           Frequency Code:
           <xsl:value-of select="aqs:FrequencyCode"/>
          </tr>
          <tr>
           Method Identifier Code:
           <xsl:value-of select="aqs:MethodIdentifierCode"/>
          </tr>
          <tr>
           Measure Unit Code:
           <xsl:value-of select="aqs:MeasureUnitCode"/>
          </tr>
          <tr>
           Alternate MDL:
           <xsl:value-of select="aqs:AlternateMDLValue"/>
          </tr>
          <tr>
           Composite Type Identifier:
           <xsl:value-of select="aqs:CompositeTypeIdentifier"/>
          </tr>
          <tr>
           Action Code:
           <xsl:value-of select="aqs:ActionCode"/>
          </tr>
         </xsl:for-each>
        </xsl:when>
        <xsl:otherwise>
         <i>NONE</i>
        </xsl:otherwise>
       </xsl:choose>
      </table>
     </td>
    </tr>
   </table>
  </xsl:for-each>
  <hr/>
  <P CLASS="breakhere"/>
 </xsl:template>
</xsl:stylesheet>

