templates/common.xsl
author František Kučera <franta-hg@frantovo.cz>
Tue, 08 Oct 2019 17:21:13 +0200
branchv_0
changeset 58 204f6466c03b
parent 51 21dfb69028a0
permissions -rw-r--r--
cyclomatic complexity, version control systems, resp.

<?xml version="1.0" encoding="UTF-8"?>
<!--
	Sane software manifesto helper tools
	Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)

    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, version 3.

    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 <https://www.gnu.org/licenses/>.
-->
<xsl:stylesheet 
	version="1.0"
	xmlns:m="tag:globalcode.info,2019:sane-software/manifesto"
	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"
	exclude-result-prefixes="fn m xs">
		
	<xsl:template name="version">
		<xsl:param name="tag"/>
		<xsl:param name="distance"/>
		<xsl:param name="hash"/>
		<xsl:param name="changedFiles"/>
		
		<xsl:value-of select="$tag"/>
		<xsl:if test="$distance &gt; 1 or $changedFiles &gt; 0">
			<xsl:text>+</xsl:text>
			<xsl:value-of select="$distance - 1"/>
			<xsl:text> (</xsl:text>
			<xsl:value-of select="$hash"/>
			<xsl:if test="$changedFiles &gt; 0">
				<xsl:text>+</xsl:text>
				<xsl:value-of select="$changedFiles"/>
			</xsl:if>
			<xsl:text>)</xsl:text>
		</xsl:if>
	</xsl:template>

</xsl:stylesheet>