šablona/atom.xsl
author František Kučera <franta-hg@frantovo.cz>
Thu, 24 Oct 2019 21:52:34 +0200
branchv_0
changeset 139 0246f4b2c827
parent 87 25dec6931f18
permissions -rw-r--r--
fix license version: GNU GPLv3

<?xml version="1.0" encoding="UTF-8"?>
<!--
XML Web generátor – program na generování webových stránek
Copyright © 2012 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/>.
-->
<xsl:stylesheet version="2.0"
	xmlns="http://www.w3.org/2005/Atom"
	xmlns:s="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana"
	xmlns:k="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/konfigurace"
	xmlns:j="java:cz.frantovo.xmlWebGenerator.Funkce"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:fn="http://www.w3.org/2005/xpath-functions"
	exclude-result-prefixes="fn s k j">
	<xsl:output	method="xml" indent="yes" encoding="UTF-8"/>

	<xsl:param name="vstupníPřípona" select="'.xml'"/>
	<xsl:param name="výstupníPřípona" select="'.xhtml'"/>

	<xsl:template match="/">

		<xsl:if test="k:web/k:uuid = '399a714c-956e-444c-a8f4-afe8f0df802a'">
			<xsl:message>Vygenerujte si prosím svoje vlastní UUID pro agregované výstupy a uložte ho do souboru web.conf.</xsl:message>
			<!-- Nové UUID si můžete vygenerovat např. příkazem: uuidgen -->
		</xsl:if>

		<feed>
			<title><xsl:value-of select="k:web/k:název"/></title>
			<subtitle><xsl:value-of select="k:web/k:podtitul"/></subtitle>
			<link rel="self" href="{concat(k:web/k:url, 'atom.xml')}"/>
			<link href="{k:web/k:url}"/>
			<updated><xsl:value-of select="current-dateTime()"/></updated>	
			<author>
				<name><xsl:value-of select="k:web/k:autor/k:jméno"/></name>
				<email><xsl:value-of select="k:web/k:autor/k:email"/></email>
			</author>
			<id><xsl:value-of select="concat('urn:uuid:', k:web/k:uuid)"/></id>

			<xsl:variable name="konfigurace" select="/"/>
			<xsl:for-each select="collection(concat('../vstup/?select=*', $vstupníPřípona))[empty(s:stránka/s:skrytá) or not(s:stránka/s:skrytá)]">
				<entry>
					<title><xsl:value-of select="s:stránka/s:nadpis"/></title>
					<xsl:variable name="soubor" select="replace(tokenize(document-uri(.), '/')[last()], $vstupníPřípona, '')"/>
					<link href="{concat($konfigurace/k:web/k:url, encode-for-uri($soubor), $výstupníPřípona)}" />
					<id><xsl:value-of select="concat('urn:', $konfigurace/k:web/k:kod ,':strana:', encode-for-uri($soubor))"/></id>
					<updated><xsl:value-of select="j:posledníZměna(document-uri(.))"/></updated>
					<summary><xsl:value-of select="s:stránka/s:perex"/></summary>
				</entry>
			</xsl:for-each>
			
		</feed>
	</xsl:template>

</xsl:stylesheet>