site change for posters
[adesklets.git] / site / include / adesklets.xsl
blobdb56eff435e9d32821dd203ab8fd33aba4ac56fb
1 <?xml version="1.0"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4 <!-- XSL stylesheet to convert adesklets xml source website to xhtml
5 ! Written by S.Fourmanoit
6 !-->
8 <xsl:output method="html" encoding="utf8" />
10 <!-- Root element !-->
11 <xsl:template match="page">
12 <html>
13 <head>
14 <title>
15 <xsl:value-of select="title/text()"/>
16 </title>
17 <style type="text/css" media="all">@import "reservoir.css";</style>
18 <script src="http://www.google-analytics.com/urchin.js"
19 type="text/javascript"></script>
20 <script type="text/javascript">
21 _uacct = "UA-70960-1";urchinTracker();
22 </script>
23 </head>
24 <body>
25 <xsl:apply-templates select="*"/>
27 <!--
28 <xsl:value-of name="out" select="count(child::news)"/>
29 !-->
31 <xsl:if test="count(child::info)=1">
32 <xsl:for-each select="child::info">
33 <p id="Footer" class="footer">
34 The latest version is
35 <a href="http://freshmeat.net/projects/adesklets/">
36 <xsl:value-of select="@version" />
37 </a>, and there are <a href="desklets.html">
38 <xsl:value-of
39 select="count(document('../desklets.xml')/page/desklet)"/>
40 desklets</a> listed online
41 (<xsl:value-of
42 select="@last_modified" />).
43 </p>
44 </xsl:for-each>
45 </xsl:if>
46 </body>
47 </html>
48 </xsl:template>
50 <!-- Page title in place !-->
51 <xsl:template match="title">
52 <div id="Header">
53 <h1><xsl:apply-templates /></h1>
54 </div>
55 </xsl:template>
57 <!-- Left menu
58 <menu>
59 <a href=...
60 </menu>
61 !-->
62 <xsl:template match="menu">
63 <div id="Menu">
64 <xsl:for-each select="a">
65 <xsl:if test="@href">
66 <xsl:element name="a">
67 <xsl:attribute name="href">
68 <xsl:value-of select="@href"/>
69 </xsl:attribute>
70 <xsl:apply-templates/>
71 </xsl:element>
72 </xsl:if>
73 <br/>
74 </xsl:for-each>
75 </div>
76 <div id="Logo">
77 <h1>Proudly hosted on:</h1><p>
78 <a href="http://sourceforge.net/projects/adesklets/">
79 <img src="http://sourceforge.net/sflogo.php?group_id=126227&amp;type=5"
80 width="210" height="62" border="0" alt="SourceForge.net Logo" />
81 </a>
82 </p>
83 </div>
84 </xsl:template>
86 <!-- Boxed item
87 <item title="Some title">Some content</item>
88 !-->
89 <xsl:template match="item">
90 <div class="content">
91 <xsl:if test="@title">
92 <h2>
93 <xsl:value-of select="@title"/>
94 </h2>
95 </xsl:if>
96 <xsl:apply-templates/>
97 </div>
98 </xsl:template>
100 <!-- News item
101 <news date="some date" title="some title">Some content</news>
102 !-->
103 <xsl:template match="news">
104 <div class="content">
105 <xsl:choose>
106 <xsl:when test="@date">
107 <h3 class="minititle">
108 <xsl:value-of select="@date"/>
109 <xsl:if test="@title">
110 - <xsl:value-of select="@title"/>
111 </xsl:if>
112 </h3>
113 </xsl:when>
114 <xsl:otherwise>
115 <h3>
116 Unknown date
117 <xsl:if test="@title">
118 - <xsl:value-of select="@title"/>
119 </xsl:if>
120 </h3>
121 </xsl:otherwise>
122 </xsl:choose>
124 <xsl:apply-templates/>
125 </div>
126 </xsl:template>
128 <!-- Desklet description item
129 <desklets name="name" version="version" lang="language"
130 thumbnail="image_uri" screenshot="image_uri"
131 download="download_uri">
132 Description paragraph
133 </desklets>
135 If thumbnail is omitted, link to default values will be created
136 (possible screenshot will ignored). Same thing for download.
137 !-->
138 <xsl:template match="desklet">
139 <div class="content2">
140 <h3 class="minititle">
141 <xsl:value-of select="@name"/>
142 <xsl:text> </xsl:text>
143 <xsl:value-of select="@version"/>
144 </h3>
146 <xsl:choose>
147 <xsl:when test="@thumbnail">
148 <xsl:element name="a">
149 <xsl:attribute name="href">
150 <xsl:value-of select="@screenshot"/>
151 </xsl:attribute>
152 <xsl:element name="img">
153 <xsl:attribute name="class">thumbnail</xsl:attribute>
154 <xsl:attribute name="src">
155 <xsl:value-of select="@thumbnail"/>
156 </xsl:attribute>
157 </xsl:element>
158 </xsl:element>
159 </xsl:when>
160 <xsl:otherwise>
161 <xsl:element name="a">
162 <xsl:attribute name="href">
163 <xsl:text>images/</xsl:text>
164 <xsl:value-of select="@name" />
165 <xsl:text>_screen.jpg</xsl:text>
166 </xsl:attribute>
167 <xsl:element name="img">
168 <xsl:attribute name="class">thumbnail</xsl:attribute>
169 <xsl:attribute name="src">
170 <xsl:text>images/</xsl:text>
171 <xsl:value-of select="@name" />
172 <xsl:text>_thumb.jpg</xsl:text>
173 </xsl:attribute>
174 </xsl:element>
175 </xsl:element>
176 </xsl:otherwise>
177 </xsl:choose>
179 <span><strong>Language:</strong>
180 <xsl:choose>
182 <xsl:when test="@lang">
183 <xsl:value-of select="@lang" />
184 </xsl:when>
185 <xsl:otherwise>
186 Python
187 </xsl:otherwise>
188 </xsl:choose>
189 </span>
191 <xsl:apply-templates/>
194 <xsl:choose>
195 <xsl:when test="@download">
196 <xsl:element name="a">
197 <xsl:attribute name="href">
198 <xsl:value-of select="@download" />
199 </xsl:attribute>
200 Download <xsl:value-of select="@name" />
201 <xsl:text> </xsl:text>
202 <xsl:value-of select="@version"/>
203 </xsl:element>
204 </xsl:when>
205 <xsl:otherwise>
206 <xsl:element name="a">
207 <xsl:attribute name="href">
208 <xsl:text>http://prdownloads.sourceforge.net/adesklets/</xsl:text>
209 <xsl:value-of select="@name" />
210 <xsl:text>-</xsl:text>
211 <xsl:value-of select="@version" />
212 <xsl:text>.tar.bz2?download</xsl:text>
213 </xsl:attribute>
214 Download <xsl:value-of select="@name" />
215 <xsl:text> </xsl:text>
216 <xsl:value-of select="@version"/>
217 </xsl:element>
218 </xsl:otherwise>
219 </xsl:choose>
221 </p>
222 </div>
223 </xsl:template>
225 <xsl:template match="author">
226 <span>
227 <strong>Author: </strong>
229 <xsl:choose>
230 <xsl:when test="@email">
231 <xsl:element name="a">
232 <xsl:attribute name="href">
233 mailto:<xsl:value-of select="@email" />
234 </xsl:attribute>
235 <xsl:value-of select="@name" />
236 </xsl:element>
237 </xsl:when>
238 <xsl:otherwise>
239 <xsl:value-of select="@name" />
240 </xsl:otherwise>
241 </xsl:choose>
242 </span><br />
243 </xsl:template>
245 <!-- Forward port of the HTML equivalent !-->
246 <xsl:template match="a">
247 <xsl:if test="@href">
248 <xsl:element
249 name="a">
250 <xsl:attribute name="href">
251 <xsl:value-of select="@href"/>
252 </xsl:attribute>
253 <xsl:apply-templates/>
254 </xsl:element>
255 </xsl:if>
256 </xsl:template>
258 <!-- Forward port of the HTML equivalent
259 <img src="some_uri" nocolor="">
260 !-->
261 <xsl:template match="img">
262 <xsl:element name="img">
263 <xsl:attribute name="src">
264 <xsl:value-of select="@src"/>
265 </xsl:attribute>
266 <xsl:if test="@nocolor">
267 <xsl:attribute name="class">nocolor</xsl:attribute>
268 </xsl:if>
269 </xsl:element>
270 </xsl:template>
272 <!-- Forward port of the HTML equivalent !-->
273 <xsl:template match="p">
274 <p><xsl:apply-templates/></p>
275 </xsl:template>
277 <xsl:template match="br">
278 <br />
279 </xsl:template>
281 <xsl:template match="h2">
282 <h2><xsl:apply-templates/></h2>
283 </xsl:template>
285 <xsl:template match="strong">
286 <strong><xsl:apply-templates/></strong>
287 </xsl:template>
289 <xsl:template match="em">
290 <em><xsl:apply-templates/></em>
291 </xsl:template>
293 </xsl:stylesheet>