<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">

<xsl:template match="/">

<html>
<head>
<title>Retaining Wall Stylesheet</title>
</head>

<body>
<h3>Retaining Structures</h3>

<p><b><i>The following is a pictorial representation of the type of retaining wall defined in the XML file. It is not to scale, and is for illustrative purposes only. The true dimensions of the structure are indicated in the tables.</i></b></p> 

<xsl:choose>
<xsl:when test="RetainingWall">



<!-- Main Table -->

<table border="0" cellspacing="0" width="100%" height="65%">




<!-- Retained Earth Table -->
<tr height="100%">
<td valign="top">

<table border="2%" cellspacing="0%" width="100%">
	<tr>
		<td colspan="3" align="center">
			<xsl:for-each select="//RetainingWall/RetainedEarth">
					<h3>Retained Earth</h3>
			</xsl:for-each>	
		</td>			
	</tr>
	
	<xsl:choose>
	<xsl:when test="RetainingWall/RetainedEarth/DesignSoil">
	<xsl:for-each select="RetainingWall/RetainedEarth/DesignSoil/DesignLayer">
	<tr>
		<td width="35%"><b>LAYER</b></td>
		<td width="35%">
			<b>top,<xsl:value-of select="@toplevel"/>mOD</b>
		</td>
		<td width="30%">
			<b>thick,<xsl:value-of select="@thickness"/>m</b>
		</td>
	</tr>
	<tr>
		<td width="35%">c'</td> 
		<td width="35%">
			<xsl:value-of select="RetainingWall/RetainedEarth/DesignSoil/DesignLayer/DesignParameters[@designcohesion]"/>
		</td>
		<td width="30%">kN/m<sup>2</sup></td>
	</tr>
	<tr>
		<td width="35%">&#248;</td>
		<td width="35%">
				<xsl:value-of select="RetainingWall/RetainedEarth/DesignSoil/DesignLayer/DesignParameters[@designangleofshearingresistance]"/>
		</td>
		<td width="30%">&#176;</td>
	</tr>
	
	</xsl:for-each>

	<xsl:for-each select="RetainingWall/RetainedEarth/DesignSoil/WaterTable">
	<tr>
		<td width="35%">W.T.</td>
		<td width="35%">
			<xsl:value-of select="@level"/>
		</td>
		<td width="30%">mOD</td>
	</tr>
	</xsl:for-each>
	</xsl:when>

	<xsl:when test="RetainingWall/RetainedEarth/Zone/Fill/Soil">
	<xsl:for-each select="RetainingWall/RetainedEarth/Zone/Fill/Soil">
	<tr>
		<td colspan="3"><b>ZONE</b></td>
	</tr>
	<tr>
		<td width="35%">c'</td>
		<td width="35%">
			<xsl:value-of select="@cohesion"/>
		</td>
		<td width="30%">kN/m<sup>2</sup></td>
	</tr>
	<tr>
		<td width="35%">&#248;'</td>
		<td width="35%">
			<xsl:value-of select="@angleofshearingresistance"/>
		</td>
		<td width="30%">&#176;</td>
	</tr>
	</xsl:for-each>
	</xsl:when>

	</xsl:choose>
	</table>

</td>




<!-- Retaining wall picture -->

<td width="50%">
<table border="0" cellspacing="0" width="100%">




<!-- Draw the left sky and top surcharge-->

<tr height="25%">
	<td width="50%" background="Sky.gif">
			<xsl:choose>			
			<xsl:when test="RetainingWall/Surcharge/Top">
				<img src="Surcharge.gif" width="100%" height="100%"/>
			</xsl:when>
			<xsl:otherwise>
				<img src="Blank.gif" width="100%" height="100%"/>
			</xsl:otherwise>
			</xsl:choose>
	</td>
	




<!-- Draw right sky and dimension table -->

