<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/1999/xhtml">

	<xsl:output method="xml" omit-xml-declaration="no" version="1.0" encoding="UTF-8" indent="yes"/>

	<xsl:template match="benchmark">
		<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/1999/xhtml">
			<head>
				<title><xsl:text>Benchmark run stated </xsl:text><xsl:value-of select="./@date"/><xsl:text> on </xsl:text><xsl:value-of select="./@host"/><xsl:text> running </xsl:text><xsl:value-of select="./@os"/><xsl:text> </xsl:text><xsl:value-of select="./@version"/></title>
				<meta name="ProgId" content="Excel.Sheet"/>
					<style>
						table.xltablebase { mso-displayed-decimal-separator:"\,"; mso-displayed-thousand-separator:"\."; border-collapse: collapse; table-layout:fixed; width:3266pt; }
						col { padding-top:1px; padding-right:1px; padding-left:1px; mso-ignore:padding; color:windowtext; font-size:10.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Arial; mso-generic-font-family:auto; mso-font-charset:0; mso-number-format:General; text-align:general; vertical-align:bottom; mso-background-source:auto; mso-pattern:auto; white-space:nowrap; }
						col.xlcolbase { }
						tr { height:12.75pt }
						td { padding-top:1px; padding-right:1px; padding-left:1px; mso-ignore:padding; color:windowtext; font-size:10.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Arial; mso-generic-font-family:auto; mso-font-charset:0; mso-number-format:General; text-align:general; vertical-align:bottom; mso-background-source:auto; mso-pattern:auto; white-space:nowrap; }
						td.xlcellbase { }
						td.xlcellcount { mso-number-format:"\#\,\#\#0"; }
						td.xlcelltime { mso-number-format:"0\.000\\ \0022s\0022"; }
					</style>
			</head>
			<body>
				<h1><xsl:value-of select="./@host"/></h1>
				<div align="left" x:publishsource="Excel">
					<table border="0" cellpadding="0" cellspacing="0" style="xltablebase">
						<tr height="17">
							<td class="xlcellbase">Algorithm</td>
							<td class="xlcellbase">Size</td>
							<td class="xlcellbase">Wallclocktime</td>
							<td class="xlcellbase">Pagefaults</td>
							<td class="xlcellbase">L2 misses</td>
							<td class="xlcellbase">TLB misses</td>
							<td class="xlcellbase">Comparisons</td>
							<td class="xlcellbase">Moves</td>
							<td class="xlcellbase">Array</td>
							<td class="xlcellbase">Remaps</td>
						</tr>
						<xsl:apply-templates select="run[@execstatus=0]">
							<xsl:sort select="array" order="ascending"/>
							<xsl:sort select="algorithm" order="ascending"/>
							<xsl:sort select="size" data-type="number" order="ascending"/>
						</xsl:apply-templates>
					</table>
					<hr/>
					<p>Errors:</p>
					<table border="0">
					<xsl:apply-templates select="run/error"/>
					</table>
				</div>
			</body>
		</html>
 	</xsl:template>

	<xsl:template match="run">
						<tr height="17">
							<td class="xlcellcount" align="left"><xsl:value-of select="algorithm"/></td>
							<td class="xlcellcount" align="right" x:num="{size}"><xsl:value-of select="size"/></td>
							<td class="xlcelltime" align="right" x:num="{time}"><xsl:value-of select="time"/><xsl:text> </xsl:text><xsl:value-of select="time/@unit"/></td>
							<td class="xlcellcount" align="right" x:num="{pagefaults}"><xsl:value-of select="pagefaults"/></td>
							<td class="xlcellcount" align="right" x:num="{l2misses}"><xsl:value-of select="l2misses"/></td>
							<td class="xlcellcount" align="right" x:num="{tlbmisses}"><xsl:value-of select="tlbmisses"/></td>
							<td class="xlcellcount" align="right" x:num="{comparisons}"><xsl:value-of select="comparisons"/></td>
							<td class="xlcellcount" align="right" x:num="{moves}"><xsl:value-of select="moves"/></td>
							<td class="xlcellcount" align="left"><xsl:value-of select="array"/></td>
							<td class="xlcellcount" align="right" x:num="{remaps}"><xsl:value-of select="remaps"/></td>
						</tr>
 	</xsl:template>

	<xsl:template match="run/error">
					<tr><td width="120"><xsl:text>Text:</xsl:text></td><td><xsl:value-of select="normalize-space(../error)"/></td></tr>
					<tr><td width="120"><xsl:text>Command line:</xsl:text></td><td><xsl:value-of select="normalize-space(../@commandline)"/></td></tr>
					<tr><td width="120"><xsl:text>Host:</xsl:text></td><td><xsl:value-of select="../../@host"/></td></tr>
 	</xsl:template>
 	
	<xsl:template match="item">
				<p class="date">
					<img class="cat" src="{category}.gif" alt="{category}" />
					<xsl:value-of select="day"/>. <xsl:value-of select="month"/><xsl:text> </xsl:text><xsl:value-of select="year"/> kl. <xsl:value-of select="hour"/>:<xsl:value-of select="minute"/>
				</p>
				<xsl:copy-of select="text"/>
 	</xsl:template>
 
</xsl:stylesheet>
