templates/ssm.txt.xsl
author František Kučera <franta-hg@frantovo.cz>
Sun, 06 Oct 2019 22:12:47 +0200
branchv_0
changeset 55 fe39d6940821
parent 51 21dfb69028a0
permissions -rw-r--r--
clean-up and update of chapters: Testable Safe code and sustainability Small code footprint Sane dependencies Easily auditable Reproducible builds Trustworthy packages and sources

<?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">
	
	<xsl:import href="common.xsl"/>
	
	<xsl:param name="versionTag"/>
	<xsl:param name="versionDistance"/>
	<xsl:param name="versionHash"/>
	<xsl:param name="versionChangedFiles"/>
	
	<xsl:output 
		method="text" 
		encoding="UTF-8"/>
		
	<xsl:template match="/m:manifesto">
		<xsl:text>                *** </xsl:text>
		<xsl:value-of select="m:title"/>
		<xsl:text> ***&#10;&#10;</xsl:text>
		<xsl:value-of select="m:preamble"/>
		<xsl:text>&#10;&#10;</xsl:text>
		<xsl:apply-templates select="m:chapter"/>
		
		<xsl:text></xsl:text>
		<xsl:text>&#10;&#10;</xsl:text>
		<xsl:text>----------------------------------------------------------------&#10;</xsl:text>
		<xsl:value-of select="m:title"/>
		<xsl:text> &lt;</xsl:text>
		<xsl:value-of select="m:url"/>
		<xsl:text>&gt;&#10;</xsl:text>
		<xsl:text>Copyright © 2019 </xsl:text>
		<xsl:value-of select="m:author"/>
		<xsl:text>&#10;</xsl:text>
		<xsl:text>Version: </xsl:text>
		<xsl:call-template name="version">
			<xsl:with-param name="tag" select="$versionTag"/>
			<xsl:with-param name="distance" select="$versionDistance"/>
			<xsl:with-param name="hash" select="$versionHash"/>
			<xsl:with-param name="changedFiles" select="$versionChangedFiles"/>
		</xsl:call-template>
		<xsl:text>&#10;</xsl:text>
		<xsl:value-of select="m:license/m:prefix"/>
		<xsl:value-of select="m:license/m:name"/>
		<xsl:text> &lt;</xsl:text>
		<xsl:value-of select="m:license/m:url"/>
		<xsl:text>&gt;</xsl:text>
		<xsl:value-of select="m:license/m:suffix"/>
		<xsl:text>&#10;</xsl:text>
		<xsl:text>----------------------------------------------------------------&#10;</xsl:text>
	</xsl:template>
	
	
	<xsl:template match="m:chapter">
		<xsl:text>&#10;=== </xsl:text>
		<xsl:value-of select="m:name"/>
		<xsl:text> ===</xsl:text>
		<xsl:text>&#10;&#10;</xsl:text>
		
		<xsl:apply-templates select="m:item"/>
	</xsl:template>
	
	
	<xsl:template match="m:item">
		<xsl:for-each select="ancestor-or-self::m:item">
			<xsl:text>  </xsl:text>
		</xsl:for-each>
		<xsl:text>- </xsl:text>
		<xsl:apply-templates select="m:text"/>
		<xsl:text>&#10;</xsl:text>
		<xsl:apply-templates select="m:item"/>
	</xsl:template>
	
	<xsl:template match="m:text">
		<xsl:apply-templates/>
		<xsl:text> </xsl:text>
	</xsl:template>

</xsl:stylesheet>