<td width="50%" background="Sky.gif">
	<table border="2" cellspacing="0" width="60%" align="center">
		<tr>
			<td width="60%">TYPE:</td>
			<td width="40%">
				<xsl:choose>
				<xsl:when test="//RetainingWall/Wall/Type/Diaphragm">
					Diaphragm
				</xsl:when>	
				<xsl:when test="//RetainingWall/Wall/Type/Gravity">
					Gravity
				</xsl:when>
				<xsl:when test="//RetainingWall/Wall/Type/PileWall">
					PileWall
				</xsl:when>
				<xsl:when test="//RetainingWall/Wall/Type/Gabion">
					Gabion
				</xsl:when>
				<xsl:when test="//RetainingWall/Wall/Type/Crib">
					Crib
				</xsl:when>
				<xsl:otherwise>
					Unknown
				</xsl:otherwise>
				</xsl:choose>
			</td>
		</tr>
		<tr>
			<td width="60%">HEIGHT:</td>
			<td width="40%">
				<xsl:for-each select="//RetainingWall/Wall">
					<xsl:value-of select="@height"/>
				</xsl:for-each>
			</td>
		</tr>
		<tr>
			<td width="60%">LENGTH:</td>
			<td width="40%">
				<xsl:for-each select="//RetainingWall/Wall">
					<xsl:value-of select="@length"/>
				</xsl:for-each>
			</td>
		</tr>
	</table>
</td>
</tr>





<!-- Draw the wall and anchor -->

<tr>
<xsl:choose>
	<xsl:when test="RetainingWall/Wall/Type/Gravity">
		<td rowspan="2" width="50%" height="100%" background="GravityWall.gif">
			<xsl:if test="RetainingWall/Anchor">
			<img src="Anchor.gif" width="90%" height="100%"/>
			</xsl:if>
		</td>
	</xsl:when>

	<xsl:when test="RetainingWall/Wall/Type/Gabion">
		<td rowspan="2" width="50%" height="100%" background="GabionWall.gif">
			<xsl:if test="RetainingWall/Anchor">
			<img src="Anchor.gif" width="90%" height="100%"/>
			</xsl:if>
		</td>
	</xsl:when>

	<xsl:when test="RetainingWall/Wall/Type/Diaphragm">
		<td rowspan="2" width="50%" height="100%" background="DiaphragmWall.gif">
			<xsl:if test="RetainingWall/Anchor">
			<img src="Anchor.gif" width="90%" height="100%"/>
			</xsl:if>
		</td>
	</xsl:when>

	<xsl:when test="RetainingWall/Wall/Type/Crib">
		<td rowspan="2" width="50%" height="100%" background="CribWall.gif">
			<xsl:if test="RetainingWall/Anchor">
			<img src="Anchor.gif" width="90%" height="100%"/>
			</xsl:if>
		</td>
	</xsl:when>

	<xsl:when test="RetainingWall/Wall/Type/PileWall">
		<td rowspan="2" width="50%" height="100%" background="PileWall.gif">
			<xsl:if test="RetainingWall/Anchor">
			<img src="Anchor.gif" width="90%" height="100%"/>
			</xsl:if>
		</td>
	</xsl:when>

	<xsl:otherwise>
		<td rowspan="2"  width="50%" height="100%" background="Soil.gif">
			<xsl:if test="RetainingWall/Anchor">
			<img src="Anchor.gif" width="100%" height="100%"/>
			</xsl:if>
		</td>
	</xsl:otherwise>

</xsl:choose>




<!-- Draw sky on right of wall and bottom surcharge-->

<xsl:choose>
<xsl:when test="RetainingWall/Wall/Type/Gravity">
	<td height="70%" width="50%" background="Sky.gif">
			<xsl:choose>			
			<xsl:when test="RetainingWall/Surcharge/Bottom">
				<img src="Surcharge.gif" width="100%" height="100%"/>
			</xsl:when>
			<xsl:otherwise>
				<img src="Blank.gif" width="100%" height="100%"/>
			</xsl:otherwise>
			</xsl:choose>
	</td>
</xsl:when>

<xsl:when test="RetainingWall/Wall/Type/Gabion">
	<td height="70%" width="50%" background="Sky.gif">
			<xsl:choose>			
			<xsl:when test="RetainingWall/Surcharge/Bottom">
				<img src="Surcharge.gif" width="100%" height="100%"/>
			</xsl:when>
			<xsl:otherwise>
				<img src="Blank.gif" width="100%" height="100%"/>
			</xsl:otherwise>
			</xsl:choose>
	</td>
