RSS agregace, #2
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sun, 03 Apr 2011 17:44:58 +0200
changeset 8ad0ee12d13fd
parent 7 5b46493979c9
child 9 71275159d985
RSS agregace, #2
build.xml
šablona/rss.xsl
šablona/stránka.xsl
     1.1 --- a/build.xml	Sun Apr 03 16:51:06 2011 +0200
     1.2 +++ b/build.xml	Sun Apr 03 17:44:58 2011 +0200
     1.3 @@ -30,6 +30,17 @@
     1.4  			</factory>
     1.5  		</xslt>
     1.6  		
     1.7 +		<!-- RSS --> 
     1.8 +		<xslt in="${výstup}/atom.xml" out="${výstup}/rss.xml" style="${šablona}/rss.xsl">			
     1.9 +			<classpath location="/usr/share/java/saxonb-9.0.jar"/>
    1.10 +			<classpath location="${funkce}"/>			
    1.11 +			<factory name="net.sf.saxon.TransformerFactoryImpl">
    1.12 +				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>				
    1.13 +			</factory>
    1.14 +		</xslt>
    1.15 +		
    1.16 +		<!-- TODO: Sitemap.xml -->
    1.17 +		
    1.18  	</target>
    1.19  	
    1.20  	<target name="kompiluj-funkce" description="">		
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/šablona/rss.xsl	Sun Apr 03 17:44:58 2011 +0200
     2.3 @@ -0,0 +1,39 @@
     2.4 +<?xml version="1.0" encoding="UTF-8"?>
     2.5 +<xsl:stylesheet version="2.0"
     2.6 +	xmlns:a="http://www.w3.org/2005/Atom"
     2.7 +	xmlns:g="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/prostor"
     2.8 +	xmlns:j="java:cz.frantovo.xmlWebGenerator.Funkce"
     2.9 +	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    2.10 +	xmlns:fn="http://www.w3.org/2005/xpath-functions"
    2.11 +	xmlns:atom="http://www.w3.org/2005/Atom"
    2.12 +	exclude-result-prefixes="fn g j a">
    2.13 +	<xsl:output	method="xml" indent="yes" encoding="UTF-8"/>
    2.14 +	
    2.15 +	<xsl:template match="/">		
    2.16 +		<rss version="2.0">
    2.17 +			<channel>
    2.18 +				<xsl:variable name="url" select="a:feed/a:link[not(@rel)]/@href"/>
    2.19 +				<title><xsl:value-of select="a:feed/a:title"/></title>
    2.20 +				<link><xsl:value-of select="$url"/></link>
    2.21 +				<description><xsl:value-of select="a:feed/a:subtitle"/></description>				
    2.22 +				<atom:link rel="self" href="{$url}rss.xml"/>
    2.23 +				<xsl:apply-templates select="a:feed/a:entry"/>
    2.24 +			</channel>
    2.25 +		</rss>		
    2.26 +	</xsl:template>
    2.27 +	
    2.28 +	<xsl:template match="a:entry">
    2.29 +		<item>		
    2.30 +			<title><xsl:value-of select="a:title"/></title>
    2.31 +			<link><xsl:value-of select="a:link/@href"/></link>
    2.32 +			<description><xsl:value-of select="a:summary"/></description>
    2.33 +			<guid><xsl:value-of select="a:id"/></guid>
    2.34 +			<pubDate><xsl:value-of select="format-dateTime(a:updated,
    2.35 +                '[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] [Z]',
    2.36 +                'en',
    2.37 +                'ISO',
    2.38 +                'US')"/></pubDate>		
    2.39 +		</item>
    2.40 +	</xsl:template>
    2.41 +	
    2.42 +</xsl:stylesheet>
     3.1 --- a/šablona/stránka.xsl	Sun Apr 03 16:51:06 2011 +0200
     3.2 +++ b/šablona/stránka.xsl	Sun Apr 03 17:44:58 2011 +0200
     3.3 @@ -19,8 +19,8 @@
     3.4  		<html>
     3.5  			<head>
     3.6  				<title><xsl:value-of select="g:stránka/g:nadpis"/></title>
     3.7 -				<link title="Novinky (Atom)" href="atom.xml" type="application/atom+xml" rel="alternate" />
     3.8 -				<link title="Novinky (RSS)" href="rss.xml" type="application/atom+xml" rel="alternate" />				
     3.9 +				<link title="Novinky (Atom)" href="atom.xml" type="application/atom+xml" rel="alternate"/>
    3.10 +				<link title="Novinky (RSS)"  href="rss.xml"  type="application/rss+xml"  rel="alternate"/>				
    3.11  			</head>
    3.12  			<body>
    3.13  				<xsl:apply-templates select="document(fn:encode-for-uri('../vstup/záhlaví.inc'))/g:stránka/h:text/node()"/>