šablona/rss.xsl
author František Kučera <franta-hg@frantovo.cz>
Wed, 06 Jul 2011 18:54:11 +0200
changeset 20 29361e026fa3
parent 18 45e41566f8a6
child 61 9503eb8377f1
permissions -rw-r--r--
Dočasný hack: kompatibilita s Antem verze 1.8.1, Bug 49271
https://issues.apache.org/bugzilla/show_bug.cgi?id=49271

- U XSLT nefunguje „class path“
- collection() má root jinde než ve verzi 1.8.0
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <xsl:stylesheet version="2.0"
     3 	xmlns:a="http://www.w3.org/2005/Atom"
     4 	xmlns:atom="http://www.w3.org/2005/Atom"
     5 	xmlns:j="java:cz.frantovo.xmlWebGenerator.Funkce"
     6 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     7 	xmlns:fn="http://www.w3.org/2005/xpath-functions"
     8 	exclude-result-prefixes="fn j a">
     9 	<xsl:output	method="xml" indent="yes" encoding="UTF-8"/>
    10 	
    11 	<xsl:template match="/">		
    12 		<rss version="2.0">
    13 			<channel>
    14 				<xsl:variable name="url" select="a:feed/a:link[not(@rel)]/@href"/>
    15 				<title><xsl:value-of select="a:feed/a:title"/></title>
    16 				<link><xsl:value-of select="$url"/></link>
    17 				<description><xsl:value-of select="a:feed/a:subtitle"/></description>				
    18 				<atom:link rel="self" href="{$url}rss.xml"/>
    19 				<xsl:apply-templates select="a:feed/a:entry"/>
    20 			</channel>
    21 		</rss>		
    22 	</xsl:template>
    23 	
    24 	<xsl:template match="a:entry">
    25 		<item>		
    26 			<title><xsl:value-of select="a:title"/></title>
    27 			<link><xsl:value-of select="a:link/@href"/></link>
    28 			<description><xsl:value-of select="a:summary"/></description>
    29 			<guid><xsl:value-of select="a:id"/></guid>
    30 			<pubDate><xsl:value-of select="format-dateTime(a:updated,
    31                 '[FNn,*-3], [D01] [MNn,*-3] [Y0001] [H01]:[m01]:[s01] [Z]',
    32                 'en',
    33                 'ISO',
    34                 'US')"/></pubDate>		
    35 		</item>
    36 	</xsl:template>
    37 	
    38 </xsl:stylesheet>