</xsl:when>

<xsl:when test="RetainingWall/Wall/Type/Diaphragm">
	<td height="25%" width="50%" background="Sky.gif">
			<xsl:choose>			
			<xsl:when test="RetainingWall/Surcharge/Bottom">
				<img src="Surcharge.gif" width="100%" height="100%"/>
			</xsl:when>
			<xsl:otherwise>
				<img src="Blank.gif" width="100%" height="100%"/>
			</xsl:otherwise>
			</xsl:choose>
	</td>
</xsl:when>
				
<xsl:when test="RetainingWall/Wall/Type/Crib">
	<td height="70%" width="50%" background="Sky.gif">
			<xsl:choose>			
			<xsl:when test="RetainingWall/Surcharge/Bottom">
				<img src="Surcharge.gif" width="100%" height="100%"/>
			</xsl:when>
			<xsl:otherwise>
				<img src="Blank.gif" width="100%" height="100%"/>
			</xsl:otherwise>
			</xsl:choose>
	</td>
</xsl:when>
	
<xsl:when test="RetainingWall/Wall/Type/PileWall">
	<td height="25%" width="50%" background="Sky.gif">
			<xsl:choose>			
			<xsl:when test="RetainingWall/Surcharge/Bottom">
				<img src="Surcharge.gif" width="100%" height="100%"/>
			</xsl:when>
			<xsl:otherwise>
				<img src="Blank.gif" width="100%" height="100%"/>
			</xsl:otherwise>
			</xsl:choose>
	</td>
</xsl:when>

<xsl:otherwise>
	<td height="25%" width="50%" background="Sky.gif">
				<xsl:choose>			
			<xsl:when test="RetainingWall/Surcharge/Bottom">
				<img src="Surcharge.gif" width="100%" height="100%"/>
			</xsl:when>
			<xsl:otherwise>
				<img src="Blank.gif" width="100%" height="100%"/>
			</xsl:otherwise>
			</xsl:choose>
	</td>
</xsl:otherwise>

</xsl:choose>
</tr>





<!-- Draw soil at base of wall -->

<tr>		

	<td background="Soil.gif">
	</td>

</tr>
</table>





<!-- Facing Earth Table -->
	
</td>
<td valign="top">
<table border="2%" cellspacing="0" width="100%">
	<tr>
		<td colspan="3" align="center">
			<xsl:for-each select="//RetainingWall/FacingEarth">
				<h3>Facing Earth</h3>
			</xsl:for-each>
		</td>
	</tr>

	<xsl:choose>
	<xsl:when test="RetainingWall/FacingEarth/DesignSoil">
	<xsl:for-each select="RetainingWall/FacingEarth/DesignSoil/DesignLayer">
	<tr>
		<td width="9%"><b>LAYER</b></td>
		<td width="10%">
			<b>top,<xsl:value-of select="@toplevel"/>mOD</b>
		</td>
		<td width="9%">
			<b>thick,<xsl:value-of select="@thickness"/>m</b>
		</td>
	</tr>
	<xsl:for-each select="DesignParameters">
	<tr>
		<td width="9%">c'</td>
		<td width="10%">
			<xsl:value-of select="@designcohesion"/>
		</td>
		<td width="9%">kN/m<sup>2</sup></td>
	</tr>
	<tr>
		<td width="9%">&#248;'</td>
		<td width="10%">
			<xsl:value-of select="@designangleofshearingresistance"/>
		</td>
		<td width="9%">&#176;</td>
	</tr>
	</xsl:for-each>
	</xsl:for-each>

	<xsl:for-each select="RetainingWall/FacingEarth/DesignSoil/WaterTable">
	<tr>
		<td width="9%">W.T.</td>
		<td width="10%">
			<xsl:value-of select="@level"/>
		</td>
		<td width="9%">mOD</td>
	</tr>
	</xsl:for-each>
	</xsl:when>
	</xsl:choose>
</table>
</td>
</tr>
</table>
</xsl:when>




</xsl:choose>

</body>
</html>
</xsl:template>


</xsl:stylesheet>
