Mercurial > hg > nginx-site
comparison xslt/rss.xslt @ 170:cd2698ea00ab
Added generated XSLTs.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Wed, 02 Nov 2011 19:31:11 +0000 |
parents | |
children | c454373427ef |
comparison
equal
deleted
inserted
replaced
169:b7b160e4e046 | 170:cd2698ea00ab |
---|---|
1 <?xml version="1.0" encoding="utf-8"?> | |
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" version="1.0"> | |
3 | |
4 <xsl:output indent="no" encoding="utf-8"/> | |
5 | |
6 <xsl:strip-space elements="*"/> | |
7 | |
8 <xsl:param select="'../xml'" name="XML"/> | |
9 | |
10 <xsl:param name="YEAR"/> | |
11 | |
12 <xsl:variable select="'http://nginx.org'" name="SITE"/> | |
13 | |
14 <xsl:variable select="/news/@link" name="LINK"/> | |
15 | |
16 <xsl:include href="dirname.xslt"/> | |
17 | |
18 <xsl:include href="link.xslt"/> | |
19 | |
20 <xsl:include href="menu.xslt"/> | |
21 | |
22 <xsl:include href="content.xslt"/> | |
23 | |
24 <xsl:template match="/news"> | |
25 | |
26 <rss version="2.0"> | |
27 | |
28 <channel> | |
29 | |
30 <title> | |
31 <xsl:value-of select="@name"/> | |
32 </title> | |
33 | |
34 <link> | |
35 <xsl:value-of select="$SITE"/> | |
36 </link> | |
37 | |
38 <description/> | |
39 | |
40 <xsl:apply-templates select="event"/> | |
41 | |
42 </channel> | |
43 | |
44 </rss> | |
45 </xsl:template> | |
46 | |
47 <xsl:template match="event[position() <= 10]"> | |
48 | |
49 <xsl:variable name="year"> | |
50 <xsl:value-of select="substring(../event[position()=1]/@date, 1, 4)"/> | |
51 </xsl:variable> | |
52 | |
53 <xsl:variable name="y"> | |
54 <xsl:value-of select="substring(@date, 1, 4)"/> | |
55 </xsl:variable> | |
56 | |
57 <xsl:variable name="page"> | |
58 | |
59 <xsl:if test="$year != $y"> | |
60 | |
61 <xsl:value-of select="concat($y, '.html')"/> | |
62 </xsl:if> | |
63 </xsl:variable> | |
64 | |
65 <item> | |
66 | |
67 <title> | |
68 | |
69 <xsl:apply-templates select="para[1]//text()"/> | |
70 </title> | |
71 | |
72 <guid> | |
73 <xsl:value-of select="$SITE"/> | |
74 <xsl:text>/</xsl:text> | |
75 <xsl:value-of select="$page"/> | |
76 <xsl:text>#</xsl:text> | |
77 <xsl:value-of select="@date"/> | |
78 </guid> | |
79 | |
80 <link> | |
81 <xsl:value-of select="$SITE"/> | |
82 <xsl:text>/</xsl:text> | |
83 <xsl:value-of select="$page"/> | |
84 <xsl:text>#</xsl:text> | |
85 <xsl:value-of select="@date"/> | |
86 </link> | |
87 | |
88 <pubdate> | |
89 | |
90 <xsl:value-of select=" concat(date:day-abbreviation(@date), ', ', format-number(date:day-in-month(@date), '00'), ' ', date:month-abbreviation(@date), ' ', date:year(@date), ' 00:00:00 +0300')"/> | |
91 | |
92 </pubdate> | |
93 | |
94 <description> | |
95 | |
96 <xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text> | |
97 | |
98 <xsl:value-of select="@date"/> | |
99 | |
100 <xsl:apply-templates select="para"/> | |
101 | |
102 <xsl:text disable-output-escaping="yes">]]></xsl:text> | |
103 | |
104 </description> | |
105 | |
106 </item> | |
107 </xsl:template> | |
108 | |
109 <xsl:template match="event"/> | |
110 | |
111 </xsl:stylesheet> |