templates/ssm.odt.xsl
author František Kučera <franta-hg@frantovo.cz>
Sat, 05 Oct 2019 21:04:37 +0200
branchv_0
changeset 51 21dfb69028a0
parent 49 1dc027689f93
child 67 78eca0b3ab5f
permissions -rw-r--r--
name: Sane software manifesto (lower case) + move common strings (title, url, author, license) from templates to the XML + fix changed files count + link to own license file

<?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:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
	xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
	xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
	xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
	xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
	xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext: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:import href="common.xsl"/>
	
	<xsl:param name="versionTag"/>
	<xsl:param name="versionDistance"/>
	<xsl:param name="versionHash"/>
	<xsl:param name="versionChangedFiles"/>
	
	<xsl:output 
		method="xml" 
		indent="yes" 
		encoding="UTF-8"/>
		
	<xsl:template match="/m:manifesto">
		<office:document office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
			<xsl:call-template name="styles"/>
			<office:body>
				<office:text>
					<text:p text:style-name="Title">
						<xsl:value-of select="m:title"/>
					</text:p>
					<text:p text:style-name="Subtitle">
						<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>
					</text:p>
					<text:p text:style-name="Paragraph">
						<xsl:value-of select="m:preamble"/>
					</text:p>
					<xsl:apply-templates select="m:chapter"/>
				</office:text>
			</office:body>
		</office:document>
	</xsl:template>
	
	
	<xsl:template match="m:chapter">
		<text:h text:style-name="Heading_1" text:outline-level="1">
			<xsl:value-of select="m:name"/>
		</text:h>
		<text:list text:style-name="List_1">
			<xsl:apply-templates select="m:item"/>
		</text:list>
	</xsl:template>
	
	
	<xsl:template match="m:item">
		<text:list-item>
			<text:p>
				<xsl:apply-templates select="m:text"/>
			</text:p>
			
			<xsl:if test="m:item">
				<text:list text:style-name="List_1">
					<xsl:apply-templates select="m:item"/>
				</text:list>
			</xsl:if>
			
		</text:list-item>
	</xsl:template>
	
	<xsl:template match="m:text">
		<xsl:apply-templates/>
		<xsl:text>&#10;</xsl:text>
	</xsl:template>
	
	<xsl:template name="styles">
		<office:font-face-decls>
			<style:font-face style:name="OpenSymbol" svg:font-family="OpenSymbol" style:font-charset="x-symbol"/>
			<style:font-face style:name="Sawasdee" svg:font-family="Sawasdee" style:font-adornments="Tučné" style:font-pitch="variable"/>
			<style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/>
			<style:font-face style:name="Lohit Devanagari" svg:font-family="&apos;Lohit Devanagari&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
			<style:font-face style:name="Noto Sans CJK SC" svg:font-family="&apos;Noto Sans CJK SC&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
		</office:font-face-decls>
	
		<office:styles>
			<style:default-style style:family="paragraph">
				<style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
				<style:text-properties style:use-window-font-color="true" style:font-name="Liberation Sans" fo:font-size="12pt" fo:language="cs" fo:country="CZ" style:letter-kerning="true" style:font-name-asian="Noto Sans CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
			</style:default-style>
			<style:style style:name="Standard" style:family="paragraph" style:class="text">
				<style:paragraph-properties fo:text-align="justify" style:justify-single-word="false"/>
				<style:text-properties style:font-size-asian="10.5pt"/>
			</style:style>
			<style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Paragraph" style:class="text">
				<style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" loext:contextual-spacing="false" fo:keep-with-next="always"/>
				<style:text-properties style:font-name="Liberation Sans" fo:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable" fo:font-size="14pt" style:font-name-asian="Noto Sans CJK SC" style:font-family-asian="&apos;Noto Sans CJK SC&apos;" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="14pt" style:font-name-complex="Lohit Devanagari" style:font-family-complex="&apos;Lohit Devanagari&apos;" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="14pt"/>
			</style:style>
			<style:style style:name="Paragraph" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
				<style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.247cm" loext:contextual-spacing="false" fo:line-height="115%"/>
				<style:text-properties style:font-name="Liberation Sans" fo:font-family="&apos;Liberation Sans&apos;" style:font-style-name="Běžné" style:font-family-generic="swiss" style:font-pitch="variable" style:font-size-asian="10.5pt"/>
			</style:style>
			<style:style style:name="Title" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Paragraph" style:class="chapter">
				<style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
				<style:text-properties style:font-name="Sawasdee" fo:font-family="Sawasdee" style:font-style-name="Tučné" style:font-pitch="variable" fo:font-size="28pt" fo:font-weight="bold" style:font-size-asian="28pt" style:font-weight-asian="bold" style:font-size-complex="28pt" style:font-weight-complex="bold"/>
			</style:style>
			<style:style style:name="Subtitle" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Paragraph" style:class="chapter">
				<style:paragraph-properties fo:margin-top="0.106cm" fo:margin-bottom="0.212cm" loext:contextual-spacing="false" fo:text-align="center" style:justify-single-word="false"/>
				<style:text-properties fo:font-size="10pt" style:font-size-asian="18pt" style:font-size-complex="18pt"/>
			</style:style>
			<style:style style:name="Heading_1" style:display-name="Heading 1" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Paragraph" style:default-outline-level="1" style:class="text">
				<style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" loext:contextual-spacing="false"/>
				<style:text-properties style:font-name="Sawasdee" fo:font-family="Sawasdee" style:font-style-name="Tučné" style:font-pitch="variable" fo:font-size="130%" fo:font-weight="bold" style:font-size-asian="130%" style:font-weight-asian="bold" style:font-size-complex="130%" style:font-weight-complex="bold"/>
			</style:style>
			<style:style style:name="Footer" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
				<style:paragraph-properties text:number-lines="false" text:line-number="0">
					<style:tab-stops>
						<style:tab-stop style:position="8.5cm" style:type="center"/>
						<style:tab-stop style:position="17cm" style:type="right"/>
					</style:tab-stops>
				</style:paragraph-properties>
				<style:text-properties fo:font-size="6pt"/>
			</style:style>
		
			<style:style style:name="Numbering_20_Symbols" style:display-name="Numbering Symbols" style:family="text"/>
			<text:list-style style:name="List_1" style:display-name="List 1">
				<text:list-level-style-bullet text:level="1" text:style-name="Numbering_20_Symbols" text:bullet-char="•">
					<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
						<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.4cm" fo:text-indent="-0.4cm" fo:margin-left="0.4cm"/>
					</style:list-level-properties>
					<style:text-properties style:font-name="OpenSymbol"/>
				</text:list-level-style-bullet>
				<text:list-level-style-bullet text:level="2" text:style-name="Numbering_20_Symbols" text:bullet-char="•">
					<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
						<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.801cm" fo:text-indent="-0.4cm" fo:margin-left="0.801cm"/>
					</style:list-level-properties>
					<style:text-properties style:font-name="OpenSymbol"/>
				</text:list-level-style-bullet>
				<text:list-level-style-bullet text:level="3" text:style-name="Numbering_20_Symbols" text:bullet-char="•">
					<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
						<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.199cm" fo:text-indent="-0.4cm" fo:margin-left="1.199cm"/>
					</style:list-level-properties>
					<style:text-properties style:font-name="OpenSymbol"/>
				</text:list-level-style-bullet>
			</text:list-style>
		
			<text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
			<text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
		
		</office:styles>
	
		<office:automatic-styles>
			<style:page-layout style:name="pm1">
				<style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm">
					<style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
				</style:page-layout-properties>
				<style:header-style/>
				<style:footer-style>
					<style:header-footer-properties fo:min-height="0cm" fo:margin-top="0.2cm"/>
				</style:footer-style>
			</style:page-layout>
		</office:automatic-styles>
	
		<office:master-styles>
			<style:master-page style:name="Standard" style:page-layout-name="pm1">
				<style:footer>
					<text:p text:style-name="Footer">
						<xsl:value-of select="/m:manifesto/m:title"/>
						<xsl:text> &lt;</xsl:text>
						<xsl:value-of select="/m:manifesto/m:url"/>
						<xsl:text>&gt; Copyright © </xsl:text>
						<xsl:value-of select="/m:manifesto/m:license/m:year"/>
						<xsl:text> </xsl:text>
						<xsl:value-of select="/m:manifesto/m:author"/>
						<xsl:text> </xsl:text>
						<xsl:value-of select="/m:manifesto/m:license/m:abbreviation"/>
						<text:tab/>
						<text:page-number text:select-page="current">1</text:page-number> / <text:page-count>1</text:page-count>
					</text:p>
				</style:footer>
			</style:master-page>
		</office:master-styles>
	</xsl:template>

</xsl:stylesheet>