<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl">

<!-- Root template -->
<xsl:template match="/">
	<html>
		<head>
			<title>Graph Statistics</title>
			<link href="StatsReport.css" type="text/css" rel="stylesheet"/>
		</head>
		<body>
			<xsl:apply-templates select="StatsReport"/>
		</body>
	</html>
</xsl:template>

<!-- StatsReport template -->
<xsl:template match="StatsReport"><xsl:apply-templates select="GraphStatistics"/></xsl:template>

<!-- GraphStatistics template -->
<xsl:template match="GraphStatistics">
	<h1><xsl:value-of select="@Name"/></h1>
	<table class="tbl">
		<thead>
			<tr>
				<th class="hr" style="">Time</th>
				<xsl:apply-templates select="StatisticList"/>
			</tr>
		</thead>
		<tbody>
			<xsl:apply-templates select="Sample"/>
		</tbody>
	</table>
</xsl:template>

<!-- StatsReport/GraphStatistics/StatisticList template -->
<xsl:template match="StatisticList">
	<xsl:apply-templates select="Statistic"/>
</xsl:template>

<!-- StatsReport/GraphStatistics/StatisticList/Statistic template -->
<xsl:template match="Statistic">
	<th class="hr" style="width=100px;"><xsl:value-of select="node()"/></th>
</xsl:template>

<!-- StatsReport/GraphStatistics/Sample template -->
<xsl:template match="Sample">
	<tr>
		<td class="rr"><xsl:value-of select="@Time"/></td>
		<xsl:apply-templates select="Value"/>
	</tr>
</xsl:template>

<!-- StatsReport/GraphStatistics/StatisticList/Sample/Value template -->
<xsl:template match="Value">
	<td class="rr"><xsl:value-of select="node()"/></td>
</xsl:template>

</xsl:stylesheet>
