<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet 
	version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
	xmlns:witsml="http://www.witsml.org/schemas/130reg">
<xsl:output method="html" />
<xsl:template match="/">

<!-- This template assumes that: 
	1) There is only one wellbore per well. 
	2) A wellDatum is the default for all elevations and depths and it is referenced to a sea level wellDatum.
	3) There is only one regulatoryDocument with agencyForm='CalWIMS'
-->

<!-- Changes: 
	1) Map "Estimated Total Depth" to mdPlanned instead of tvdPlanned.
-->

	<html>
	<head>
		<title>
			WITSML Regulatory - CalWIMS view
		</title>
		<link rel='stylesheet' href='../stylesheets/witsml.css' type='text/css' />
	</head>
	<body>
	<H1>CalWIMS</H1>
	<xsl:for-each select="witsml:WITSMLRegulatory/witsml:wellSet/witsml:well">
		<xsl:for-each select="witsml:regulatoryDocumentSet/witsml:regulatoryDocument">
			<xsl:if test="witsml:agencyForm = 'CalWIMS'">
				<xsl:choose>
					<xsl:when test="witsml:type='drill new well'">
						<xsl:call-template name="newWell"/>
					</xsl:when>
					<xsl:when test="witsml:type='redrill'">
						<xsl:call-template name="redrill"/>
					</xsl:when>
					<xsl:when test="witsml:type='Rework Well'">
						<xsl:call-template name="rework"/>
					</xsl:when>
					<xsl:when test="witsml:type='Abandon Well'">
						<xsl:call-template name="abandon"/>
					</xsl:when>
				</xsl:choose>
			</xsl:if>
		</xsl:for-each>
	</xsl:for-each>
	</body>
	</html>
	</xsl:template>

<!--   =======================NOTICES====================================   -->

	<xsl:template name="abandon">
		<table border="0" width="100%">
			<tr>
				<td align="left"><b>Notice Of Intention To Abandon</b></td>
				<td align="center"><b><xsl:value-of select="../../witsml:generalInformation/witsml:operator"/></b></td>
				<td align="right"><b>Date:<xsl:value-of select="witsml:submittalDate"/></b></td>
			</tr>
			<tr>
				<td colspan="3"><small>In compliance with Section 3203, Public resources Code, notice is hereby given 
				that it is our intention to commence drilling the following well.</small></td>
			</tr>
		</table>
		<P> </P>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="CEQA"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="confidential"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="wellLocation"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="surfaceLease"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="mineralRights"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="wellProperties">
			<xsl:with-param name="formType">redrill</xsl:with-param>
		</xsl:apply-templates>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="criticalWell"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="wellElevation"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="usageType"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="directional"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="proposedBorehole"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="casingString"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="casingCement"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="perforation"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="plug"/>
		<!--
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="latest"/>
		-->
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="dryHole"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="show"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="stratigraphic"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="contact"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="LeadAgency"/>
	</xsl:template>

	<xsl:template name="rework">
		<table border="0" width="100%">
			<tr>
				<td align="left"><b>Notice Of Intention To Rework</b></td>
				<td align="center"><b><xsl:value-of select="../../witsml:generalInformation/witsml:operator"/></b></td>
				<td align="right"><b>Date:<xsl:value-of select="witsml:submittalDate"/></b></td>
			</tr>
			<tr>
				<td colspan="3"><small>In compliance with Section 3203, Public resources Code, notice is hereby given 
				that it is our intention to commence drilling the following well.</small></td>
			</tr>
		</table>
		<P> </P>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="CEQA"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="confidential"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="wellLocation"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="surfaceLease"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="mineralRights"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="wellProperties">
			<xsl:with-param name="formType">redrill</xsl:with-param>
		</xsl:apply-templates>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="criticalWell"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="wellElevation"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="usageType"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="directional"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="proposedBorehole"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="casingString"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="casingCement"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="perforation"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="plug"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="latest"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="contact"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="LeadAgency"/>
	</xsl:template>

	<xsl:template name="redrill">
		<table border="0" width="100%">
			<tr>
				<td align="left"><b>Notice Of Intention To Redrill</b></td>
				<td align="center"><b><xsl:value-of select="../../witsml:generalInformation/witsml:operator"/></b></td>
				<td align="right"><b>Date:<xsl:value-of select="witsml:submittalDate"/></b></td>
			</tr>
			<tr>
				<td colspan="3"><small>In compliance with Section 3203, Public resources Code, notice is hereby given 
				that it is our intention to commence drilling the following well.</small></td>
			</tr>
		</table>
		<P> </P>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="CEQA"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="confidential"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="wellLocation"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="surfaceLease"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="mineralRights"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="wellProperties">
			<xsl:with-param name="formType">redrill</xsl:with-param>
		</xsl:apply-templates>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="criticalWell"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="wellElevation"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="usageType"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="directional"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="proposedBorehole"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="casingString"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="casingCement"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="perforation"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="plug"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="latest"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="contact"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="LeadAgency"/>
	</xsl:template>

	<xsl:template name="newWell">
		<table border="0" width="100%">
			<tr>
				<td align="left"><b>Notice Of Intention To Drill New Well</b></td>
				<td align="center"><b><xsl:value-of select="../../witsml:generalInformation/witsml:operator"/></b></td>
				<td align="right"><b>Date:<xsl:value-of select="witsml:submittalDate"/></b></td>
			</tr>
			<tr>
				<td colspan="3"><small>In compliance with Section 3203, Public resources Code, notice is hereby given 
				that it is our intention to commence drilling the following well.</small></td>
			</tr>
		</table>
		<P> </P>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="CEQA"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="confidential"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="wellLocation"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="surfaceLease"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="mineralRights"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="wellProperties">
			<xsl:with-param name="newWell">redrill</xsl:with-param>
		</xsl:apply-templates>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="criticalWell"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="wellElevation"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="usageType"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="directional"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="proposedBorehole"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="casingString"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="casingCement"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="contact"/>
		<xsl:apply-templates select="../../witsml:generalInformation"  mode="LeadAgency"/>
	</xsl:template>

