<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright © 2015 František Kučera (frantovo.cz)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

Viz https://blog.frantovo.cz/c/351/CLOC%3A%20po%C4%8D%C3%ADt%C3%A1me%20%C5%99%C3%A1dky%20k%C3%B3du
-->
<xsl:stylesheet version="1.0"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:fn="http://www.w3.org/2005/xpath-functions"
	xmlns:xs="http://www.w3.org/2001/XMLSchema">
	
	<xsl:param name="title">CLOC: statistika počtu řádků</xsl:param>
	
	<xsl:template match="/">
		
		<html xmlns="http://www.w3.org/1999/xhtml">
			<head>
				<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/>
				<title><xsl:value-of select="$title"/></title>
				<style type="text/css">
					body {
						font-family: sans;
						background-color: #eee;
						color: black;
						padding-left: 20px;
					}
					
					table {
						border-collapse:collapse;
						margin-top: 10px;
						margin-bottom: 10px;
					}
					
					td, th {
						border: 1px solid #ddd;
						padding-top: 4px;
						padding-bottom: 4px;
						padding-left: 16px;
						padding-right: 16px;
						font-weight: normal;
						vertical-align: bottom;
					}
					
					th {
						text-align: left;
					}
					
					.number {
						text-align: right;
					}
					
					thead tr, tr.total {
						background: #e8e8e8;
						color:black;
					}
					
					tbody tr:hover {
						background-color: #e9e9e9;
						color:black;
					}
				</style>
			</head>
			<body>
				<h1><xsl:value-of select="$title"/></h1>
				<table class="cloc">
					<thead>
						<tr>
							<th>jazyk</th>
							<th>souborů</th>
							<th>prázdných</th>
							<th>komentářů</th>
							<th>kódu</th>
							<th>celkem</th>
						</tr>
					</thead>
					<tbody>
						<xsl:apply-templates select="/results/languages/language|/results/languages/total"/>
					</tbody>
				</table>
			</body>
		</html>
	</xsl:template>

	
	<xsl:template match="/results/languages/language|/results/languages/total">
		<tr>
			<xsl:if test="name() = 'total'"><xsl:attribute name="class">total</xsl:attribute></xsl:if>
			<td><xsl:value-of select="@name"/><xsl:if test="not(@name)">celkem</xsl:if></td>
			<td class="number"><xsl:value-of select="@files_count"/><xsl:value-of select="@sum_files"/></td>
			<td class="number"><xsl:value-of select="@blank"/></td>
			<td class="number"><xsl:value-of select="@comment"/></td>
			<td class="number"><xsl:value-of select="@code"/></td>
			<td class="number"><xsl:value-of select="@blank + @comment + @code"/></td>
		</tr>
	</xsl:template>
	
</xsl:stylesheet>
