<?xml version="1.0" encoding='iso-8859-1'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html" />
	
	<!-- Document template -->
	<xsl:template match="/">
		<html>
			<head>
				<title>Logs</title>
				<style type="text/css">
					table {
						font-family:arial;
						background-color: #CDCDCD;
						font-size: 0.8em;
						width: 100%;
						margin-top:10px;
						text-align: left;
					}
					table thead tr .header:hover {
						background-color: #FF9800;
					}
					table thead tr th, table tfoot tr th {
						background-color: #D2D6DE;
						border: 1px solid #FFF;
						font-size: 1.2em;
						padding: 4px;
					}
					table thead tr .header {
						background-repeat: no-repeat;
						background-position: center right;
						cursor: pointer;
					}
					table tbody td {
						color: #3D3D3D;
						padding: 4px;
						background-color: #FFF;
						vertical-align: top;
					}
					table tbody td.dir:hover {
						background-color: #FF9800;
						cursor:pointer;
					}
					table tbody tr.odd td {
						background-color:#F0F0F6;
					}
					table thead tr .headerSortUp {
						background-image: url(../media/fugue/arrow-090.png);
					}
					table thead tr .headerSortDown {
						background-image: url(../media/fugue/arrow-270.png);
					}
					table thead tr .headerSortDown, table thead tr .headerSortUp {
						background-color: #FF9800;
					}
					
					h1 {
						margin-bottom:5px;
					}
					table {
						margin-bottom:20px;
					}
					body > div {
						overflow:hidden;
					}
					.pager {
						margin-top:10px;
					}
				</style>
				<script type="text/javascript" src="../lib/js/jquery.js"></script>
				<script type="text/javascript" src="../lib/js/jquery.tablesorter.js"></script>
				<script type="text/javascript" src="../lib/js/jquery.tablesorter.pager.js"></script>
				<script type="text/javascript">
					$(document).ready(function() {
						$("table").tablesorter({sortList: [[0,1]]})
						$("table").each(function(i,elem){
							$(elem).tablesorterPager({container: $(elem).next(".pager")});
						});
					});
				</script>
			</head>
			<body>
				<div class="exceptions">
					<h1>Exceptions</h1>
					<xsl:choose>
						<xsl:when test="count(/logs/exceptions/exception) != 0">
							<table>
								<thead>
									<tr>
										<th width="180">Date</th>
										<th width="50">Code</th>
										<th>Message</th>
										<th>File</th>
										<th>Line</th>
										<th>URL</th>
										<th>IP</th>
									</tr>
								</thead>
								<tbody>
									<xsl:apply-templates select="/logs/exceptions/exception" />
								</tbody>
							</table>
							<div class="pager">
								<form>
									<img src="../media/fugue/control-stop-180.png" class="first" />
									<img src="../media/fugue/control-180.png" class="prev" />
									<input type="text" class="pagedisplay" />
									<img src="../media/fugue/control.png" class="next" />
									<img src="../media/fugue/control-stop.png" class="last" />
									<select class="pagesize">
										<option selected="selected"  value="10">10</option>
										<option value="20">20</option>
										<option value="30">30</option>
										<option  value="40">40</option>
									</select>
								</form>
							</div>
						</xsl:when>
						<xsl:otherwise>
							...
						</xsl:otherwise>
					</xsl:choose>
				</div>
				
				<div class="errors">
					<h1>Errors</h1>
					<xsl:choose>
						<xsl:when test="count(/logs/errors/error) != 0">
							<table>
								<thead>
									<tr>
										<th width="170">Date</th>
										<th width="50">Code</th>
										<th>Message</th>
										<th>File</th>
										<th>Line</th>
										<th>URL</th>
										<th>IP</th>
									</tr>
								</thead>
								<tbody>
									<xsl:apply-templates select="/logs/errors/error" />
								</tbody>
							</table>
							<div class="pager">
								<form>
									<img src="../media/fugue/control-stop-180.png" class="first" />
									<img src="../media/fugue/control-180.png" class="prev" />
									<input type="text" class="pagedisplay" />
									<img src="../media/fugue/control.png" class="next" />
									<img src="../media/fugue/control-stop.png" class="last" />
									<select class="pagesize">
										<option selected="selected"  value="10">10</option>
										<option value="20">20</option>
										<option value="30">30</option>
										<option  value="40">40</option>
									</select>
								</form>
							</div>
						</xsl:when>
						<xsl:otherwise>
							...
						</xsl:otherwise>
					</xsl:choose>
				</div>
				
				<div class="messages">
					<h1>Messages</h1>
					<xsl:choose>
						<xsl:when test="count(/logs/messages/message) != 0">
							<table>
								<thead>
									<tr>
										<th width="180">Date</th>
										<th>Category</th>
										<th>Message</th>
										<th>URL</th>
										<th>IP</th>
									</tr>
								</thead>
								<tbody>
									<xsl:apply-templates select="/logs/messages/message" />
								</tbody>
							</table>
							<div class="pager">
								<form>
									<img src="../media/fugue/control-stop-180.png" class="first" />
									<img src="../media/fugue/control-180.png" class="prev" />
									<input type="text" class="pagedisplay" />
									<img src="../media/fugue/control.png" class="next" />
									<img src="../media/fugue/control-stop.png" class="last" />
									<select class="pagesize">
										<option selected="selected"  value="10">10</option>
										<option value="20">20</option>
										<option value="30">30</option>
										<option  value="40">40</option>
									</select>
								</form>
							</div>
						</xsl:when>
						<xsl:otherwise>
							...
						</xsl:otherwise>
					</xsl:choose>
				</div>
			</body>
		</html>
	</xsl:template>

	<!-- Exception template -->
	<xsl:template match="exception">
		<tr>
			<td><xsl:value-of select="@date" /></td>
			<td><xsl:value-of select="@code" /></td>
			<td><xsl:value-of select="@message" /></td>
			<td><xsl:value-of select="@file" /></td>
			<td><xsl:value-of select="@line" /></td>
			<td><xsl:value-of select="@url" /></td>
			<td><xsl:value-of select="@ip" /></td>
		</tr>
	</xsl:template>

	<!-- Error template -->
	<xsl:template match="error">
		<tr>
			<td><xsl:value-of select="@date" /></td>
			<td><xsl:value-of select="@code" /></td>
			<td><xsl:value-of select="@message" /></td>
			<td><xsl:value-of select="@file" /></td>
			<td><xsl:value-of select="@line" /></td>
			<td><xsl:value-of select="@url" /></td>
			<td><xsl:value-of select="@ip" /></td>
		</tr>
	</xsl:template>

	<!-- Message template -->
	<xsl:template match="message">
		<tr>
			<td><xsl:value-of select="@date" /></td>
			<td><xsl:value-of select="@category" /></td>
			<td><xsl:value-of select="@message" /></td>
			<td><xsl:value-of select="@url" /></td>
			<td><xsl:value-of select="@ip" /></td>
		</tr>
	</xsl:template>

</xsl:stylesheet>
				
