summaryrefslogtreecommitdiff
path: root/gentoobrowse/xslt/news-atom.xslt
blob: bf4350d0734154b1933074758cd86567e72c7f37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns="http://www.w3.org/2005/Atom">
	<xsl:import href="atom.xslt" />
  <xsl:output encoding="utf-8" method="xml" media-type="application/atom+xml" indent="yes" />
	<xsl:variable name="base">http://gentoobrowse.randomdan.homeip.net/</xsl:variable>

	<xsl:template match="/NewsRecent">
		<feed>
			<title>Recent updates &#183; Gentoo Browse</title>
			<subtitle>News</subtitle>
			<link rel="self">
				<xsl:attribute name="href">
					<xsl:value-of select="$base"/>
					<xsl:text>news</xsl:text>
				</xsl:attribute>
			</link>
			<id>
				<xsl:value-of select="$base"/>
				<xsl:text>news</xsl:text>
			</id>
			<updated>
				<xsl:call-template name="atomDate">
					<xsl:with-param name="date" select="articles/article[1]/posted" />
				</xsl:call-template>
			</updated>
			<xsl:apply-templates select="articles/article">
				<xsl:sort select="posted" order="descending" type="string" />
			</xsl:apply-templates>
		</feed>
	</xsl:template>

	<xsl:template match="/NewsRecent/articles/article">
		<entry>
			<title>
				<xsl:value-of select="title" />
			</title>
			<link rel="alternate" type="text/html">
				<xsl:attribute name="href">
					<xsl:value-of select="$base"/>
					<xsl:text>news/</xsl:text>
					<xsl:value-of select="newsid" />
				</xsl:attribute>
			</link>
			<id>
				<xsl:value-of select="$base"/>
				<xsl:text>news/</xsl:text>
				<xsl:value-of select="newsid" />
			</id>
			<updated>
				<xsl:call-template name="atomDate">
					<xsl:with-param name="date" select="posted" />
				</xsl:call-template>
			</updated>
			<summary>
				<xsl:value-of select="title" />
			</summary>
			<content type="xhtml">
				<div xmlns="http://www.w3.org/1999/xhtml">
					<h1>
						<xsl:value-of select="title" />
					</h1>
					<xsl:for-each select="body/element">
						<p><xsl:value-of select="." /></p>
					</xsl:for-each>
				</div>
			</content>
			<author>
				<name>
					<xsl:value-of select="authorname" />
				</name>
				<email>
					<xsl:value-of select="authoremail" />
				</email>
			</author>
		</entry>
	</xsl:template>
</xsl:stylesheet>