šablona/atom.xsl
author František Kučera <franta-hg@frantovo.cz>
Sun, 08 Jan 2012 17:26:24 +0100
changeset 78 7e478bfa5694
parent 61 9503eb8377f1
child 87 25dec6931f18
permissions -rw-r--r--
Definice uživatelských maker nebudeme kopírovat do výstupu, drobnosti.
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <!--
     3 XML Web generátor – program na generování webových stránek
     4 Copyright © 2012 František Kučera (frantovo.cz)
     5 
     6 This program is free software: you can redistribute it and/or modify
     7 it under the terms of the GNU General Public License as published by
     8 the Free Software Foundation, either version 3 of the License, or
     9 (at your option) any later version.
    10 
    11 This program is distributed in the hope that it will be useful,
    12 but WITHOUT ANY WARRANTY; without even the implied warranty of
    13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14 GNU General Public License for more details.
    15 
    16 You should have received a copy of the GNU General Public License
    17 along with this program.  If not, see <http://www.gnu.org/licenses/>.
    18 -->
    19 <xsl:stylesheet version="2.0"
    20 	xmlns="http://www.w3.org/2005/Atom"
    21 	xmlns:s="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana"
    22 	xmlns:k="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/konfigurace"
    23 	xmlns:j="java:cz.frantovo.xmlWebGenerator.Funkce"
    24 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    25 	xmlns:fn="http://www.w3.org/2005/xpath-functions"
    26 	exclude-result-prefixes="fn s k j">
    27 	<xsl:output	method="xml" indent="yes" encoding="UTF-8"/>
    28 	
    29 	<xsl:param name="vstupníPřípona" select="'.xml'"/>
    30 	<xsl:param name="výstupníPřípona" select="'.xhtml'"/>
    31 	
    32 	<xsl:template match="/">
    33 	
    34 		<xsl:if test="k:web/k:uuid = '399a714c-956e-444c-a8f4-afe8f0df802a'">
    35 			<xsl:message>Vygenerujte si prosím svoje vlastní UUID pro agregované výstupy a uložte ho do souboru web.conf.</xsl:message>
    36 			<!-- Nové UUID si můžete vygenerovat např. příkazem: uuidgen -->
    37 		</xsl:if>
    38 	
    39 		<feed>
    40 			<title><xsl:value-of select="k:web/k:název"/></title>
    41 			<subtitle><xsl:value-of select="k:web/k:podtitul"/></subtitle>
    42 			<link rel="self" href="{concat(k:web/k:url, 'atom.xml')}"/>
    43 			<link href="{k:web/k:url}"/>			
    44 			<updated><xsl:value-of select="current-dateTime()"/></updated>			
    45 			<author>
    46 				<name><xsl:value-of select="k:web/k:autor/k:jméno"/></name>
    47 				<email><xsl:value-of select="k:web/k:autor/k:email"/></email>
    48 			</author>
    49 			<id><xsl:value-of select="concat('urn:uuid:', k:web/k:uuid)"/></id>
    50 			
    51 			<xsl:variable name="konfigurace" select="/"/>
    52 			<xsl:for-each select="collection(concat('../vstup/?select=*', $vstupníPřípona))[empty(s:stránka/s:skrytá) or not(s:stránka/s:skrytá)]">
    53 				<entry>
    54 					<title><xsl:value-of select="s:stránka/s:nadpis"/></title>
    55 					<xsl:variable name="soubor" select="replace(tokenize(document-uri(.), '/')[last()], $vstupníPřípona, '')"/>
    56 					<link href="{concat($konfigurace/k:web/k:url, encode-for-uri($soubor), $výstupníPřípona)}" />
    57 					<id><xsl:value-of select="concat('urn:', $konfigurace/k:web/k:kod ,':strana:', encode-for-uri($soubor))"/></id>					
    58 					<updated><xsl:value-of select="j:posledníZměna(document-uri(.))"/></updated>
    59 					<summary><xsl:value-of select="s:stránka/s:perex"/></summary>
    60 				</entry>
    61 			</xsl:for-each>
    62 			
    63 		</feed>
    64 	</xsl:template>
    65 	
    66 </xsl:stylesheet>