šablona/rss.xsl
author František Kučera <franta-hg@frantovo.cz>
Sun, 16 Dec 2018 13:42:25 +0100
branchv_0
changeset 215 c7e88edaedc5
parent 87 25dec6931f18
permissions -rw-r--r--
examples: Writing an output filter in Bash: comment

<?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:a="http://www.w3.org/2005/Atom"
	xmlns:atom="http://www.w3.org/2005/Atom"
	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 j a">
	<xsl:output	method="xml" indent="yes" encoding="UTF-8"/>

	<xsl:template match="/">
		<rss version="2.0">
			<channel>
				<xsl:variable name="url" select="a:feed/a:link[not(@rel)]/@href"/>
				<title><xsl:value-of select="a:feed/a:title"/></title>
				<link><xsl:value-of select="$url"/></link>
				<description><xsl:value-of select="a:feed/a:subtitle"/></description>
				<atom:link rel="self" href="{$url}rss.xml"/>
				<xsl:apply-templates select="a:feed/a:entry"/>
			</channel>
		</rss>
	</xsl:template>

	<xsl:template match="a:entry">
		<item>
			<title><xsl:value-of select="a:title"/></title>
			<link><xsl:value-of select="a:link/@href"/></link>
			<description><xsl:value-of select="a:summary"/></description>
			<guid><xsl:value-of select="a:id"/></guid>
			<pubDate><xsl:value-of select="format-dateTime(a:updated,
				'[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] [Z]',
				'en',
				'ISO',
				'US')"/></pubDate>
		</item>
	</xsl:template>

</xsl:stylesheet>