<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="/">
<html>
<head>			
			<title>
				<xsl:value-of select="//Name"></xsl:value-of>
			</title>						
</head>

<body>
<xsl:for-each select="//Case">			
			<center>
			<h2>
				<xsl:value-of select="Name" />
			</h2>
		  </center>
		  
			<xsl:if test="Location">
				<left><b>Location:&#160;</b>
			<xsl:value-of select="Location"/></left><br />
			</xsl:if>
			
			<xsl:if test="URL"> 
				<left><b>Url:&#160;</b>
				<EM><A><xsl:attribute name="href">
				<xsl:value-of select="URL" />
				</xsl:attribute>			
				<xsl:value-of select="URL" /> 
				</A></EM></left><BR/>
			</xsl:if>
		
		<xsl:if test="Date">
		 	<xsl:if test="Date/InvestigationDate">
			<b>Investigation date:&#160;</b><xsl:value-of select="Date/InvestigationDate"></xsl:value-of>&#160;&#160;&#160;
			</xsl:if>
			<xsl:if test="Date/InventoryEntryDate">
			(Date entered in Inventory:&#160;<xsl:value-of select="Date/InventoryEntryDate"></xsl:value-of>)<br />
			</xsl:if>
		</xsl:if>
		
		<xsl:if test="General">
			<p><xsl:value-of select="General" /></p>
		</xsl:if>
		
				<xsl:if test="Images">
<xsl:for-each select="Images">
<table>
<tr>
			<xsl:for-each select="Image">

				<td valign="bottom">
				<center>
				<img><xsl:attribute name="src">
				<xsl:value-of select="Source" />
				</xsl:attribute>	
						
				<xsl:if test="Title">
				<xsl:attribute name="alt">
				<xsl:value-of select="Title" />
				</xsl:attribute>
				</xsl:if>
				
				<xsl:if test="Height">
				<xsl:attribute name="Height">
				<xsl:value-of select="Height" />
				</xsl:attribute>
				</xsl:if>
				
				<xsl:if test="Width">
				<xsl:attribute name="Width">
				<xsl:value-of select="Width" />
				</xsl:attribute>
				</xsl:if>
				
				</img>&#160;
				</center>
				</td>
			</xsl:for-each>
</tr>
<tr>
			<xsl:for-each select="Image">
				<td><center><b><xsl:value-of select="Title" />&#160;</b></center></td>
			</xsl:for-each>
</tr>
</table>
</xsl:for-each>
		</xsl:if>
		
		<xsl:if test="Failure">
			<h3>	Failure Information: </h3>

<xsl:if test="Failure/Size">
<table border="1">
	<tr>
		<xsl:if test="Failure/Size/Length">
			<td>Length</td>
		</xsl:if> 
		<xsl:if test="Failure/Size/Depth">
			<td>Depth</td>
		</xsl:if> 
		<xsl:if test="Failure/Size/Area">
			<td>Area</td>
		</xsl:if> 
		<xsl:if test="Failure/Size/Volume">
			<td>Volume</td>
		</xsl:if> 
	</tr>
		<tr>
		<xsl:if test="Failure/Size/Length">
			<td><xsl:apply-templates select="Failure/Size/Depth" /></td>
		</xsl:if> 
		<xsl:if test="Failure/Size/Depth">
			<td><xsl:apply-templates select="Failure/Size/Depth" /></td>
		</xsl:if> 
		<xsl:if test="Failure/Size/Area">
			<td><xsl:apply-templates select="Failure/Size/Area" /></td>
		</xsl:if>
		<xsl:if test="Failure/Size/Volume">
			<td><xsl:apply-templates select="Failure/Size/Volume" /></td>
		</xsl:if> 
	</tr>
	<tr>
		<xsl:if test="Failure/Size/Length">
			<td><xsl:value-of select="Failure/Size/Length" />&#160;</td>
		</xsl:if> 
		<xsl:if test="Failure/Size/Depth">
			<td><xsl:value-of select="Failure/Size/Depth" />&#160;</td>
		</xsl:if> 
		<xsl:if test="Failure/Size/Area">
			<td><xsl:value-of select="Failure/Size/Area" />&#160;</td>
		</xsl:if>
		<xsl:if test="Failure/Size/Volume">
			<td><xsl:value-of select="Failure/Size/Volume" />&#160;</td>
		</xsl:if> 
	</tr>
</table>
<br />
</xsl:if>
		
		<xsl:if test="Failure/Damage">
		<b>Damage</b><br />
			<xsl:value-of select="Failure/Damage" /><br /><br />
		</xsl:if>
		
</xsl:if>
		<xsl:if test="SlopeStabilityAnalysis">
			<h3>Details of Slope Stability Analysis:</h3>
			<xsl:value-of select="SlopeStabilityAnalysis"/>
		</xsl:if>

		<xsl:if test="Geology">
			<h3>Geology of Area:</h3>
			<xsl:value-of select="Geology"/>
		</xsl:if>

		<xsl:if test="Mitigation">
			<h3>Mitigation:</h3>
			<xsl:value-of select="Mitigation"/>
		</xsl:if>
				<xsl:if test="OtherInformation">
			<h3>Other Information:</h3>
			<xsl:value-of select="OtherInformation"/>
		</xsl:if>
		<br /><br />
</xsl:for-each>

		</body>
		</html>
	</xsl:template>
<!-- TEMPLATES -->	

<xsl:template match="Failure/Size/Length">
			<xsl:value-of select="Failure/Size/Length"></xsl:value-of>
			<xsl:value-of select="@Unit"></xsl:value-of>
</xsl:template>
<xsl:template match="Failure/Size/Depth">
			<xsl:value-of select="Failure/Size/Depth"></xsl:value-of>
			<xsl:value-of select="@Unit"></xsl:value-of>
</xsl:template>
<xsl:template match="Failure/Size/Area">
			<xsl:value-of select="Failure/Size/Area"></xsl:value-of>
			<xsl:value-of select="@Unit"></xsl:value-of>
</xsl:template>
<xsl:template match="Failure/Size/Volume">
			<xsl:value-of select="Failure/Size/Volume"></xsl:value-of>
			<xsl:value-of select="@Unit"></xsl:value-of>
</xsl:template>

</xsl:stylesheet>