<!--   =======================NOTICE COMPONENTS====================================   -->

	<xsl:template match="witsml:generalInformation" mode="stratigraphic">
		<table border="1" width="90%">
			<tr>
				<th align="left" colspan="3" class='tableheader'>WELL STRATIGRAPHIC MARKER</th>
			</tr>
			<tr>
				<th>Name</th>
				<th>Top True Vertical Depth</th>
				<th>Existence</th>
			</tr>
			<xsl:for-each select="../witsml:wellboreSet/witsml:wellbore/witsml:formationMarkerSet/witsml:formationMarker">
				<tr>
					<td>
						<b>
							<xsl:value-of select="witsml:nameFormation"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:tvdLogSample"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:tvdLogSample/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:choose>
								<xsl:when test="witsml:itemState"> <!-- formationMarker -->
									<xsl:value-of select="witsml:itemState"/>
								</xsl:when>
								<xsl:when test="../../witsml:generalInformation/witsml:itemState"> <!-- wellbore -->
									<xsl:value-of select="../witsml:generalInformation/witsml:itemState"/>
								</xsl:when>
								<xsl:when test="../../../../witsml:generalInformation/witsml:itemState"> <!-- well -->
									<xsl:value-of select="../../../../witsml:generalInformation/witsml:itemState"/>
								</xsl:when>
								<xsl:otherwise>
									Actual
								</xsl:otherwise>
							</xsl:choose>
						</b>
					</td>
				</tr>
			</xsl:for-each>
		</table>
		<P> </P>
	</xsl:template>


	<xsl:template match="witsml:generalInformation" mode="show">
		<table border="1" width="90%">
			<tr>
				<th align="left" colspan="3" class='tableheader'>OIL AND GAS SHOW</th>
			</tr>
			<tr>
				<th>Top True Vertical Depth</th>
				<th>Bottom True Vertical Depth</th>
				<th>Existence</th>
			</tr>
			<xsl:for-each select="../witsml:wellboreSet/witsml:wellbore/witsml:wellboreIntervalSet/witsml:classifiedInterval">
				<xsl:sort data-type="number" select="witsml:tvdTop"/>
				<xsl:if test="witsml:classification/witsml:namingSystem = 'CalWIMS classsification'">
					<xsl:if test="witsml:classification/witsml:class = 'OilAndGasShow'">
						<tr>
							<td>
								<b>
									<xsl:value-of select="witsml:tvdTop"/>
									<xsl:text> </xsl:text>
									<xsl:value-of select="witsml:tvdTop/@uom"/>
								</b>
							</td>
							<td>
								<b>
									<xsl:value-of select="witsml:tvdBottom"/>
									<xsl:text> </xsl:text>
									<xsl:value-of select="witsml:tvdBottom/@uom"/>
								</b>
							</td>
							<td>
								<b>
									<xsl:choose>
										<xsl:when test="witsml:itemState"> <!-- classifiedInterval -->
											<xsl:value-of select="witsml:itemState"/>
										</xsl:when>
										<xsl:when test="../../witsml:generalInformation/witsml:itemState"> <!-- wellbore -->
											<xsl:value-of select="../../witsml:generalInformation/witsml:itemState"/>
										</xsl:when>
										<xsl:when test="../../../../witsml:generalInformation/witsml:itemState"> <!-- well -->
											<xsl:value-of select="../../../../witsml:generalInformation/witsml:itemState"/>
										</xsl:when>
										<xsl:otherwise>
											Actual
										</xsl:otherwise>
									</xsl:choose>
								</b>
							</td>
						</tr>
					</xsl:if>
				</xsl:if>
			</xsl:for-each>
		</table>
		<P> </P>
	</xsl:template>


	<xsl:template match="witsml:generalInformation" mode="dryHole">
		<table border="1" width="90%">
			<tr>
				<th align="left" colspan="4" class='tableheader'>WELL DRY HOLE</th>
			</tr>
			<tr>
				<th>True Vertical Depth</th>
				<th>Geologic Age</th>
				<th>Geologic Formation</th>
				<th>Existence</th>
			</tr>
			<xsl:for-each select="witsml:classification">
				<xsl:if test="witsml:namingSystem = 'CalWIMS classification'">
					<xsl:if test="witsml:class = 'DryHole'">
						<xsl:call-template name="formation"/>
					</xsl:if>
				</xsl:if>
			</xsl:for-each>
		</table>
		<P> </P>
	</xsl:template>
	<xsl:template name="formation">
		<xsl:for-each select="../../witsml:wellboreSet/witsml:wellbore/witsml:formationMarkerSet/witsml:formationMarker">
			<xsl:if test="(witsml:mdTopSample + witsml:thicknessApparent) = ../../witsml:generalInformation/witsml:mdCurrent">
				<tr>
					<td>
						<b>
							<xsl:value-of select="../../witsml:generalInformation/witsml:tvdCurrent"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="../../witsml:generalInformation/witsml:tvdCurrent/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:chronostratigraphic"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:nameFormation"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:choose>
								<xsl:when test="witsml:itemState"> <!-- formationMarker -->
									<xsl:value-of select="witsml:itemState"/>
								</xsl:when>
								<xsl:when test="../../witsml:generalInformation/witsml:itemState"> <!-- wellbore -->
									<xsl:value-of select="../witsml:generalInformation/witsml:itemState"/>
								</xsl:when>
								<xsl:when test="../../../../witsml:generalInformation/witsml:itemState"> <!-- well -->
									<xsl:value-of select="../../../../witsml:generalInformation/witsml:itemState"/>
								</xsl:when>
								<xsl:otherwise>
									Actual
								</xsl:otherwise>
							</xsl:choose>
						</b>
					</td>
				</tr>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>


	<xsl:template match="witsml:generalInformation" mode="latest">
		<table border="1" width="90%">
			<tr>
				<th align="left" colspan="4" class='tableheader'>LATEST PRODUCTION</th>
			</tr>
			<tr>
				<th>Gas Rate</th>
				<th>Oil Rate</th>
				<th>Water Rate</th>
				<th>Latest Production Date</th>
			</tr>
			<tr>
				<td>
					<b>
						<xsl:value-of select="witsml:latestProductionInjection/witsml:productionGasRate"/>
						<xsl:text> </xsl:text>
						<xsl:value-of select="witsml:latestProductionInjection/witsml:productionGasRate/@uom"/>
					</b>
				</td>
				<td>
					<b>
						<xsl:value-of select="witsml:latestProductionInjection/witsml:productionOilRate"/>
						<xsl:text> </xsl:text>
						<xsl:value-of select="witsml:latestProductionInjection/witsml:productionOilRate/@uom"/>
					</b>
				</td>
				<td>
					<b>
						<xsl:value-of select="witsml:latestProductionInjection/witsml:productionWaterRate"/>
						<xsl:text> </xsl:text>
						<xsl:value-of select="witsml:latestProductionInjection/witsml:productionWaterRate/@uom"/>
					</b>
				</td>
				<td>
					<b>
						<xsl:value-of select="witsml:latestProductionInjection/witsml:productionDate"/>
					</b>
				</td>
			</tr>
		</table>
		<P> </P>
		<table border="1" width="90%">
			<tr>
				<th align="left" colspan="4" class='tableheader'>LATEST INJECTION</th>
			</tr>
			<tr>
				<th>Gas Rate</th>
				<th>Oil Rate</th>
				<th>Water Rate</th>
				<th>Latest Injection Date</th>
			</tr>
			<tr>
				<td>
					<b>
						<xsl:value-of select="witsml:latestProductionInjection/witsml:injectionGasRate"/>
						<xsl:text> </xsl:text>
						<xsl:value-of select="witsml:latestProductionInjection/witsml:injectionGasRate/@uom"/>
					</b>
				</td>
				<td>
					<b>
						<xsl:value-of select="witsml:latestProductionInjection/witsml:injectionnOilRate"/>
						<xsl:text> </xsl:text>
						<xsl:value-of select="witsml:latestProductionInjection/witsml:injectionOilRate/@uom"/>
					</b>
				</td>
				<td>
					<b>
						<xsl:value-of select="witsml:latestProductionInjection/witsml:injectionWaterRate"/>
						<xsl:text> </xsl:text>
						<xsl:value-of select="witsml:latestProductionInjection/witsml:injectionWaterRate/@uom"/>
					</b>
				</td>
				<td>
					<b>
						<xsl:value-of select="witsml:latestProductionInjection/witsml:injectionDate"/>
					</b>
				</td>
			</tr>
		</table>
		<P> </P>
	</xsl:template>

	<xsl:template match="witsml:generalInformation" mode="plug">
		<table border="1" width="90%">
			<tr>
				<th align="left" colspan="6" class='tableheader'>WELL CASING PLUGS</th>
			</tr>
			<tr>
				<th>Top Depth</th>
				<th>Bottom Depth</th>
				<th>Volume</th>
				<th>API Cement Class</th>
				<th>Casing Type Plug</th>
				<th>Existence</th>
			</tr>
			<xsl:for-each select="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:casingPlugSummary">
				<xsl:sort data-type="number" select="witsml:mdTop"/>
				<tr>
					<td>
						<b>
							<xsl:value-of select="witsml:mdTop"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:mdTop/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:mdBottom"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:mdBottom/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:volume"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:volume/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:APICementClass"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:plugType"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:choose>
								<xsl:when test="witsml:itemState"> <!-- casingPlugSummary -->
									<xsl:value-of select="witsml:itemState"/>
								</xsl:when>
								<xsl:when test="../witsml:generalInformation/witsml:itemState"> <!-- wellbore -->
									<xsl:value-of select="../witsml:generalInformation/witsml:itemState"/>
								</xsl:when>
								<xsl:when test="../../../witsml:generalInformation/witsml:itemState"> <!-- well -->
									<xsl:value-of select="../../../witsml:generalInformation/witsml:itemState"/>
								</xsl:when>
								<xsl:otherwise>
									Actual
								</xsl:otherwise>
							</xsl:choose>
						</b>
					</td>
				</tr>
			</xsl:for-each>
		</table>
		<P> </P>
	</xsl:template>


	<xsl:template match="witsml:generalInformation" mode="perforation">
		<table border="1" width="90%">
			<tr>
				<th align="left" colspan="4" class='tableheader'>WELL CASING PERFORATIONS</th>
			</tr>
			<tr>
				<th>Top Depth</th>
				<th>Bottom Depth</th>
				<th>Shot Density</th>
				<th>Existence</th>
			</tr>
			<xsl:for-each select="../witsml:wellboreSet/witsml:wellbore/witsml:wellboreIntervalSet/witsml:perforationInterval">
				<xsl:sort data-type="number" select="witsml:mdTop"/>
				<tr>
					<td>
						<b>
							<xsl:value-of select="witsml:mdTop"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:mdTop/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:mdBottom"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:mdBottom/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:shotDensity"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:shotDensity/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:choose>
								<xsl:when test="witsml:itemState"> <!-- perforationInterval -->
									<xsl:value-of select="witsml:itemState"/>
								</xsl:when>
								<xsl:when test="../../witsml:generalInformation/witsml:itemState"> <!-- wellbore -->
									<xsl:value-of select="../../witsml:generalInformation/witsml:itemState"/>
								</xsl:when>
								<xsl:when test="../../../../witsml:generalInformation/witsml:itemState"> <!-- well -->
									<xsl:value-of select="../../../../witsml:generalInformation/witsml:itemState"/>
								</xsl:when>
								<xsl:otherwise>
									Actual
								</xsl:otherwise>
							</xsl:choose>
						</b>
					</td>
				</tr>
			</xsl:for-each>
		</table>
		<P> </P>
	</xsl:template>

	<xsl:template match="witsml:generalInformation" mode="LeadAgency">
		<xsl:for-each select="witsml:businessAssociate">
			<xsl:if test="witsml:role/witsml:namingSystem = 'CalWIMS classification'">
				<xsl:if test="witsml:role/witsml:name = 'lead agency'">
					<table border="1" width="90%">
						<tr>
							<th align="left" colspan="4" class='tableheader'>LEAD AGENCY</th>
						</tr>
						<tr>
							<td colspan="4"><small>Information for compliance with the California Environmental Quality Ace of 1970 (C.E.Q.A.).
							If an environmental document has been prepared by the lead agency, please submit a 
							copy of the document with this notice or supply the following information.</small></td>
						</tr>
						<tr>
							<td>Lead Agency Name: 
								<b>
									<xsl:value-of select="witsml:name"/> 
								</b>
							</td>
							<td>Mailing Address Street: 
								<xsl:for-each select="witsml:address">
									<xsl:if test="@kind = 'mailing'">
										<xsl:for-each select="witsml:street">
											<xsl:if test="position() = 1">
												<b><xsl:value-of select="."/></b>
											</xsl:if>
										</xsl:for-each>
									</xsl:if>
								</xsl:for-each>
							</td>
						</tr>
						<tr>
							<td>Mailing Address Street 2: 
								<xsl:for-each select="witsml:address">
									<xsl:if test="@kind = 'mailing'">
										<xsl:for-each select="witsml:street">
											<xsl:if test="position() = 2">
												<b><xsl:value-of select="."/></b>
											</xsl:if>
										</xsl:for-each>
									</xsl:if>
								</xsl:for-each>
							</td>
							<td>City: 
								<xsl:for-each select="witsml:address">
									<xsl:if test="@kind = 'mailing'">
										<b><xsl:value-of select="witsml:city"/></b>
									</xsl:if>
								</xsl:for-each>
							</td>
						</tr>
						<tr>
							<td>State: 
								<xsl:for-each select="witsml:address">
									<xsl:if test="@kind = 'mailing'">
										<b><xsl:value-of select="witsml:state"/></b>
									</xsl:if>
								</xsl:for-each>
							</td>
							<td>Zip Code: 
								<xsl:for-each select="witsml:address">
									<xsl:if test="@kind = 'mailing'">
										<b><xsl:value-of select="witsml:postalCode"/></b>
									</xsl:if>
								</xsl:for-each>
							</td>
						</tr>
						<xsl:variable name="contactUID"><xsl:value-of select="witsml:contact/@uidRef"/></xsl:variable>
						<xsl:for-each select="../witsml:businessAssociate">
							<xsl:if test="@uid = $contactUID">
								<tr>
									<td>First Name: 
										<b><xsl:value-of select="witsml:personName/witsml:first"/> </b>
									</td>
									<td>Last Name:  
										<b><xsl:value-of select="witsml:personName/witsml:last"/></b>
									</td>
								</tr>
								<tr>
									<td>Phone#:
										<xsl:for-each select="witsml:phoneNumber">
											<xsl:if test="@type = 'voice'">
												<b><xsl:value-of select="."/></b>
												Ext#:
												<b><xsl:value-of select="@extension"/></b>
											</xsl:if>
										</xsl:for-each>
									</td>
								</tr>
							</xsl:if>
						</xsl:for-each>
					</table>
				</xsl:if>
			</xsl:if>
		</xsl:for-each>
		<P> </P>
	</xsl:template>

	<xsl:template match="witsml:generalInformation" mode="contact">
		<xsl:for-each select="../witsml:regulatoryDocumentSet/witsml:regulatoryDocument">
			<xsl:if test="witsml:agencyForm ='CalWIMS'">
				<xsl:variable name="submitterlUID"><xsl:value-of select="witsml:submitter/@uidRef"/></xsl:variable>
				<xsl:variable name="submittalDate"><xsl:value-of select="witsml:submittalDate"/></xsl:variable>
				<xsl:for-each select="../../witsml:generalInformation/witsml:businessAssociate">
					<xsl:if test="@uid = $submitterlUID">
						<table border="1" width="90%">
							<tr>
								<th align="left" colspan="4" class='tableheader'>PERSON FILING NOTICE CONTACT INFORMATION</th>
							</tr>
							<tr>
								<td colspan="4"><small>It is understood that if changes to this plan become necessary, 
								we are to notify you immediately. The agent will receive copies of any correspondence 
								(including permits) resulting from this notice. Please add contact information for 
								any other persons you wish to receive copies.</small></td>
							</tr>
							<tr>
								<td>First Name: 
									<b>
										<xsl:value-of select="witsml:personName/witsml:first"/> 
									</b>
								</td>
								<td>Email Address: 
									<b> 
										<xsl:value-of select="witsml:email"/> 
									</b>
								</td>
							</tr>
							<tr>
								<td>Last Name:  
									<b>
										<xsl:value-of select="witsml:personName/witsml:last"/> 
									</b>
								</td>
								<td>Phone#:
									<xsl:for-each select="witsml:phoneNumber">
										<xsl:if test="@type = 'voice'">
											<b><xsl:value-of select="."/></b>
											Ext#:
											<b><xsl:value-of select="@extension"/></b>
										</xsl:if>
									</xsl:for-each>
								</td>
							</tr>
							<tr>
								<td>Mailing Address Street: 
									<xsl:for-each select="witsml:address">
										<xsl:if test="@kind = 'mailing'">
											<xsl:for-each select="witsml:street">
												<xsl:if test="position() = 1">
													<b><xsl:value-of select="."/></b>
												</xsl:if>
											</xsl:for-each>
										</xsl:if>
									</xsl:for-each>
								</td>
								<td>Phone#:
									<xsl:for-each select="witsml:phoneNumber">
										<xsl:if test="@type = 'voice'">
											<b><xsl:value-of select="."/></b>
										</xsl:if>
									</xsl:for-each>
								</td>
							</tr>
							<tr>
								<td>Mailing Address Street 2: 
									<xsl:for-each select="witsml:address">
										<xsl:if test="@kind = 'mailing'">
											<xsl:for-each select="witsml:street">
												<xsl:if test="position() = 2">
													<b><xsl:value-of select="."/></b>
												</xsl:if>
											</xsl:for-each>
										</xsl:if>
									</xsl:for-each>
								</td>
								<td>Contact Preference:
									<xsl:choose>
										<xsl:when test="contains(witsml:contactPreference,' email')">
											<b>email</b>
										</xsl:when>
										<xsl:when test="contains(witsml:contactPreference,' mail')">
											<b>mail</b>
										</xsl:when>
										<xsl:when test="contains(witsml:contactPreference,' fax')">
											<b>fax</b>
										</xsl:when>
									</xsl:choose>
								</td>
							</tr>
							<tr>
								<td>City: 
									<xsl:for-each select="witsml:address">
										<xsl:if test="@kind = 'mailing'">
											<b><xsl:value-of select="witsml:city"/></b>
										</xsl:if>
									</xsl:for-each>
								</td>
								<td>Date Notice Signed: <b>Not Applicable</b>
								</td>
							</tr>
							<tr>
								<td>State: 
									<xsl:for-each select="witsml:address">
										<xsl:if test="@kind = 'mailing'">
											<b><xsl:value-of select="witsml:state"/></b>
										</xsl:if>
									</xsl:for-each>
								</td>
								<td>Notice Submission Date: 
									<b>
										<xsl:value-of select="$submittalDate"/>
									</b>
								</td>
							</tr>
							<tr>
								<td>Zip Code: 
									<xsl:for-each select="witsml:address">
										<xsl:if test="@kind = 'mailing'">
											<b><xsl:value-of select="witsml:postalCode"/></b>
										</xsl:if>
									</xsl:for-each>
								</td>
							</tr>
						</table>
					</xsl:if>
				</xsl:for-each>
			</xsl:if>
		</xsl:for-each>
		<P> </P>
	</xsl:template>

	<xsl:template match="witsml:generalInformation" mode="casingCement">
		<table border="1" width="90%">
			<tr>
				<th align="left" colspan="7" class='tableheader'>CASING CEMENT</th>
			</tr>
			<tr>
				<th>Bottom Depth</th>
				<th>Distance above Bottom Depth</th>
				<th>Volume</th>
				<th>API Cement Class</th>
				<th>Cement Device</th>
				<th>Cement Mixture</th>
				<th>Existence</th>
			</tr>
			<xsl:for-each select="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:cementSummary">
				<xsl:sort data-type="number" select="witsml:mdTop"/>
				<tr>
					<td>
						<b>
							<xsl:value-of select="witsml:mdBottom"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:mdBottom/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:mdBottom - witsml:mdTop"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:mdBottom/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:volume"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:volume/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:APICementClass"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:cementBottomDepthDevice"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:cementMixture"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:choose>
								<xsl:when test="witsml:itemState"> <!-- cementSummary -->
									<xsl:value-of select="witsml:itemState"/>
								</xsl:when>
								<xsl:when test="../witsml:generalInformation/witsml:itemState"> <!-- wellbore -->
									<xsl:value-of select="../witsml:generalInformation/witsml:itemState"/>
								</xsl:when>
								<xsl:when test="../../../../witsml:generalInformation/witsml:itemState"> <!-- well -->
									<xsl:value-of select="../../../../witsml:generalInformation/witsml:itemState"/>
								</xsl:when>
								<xsl:otherwise>
									Actual
								</xsl:otherwise>
							</xsl:choose>
						</b>
					</td>
				</tr>
			</xsl:for-each>
		</table>
		<P> </P>
	</xsl:template>

	<xsl:template match="witsml:generalInformation" mode="casingString">
		<table border="1" width="90%">
			<tr>
				<th align="left" colspan="7" class='tableheader'>WELL CASING STRING</th>
			</tr>
			<tr>
				<th>Type</th>
				<th>Diameter</th>
				<th>Top Depth</th>
				<th>Bottom Depth</th>
				<th>Weight</th>
				<th>Grade</th>
				<th>Existence</th>
			</tr>
			<xsl:for-each select="../witsml:wellboreSet/witsml:wellbore/witsml:wbGeometrySet/witsml:wbGeometry/witsml:wbGeometrySection">
				<xsl:sort data-type="number" select="witsml:mdTop"/>
				<tr>
					<td>
						<b>
							<xsl:value-of select="witsml:typeHoleCasing"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:odSection"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:odSection/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:mdTop"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:mdTop/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:mdBottom"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:mdBottom/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:wtPerLen"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:wtPerLen/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:grade"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:grade/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:choose>
								<xsl:when test="../witsml:itemState"> <!-- trajectory -->
									<xsl:value-of select="../witsml:itemState"/>
								</xsl:when>
								<xsl:when test="../../../witsml:generalInformation/witsml:itemState"> <!-- wellbore -->
									<xsl:value-of select="../../../witsml:generalInformation/witsml:itemState"/>
								</xsl:when>
								<xsl:when test="../../../../../witsml:generalInformation/witsml:itemState"> <!-- well -->
									<xsl:value-of select="../../../../../witsml:generalInformation/witsml:itemState"/>
								</xsl:when>
								<xsl:otherwise>
									Actual
								</xsl:otherwise>
							</xsl:choose>
						</b>
					</td>
				</tr>
			</xsl:for-each>
		</table>
		<P> </P>
	</xsl:template>

	<xsl:template match="witsml:generalInformation" mode="proposedBorehole">
		<table border="1" width="70%">
			<tr>
				<th align="left" colspan="3" class='tableheader'>WELL BORE</th>
			</tr>
			<tr>
				<th>Hole Diameter</th>
				<th>Well Bore Bottom Depth</th>
				<th>Existence</th>
			</tr>
			<xsl:for-each select="../witsml:wellboreSet/witsml:wellbore/witsml:wellboreIntervalSet/witsml:boreholeInterval">
				<xsl:sort data-type="number" select="witsml:mdTop"/>
				<tr>
					<td>
						<b>
							<xsl:value-of select="witsml:holeDiameter"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:holeDiameter/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:value-of select="witsml:mdBottom"/>
							<xsl:text> </xsl:text>
							<xsl:value-of select="witsml:mdBottom/@uom"/>
						</b>
					</td>
					<td>
						<b>
							<xsl:choose>
								<xsl:when test="witsml:itemState"> <!-- boreholeInterval -->
									<xsl:value-of select="witsml:itemState"/>
								</xsl:when>
								<xsl:when test="../../witsml:generalInformation/witsml:itemState"> <!-- wellbore -->
									<xsl:value-of select="../../witsml:generalInformation/witsml:itemState"/>
								</xsl:when>
								<xsl:when test="../../../../witsml:generalInformation/witsml:itemState"> <!-- well -->
									<xsl:value-of select="../../../../witsml:generalInformation/witsml:itemState"/>
								</xsl:when>
								<xsl:otherwise>
									Actual
								</xsl:otherwise>
							</xsl:choose>
						</b>
					</td>
				</tr>
			</xsl:for-each>
		</table>
		<P> </P>
	</xsl:template>

	<xsl:template match="witsml:generalInformation" mode="wellElevation">
		<xsl:for-each select="witsml:wellDatum">
			<xsl:if test="witsml:code = 'SL'">
				<xsl:variable name="sealevelUID"><xsl:value-of select="@uid"/></xsl:variable>
				<xsl:for-each select="../witsml:wellDatum">
					<xsl:if test="witsml:elevation/@datum = $sealevelUID">
						<xsl:variable name="datumCode"><xsl:value-of select="witsml:code"/></xsl:variable>
						<table border="1" width="90%">
							<tr>
								<th align="left" colspan="3" class='tableheader'>WELL ELEVATION</th>
							</tr>
							<tr>
								<td>Elevation of ground above sea level:  
									<b>
										<xsl:value-of select="../witsml:groundElevation"/>
										<xsl:text> </xsl:text>
										<xsl:value-of select="../witsml:groundElevation/@uom"/>
									</b>
								</td>
								<td>All depth measurements taken from the top of:  
									<b>
										<xsl:choose>
											<xsl:when test="$datumCode = 'GL'">
												Ground Level
											</xsl:when>
											<xsl:when test="$datumCode = 'CF'">
												Casing Flange
											</xsl:when>
											<xsl:when test="$datumCode = 'CV'">
												Crown Valve
											</xsl:when>
											<xsl:when test="$datumCode = 'DF'">
												Derrick Floor
											</xsl:when>
											<xsl:when test="$datumCode = 'KB'">
												Kelly Bushing
											</xsl:when>
											<xsl:when test="$datumCode = 'RB'">
												Rotary Bushing
											</xsl:when>
											<xsl:when test="$datumCode = 'RT'">
												Rotary Table
											</xsl:when>
											<xsl:when test="$datumCode = 'SF'">
												Sea Floor
											</xsl:when>
											<xsl:when test="$datumCode = 'KO'">
												Kickoff Point
											</xsl:when>
											<xsl:otherwise>
												<xsl:value-of select="$datumCode"/>
											</xsl:otherwise>
										</xsl:choose>
									</b>
								</td>
								<td>That is:  
									<b>
										<xsl:value-of select="witsml:elevation - ../witsml:groundElevation"/>
										<xsl:text> </xsl:text>
										<xsl:value-of select="witsml:elevation/@uom"/>
									</b> above ground.
								</td>
							</tr>
						</table>
					</xsl:if>
				</xsl:for-each>
			</xsl:if>
		</xsl:for-each>
		<P> </P>
	</xsl:template>

	<xsl:template match="witsml:generalInformation" mode="directional">
		<xsl:if test="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:bottomHoleDispNs">
			<xsl:call-template name="directional_table">
				<xsl:with-param name="valueNS">
					<xsl:value-of select="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:bottomHoleDispNs"/>
				</xsl:with-param>
				<xsl:with-param name="valueEW">
					<xsl:value-of select="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:bottomHoleDispEw"/>
				</xsl:with-param>
				<xsl:with-param name="existence">Actual</xsl:with-param>
			</xsl:call-template>
		</xsl:if>
		<xsl:if test="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:bottomHolePlannedDispNs">
			<xsl:call-template name="directional_table">
				<xsl:with-param name="valueNS">
					<xsl:value-of select="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:bottomHolePlannedDispNs"/>
				</xsl:with-param>
				<xsl:with-param name="valueEW">
					<xsl:value-of select="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:bottomHolePlannedDispEw"/>
				</xsl:with-param>
				<xsl:with-param name="existence">Plan</xsl:with-param>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<xsl:template name="directional_table">
		<xsl:param name="valueNS"/>
		<xsl:param name="valueEW"/>
		<xsl:param name="existence"/>
		<xsl:variable name="negativeOne">-1</xsl:variable>
		<table border="1" width="90%">
			<tr>
				<th align="left" colspan="2" class='tableheader'>DIRECTIONAL BOTTOM HOLE LOCATION</th>
			</tr>
			<tr>
				<td>Distance Bottom Hole is North or South From Surface Location:
					<b>
						<xsl:choose>
							<xsl:when test="$valueNS > 0">
								<xsl:value-of select="$valueNS"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="$negativeOne * $valueNS"/>
							</xsl:otherwise>
						</xsl:choose>
						<xsl:text> </xsl:text>
						<xsl:value-of select="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:bottomHoleDispNs/@uom"/>
					</b>
				</td>
				<td>Distance Bottom Hole is East or West From Surface Location:
					<b>
						<xsl:choose>
							<xsl:when test="$valueEW > 0">
								<xsl:value-of select="$valueEW"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="$negativeOne * $valueEW"/>
							</xsl:otherwise>
						</xsl:choose>
						<xsl:text> </xsl:text>
						<xsl:value-of select="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:bottomHoleDispEw/@uom"/>
					</b>
				</td>
			</tr>
			<tr>
				<td>Bottom Hole North or South Direction:
					<b>
						<xsl:choose>
							<xsl:when test="$valueNS > 0">
								North
							</xsl:when>
							<xsl:otherwise>
								South
							</xsl:otherwise>
						</xsl:choose>
					</b>
				</td>
				<td>Bottom Hole North or South Direction:
					<b>
						<xsl:choose>
							<xsl:when test="$valueEW > 0">
								East
							</xsl:when>
							<xsl:otherwise>
								West
							</xsl:otherwise>
						</xsl:choose>
					</b>
				</td>
			</tr>
			<tr>
				<td>True Vertical Depth at Total Depth:
					<b>
						<xsl:value-of select="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:tvdPlanned"/>
						<xsl:text> </xsl:text>
						<xsl:value-of select="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:tvdPlanned/@uom"/>
					</b>
				</td>
				<td>Existence:
					<b>

						<xsl:choose>
							<xsl:when test="witsml:itemState='Plan'"> <!-- well -->
								Plan
							</xsl:when>
							<xsl:when test="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:itemState='Plan'"> <!-- wellbore -->
								Plan
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="$existence"/>
							</xsl:otherwise>
						</xsl:choose>
					</b>
				</td>


			</tr>
		</table>
		<P> </P>
	</xsl:template>

	<xsl:template match="witsml:generalInformation" mode="usageType">
		<table border="1" width="90%">
			<tr>
				<th align="left" colspan="7" class='tableheader'>WELL USAGE TYPE</th>
			</tr>
			<tr>
				<th>Well Usage Type</th>
				<th>Intended Zone</th>
				<th>Bottom TVD</th>
				<th>Top TVD</th>
				<th>Expected Pressure</th>
				<th>Existence</th>
			</tr>
			<xsl:for-each select="../witsml:wellboreSet/witsml:wellbore/witsml:wellboreIntervalSet/witsml:classifiedInterval">
				<xsl:if test="witsml:classification/witsml:namingSystem='CalWIMS well usage'">
					<tr>
						<td> 
							<b>
								<xsl:value-of select="witsml:classification/witsml:class"/>
							</b>
						</td>
						<td>  
							<b><xsl:value-of select="witsml:name"/></b>
						</td>
						<td>  
							<b>
								<xsl:value-of select="witsml:tvdBottom"/>
								<xsl:text> </xsl:text>
								<xsl:value-of select="witsml:tvdBottom/@uom"/>
							</b>
						</td>
						<td>  
							<b>
								<xsl:value-of select="witsml:tvdTop"/>
								<xsl:text> </xsl:text>
								<xsl:value-of select="witsml:tvdTop/@uom"/>
							</b>
						</td>
						<td>  
							<b>
								<xsl:value-of select="witsml:pressure"/>
								<xsl:text> </xsl:text>
								<xsl:value-of select="witsml:pressure/@uom"/>
							</b>
						</td>
						<td>
							<b>
								<xsl:choose>
									<xsl:when test="witsml:itemState"> <!-- classifiedInterval -->
										<xsl:value-of select="witsml:itemState"/>
									</xsl:when>
									<xsl:when test="../../witsml:generalInformation/witsml:itemState"> <!-- wellbore -->
										<xsl:value-of select="../../witsml:generalInformation/witsml:itemState"/>
									</xsl:when>
									<xsl:when test="../../../../witsml:generalInformation/witsml:itemState"> <!-- well -->
										<xsl:value-of select="../../../../witsml:generalInformation/witsml:itemState"/>
									</xsl:when>
									<xsl:otherwise>
										Actual
									</xsl:otherwise>
								</xsl:choose>
							</b>
						</td>
					</tr>
				</xsl:if>
			</xsl:for-each>
		</table>
		<P> </P>
	</xsl:template>

	<xsl:template match="witsml:generalInformation" mode="criticalWell">
		<table border="1" width="60%">
			<tr>
				<th align="left" class='tableheader'>CRITICAL WELL</th>
			</tr>
			<tr>
				<td>Is this a critical well according to the definition (default No)?:  
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS classification'">
								<xsl:if test="witsml:class='CriticalWell'">
									Yes	
								</xsl:if>
							</xsl:if>
						</xsl:for-each>
					</b>
				</td>
			</tr>
		</table>
		<P> </P>
	</xsl:template>

	<xsl:template match="witsml:generalInformation" mode="wellProperties">
		<xsl:param name="formType"/>
		<table border="1" width="50%">
			<tr>
				<th align="left" class='tableheader'>WELL PROPERTIES</th>
			</tr>
			<tr>
				<td>Are you requesting Exploratory Status (default No)?:  
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS classification'">
								<xsl:if test="witsml:class='Exploratory'">
									Yes	
								</xsl:if>
							</xsl:if>
						</xsl:for-each>
					</b>
				</td>
			</tr>
			<tr>
				<td>Is this a Multilateral Well (default No)?:  
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS classification'">
								<xsl:if test="witsml:class='Multilateral'">
									Yes	
								</xsl:if>
							</xsl:if>
						</xsl:for-each>
					</b>
				</td>
			</tr>
			<tr>
				<td>Is this a Directional Well (default No)?:  
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS classification'">
								<xsl:if test="witsml:class='Directional'">
									Yes	
								</xsl:if>
							</xsl:if>
						</xsl:for-each>
					</b>
				</td>
			</tr>
			<tr>
				<td>Tidelands Surface Location (default Onshore): 
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS classification'">
								<xsl:if test="witsml:class='TidelandsSurfaceLocationOffshore'">
									Offshore	
								</xsl:if>	
							</xsl:if>
						</xsl:for-each>
					</b>
				</td>
			</tr>
			<tr>
				<td>Estimated Total Depth: 
					<b>
						<xsl:choose>
							<xsl:when test="$formType = 'redrill'">
								<xsl:value-of select="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:mdPlanned"/>
								<xsl:text> </xsl:text>
								<xsl:value-of select="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:mdPlanned/@uom"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:mdCurrent"/>
								<xsl:text> </xsl:text>
								<xsl:value-of select="../witsml:wellboreSet/witsml:wellbore/witsml:generalInformation/witsml:mdcurrent/@uom"/>
							</xsl:otherwise>
						</xsl:choose>
					</b> 
				</td>
			</tr>
		</table>
		<P> </P>
	</xsl:template>

	<xsl:template match="witsml:generalInformation" mode="mineralRights">
		<table border="1" width="90%">
			<tr>
				<th align="left" colspan="2" class='tableheader'>MINERAL RIGHTS</th>
			</tr>
			<tr>
				<td colspan="2">Legal description of mineral rights consisting of 
					<b>
						<xsl:value-of select="witsml:mineralLease/witsml:area"/>
						<xsl:text> </xsl:text>
						<xsl:value-of select="witsml:mineralLease/witsml:area/@uom"/>
					</b> 
					<br/>
					(attach map or plat to scale in attachments screen) is as follows:
				</td>
			</tr>
			<tr>
				<td>Mineral-Right Lease Legal Description: 
					<br/>
					(Describe here or send attachment later in attachments screen.) 
				</td>
				<td width="65%"> 
					<b>
						<xsl:value-of select="witsml:mineralLease/witsml:legalDescription"/>
					</b>
				</td>
			</tr>
		</table>
		<P> </P>
	</xsl:template>

	<xsl:template match="witsml:generalInformation" mode="surfaceLease">
		<table border="1" width="90%">
			<tr>
				<th align="left" colspan="2" class='tableheader'>SURFACE LEASE</th>
			</tr>
			<tr>
				<td colspan="2">Do mineral and surface leases coincide (default No)?:  
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS classification'">
								<xsl:if test="witsml:class='MineralAndSurfaceLeasesCoincide'">
									Yes	
								</xsl:if>
							</xsl:if>
						</xsl:for-each>
					</b>
					<br/>
					If answer is no, enter legal description below (or attach map or plat to scale later in Attachments screen).
				</td>
			</tr>
			<tr>
				<td>Surface Lease Legal Description: 
					<br/>
					(Describe here or send attachment later in attachments screen.) 
				</td>
				<td width="65%"> 
					<b>
						<xsl:value-of select="witsml:surfaceLease/witsml:legalDescription"/>
					</b>
				</td>
			</tr>
		</table>
		<P> </P>
	</xsl:template>

	<xsl:template match="witsml:generalInformation" mode="confidential">
		<table border="1" width="90%">
			<tr>
				<th align="left" colspan="2" class='tableheader'>CONFIDENTIAL WELL STATUS</th>
			</tr>
			<tr>
				<td>Are you requesting confidential status for this well (default No)?:  
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS classification'">
								<xsl:if test="witsml:class='ConfidentialStatus'">
									Yes	
								</xsl:if>
							</xsl:if>
						</xsl:for-each>
					</b>
					<BR/>
					If yes, please provide reason below.
				</td>
			</tr>
			<tr>
				<td>Confidential Status Request Reason:  
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS classification'">
								<xsl:if test="witsml:class='ConfidentialStatus'">
									<xsl:value-of select="witsml:comment"/>	
								</xsl:if>
							</xsl:if>
						</xsl:for-each>
					</b>
				</td>
			</tr>
		</table>
		<P> </P>
	</xsl:template>

	<xsl:template match="witsml:generalInformation" mode="CEQA">
		<table border="1" width="90%">
			<tr>
				<th align="left" colspan="2" class='tableheader'>C. E. Q. A. INFORMATION</th>
			</tr>
			<tr>
				<td>Exempt (default No): 
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS Exempt'">
								Yes
							</xsl:if>
						</xsl:for-each>
					</b>
				</td>
				<td>Exempt Class:
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS Exempt'">
								<xsl:value-of select="witsml:class"/>
							</xsl:if>
						</xsl:for-each>
					</b>
				</td>
			</tr>
			<tr>
				<td>Negative Declaration (default No): 
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS classification'">
								<xsl:if test="witsml:class='NegativeDeclaration'">
									Yes
								</xsl:if>
							</xsl:if>
						</xsl:for-each>
					</b>
				</td>
				<td>S.C.H. NO. or Document ID: 
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS classification'">
								<xsl:if test="witsml:class='NegativeDeclaration'">
									<xsl:for-each select="../witsml:ancillaryDocument">
										<xsl:if test="witsml:kind/witsml:namingSystem='California CEQA'">
											<xsl:if test="witsml:kind/witsml:class='NegativeDeclaration'">
												<xsl:value-of select="witsml:alias/witsml:name"/>
											</xsl:if>
										</xsl:if>	
									</xsl:for-each>	
								</xsl:if>
							</xsl:if>
						</xsl:for-each>
					</b>
				</td>
			</tr>
			<tr>
				<td>Evironmental Impact Report (default No): 
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS classification'">
								<xsl:if test="witsml:class='EvironmentalImpactReport'">
									Yes	
								</xsl:if>
							</xsl:if>
						</xsl:for-each>
					</b>
				</td>
				<td>S.C.H. NO. or Document ID: 
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS classification'">
								<xsl:if test="witsml:class='EvironmentalImpactReport'">
									<xsl:for-each select="../witsml:ancillaryDocument">
										<xsl:if test="witsml:kind/witsml:namingSystem='California CEQA'">
											<xsl:if test="witsml:kind/witsml:class='EvironmentalImpactReport'">
												<xsl:value-of select="witsml:alias/witsml:name"/>
											</xsl:if>
										</xsl:if>	
									</xsl:for-each>	
								</xsl:if>
							</xsl:if>
						</xsl:for-each>
					</b>
				</td>
			</tr>
			<tr>
				<td>Document Not Required By Local Jurisdiction (default No): 
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS classification'">
								<xsl:if test="witsml:class='DocumentNotRequiredByLocalJurisdiction'">
									Yes	
								</xsl:if>
							</xsl:if>
						</xsl:for-each>
					</b>
				</td>
			</tr>
		</table>
		<P> </P>
	</xsl:template>


	<xsl:template match="witsml:generalInformation" mode="wellLocation">
		<table border="1" width="90%">
			<tr>
				<th align="left" colspan="3" class='tableheader'>WELL LOCATION</th>
			</tr>
			<tr>
				<td>Lease Name: <b><xsl:value-of select="witsml:surfaceLease/witsml:name"/></b></td>
				<td>Well#: <b><xsl:value-of select="../witsml:name"/></b></td>
				<td>District: <b><xsl:value-of select="witsml:district"/></b></td>
			</tr>
			<tr>
				<td>Section: <b><xsl:value-of select="witsml:legalLocation/witsml:USDescription/witsml:section"/></b></td>
				<td>Township: <b><xsl:value-of select="witsml:legalLocation/witsml:USDescription/witsml:township"/></b></td>
				<td>Range: <b><xsl:value-of select="witsml:legalLocation/witsml:USDescription/witsml:range"/></b></td>
			</tr>
			<tr>
				<td>Base and Meridian: <b><xsl:value-of select="witsml:legalLocation/witsml:USDescription/witsml:principalMeridian"/></b></td>
				<td>Field: <b><xsl:value-of select="witsml:field"/></b></td>
				<td>County: <b><xsl:value-of select="witsml:county"/></b></td>
			</tr>
			<tr>
				<td colspan="3"><small>Please enter Latitude and Longitude in NAD27 with six (6) decimal points accuracy (Example: "32.123456"). 
				For any urban wells, please submit a location map in the Attachments screen.</small></td>
			</tr>
			<tr>
				<td>Latitude: <b><xsl:value-of select="witsml:wellLocation/witsml:latitude"/><xsl:text> </xsl:text><xsl:value-of select="witsml:wellLocation/witsml:latitude/@uom"/></b></td>
				<td>Longitude: <b><xsl:value-of select="witsml:wellLocation/witsml:longitude"/><xsl:text> </xsl:text><xsl:value-of select="witsml:wellLocation/witsml:longitude/@uom"/></b></td>
			</tr>
			<tr>
				<td>Tidelands Surface Location (default Onshore): 
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS classification'">
								<xsl:if test="witsml:class='TidelandsSurfaceLocationOffshore'">
									Offshore	
								</xsl:if>	
							</xsl:if>
						</xsl:for-each>
					</b>
				</td>
			</tr>
			<tr>
				<td>Is this well on a BLM lease (default No): 
					<b>
						<xsl:for-each select="witsml:classification">
							<xsl:if test="witsml:namingSystem='CalWIMS classification'">
								<xsl:if test="witsml:class='WellOnBLMLease'">
									Yes	
								</xsl:if>	
							</xsl:if>
						</xsl:for-each>
					</b>
				</td>
			</tr>
		</table>
		<P> </P>
	</xsl:template>

</xsl:stylesheet>
