Update to the doc, mainly the FAQ
[adesklets.git] / site / include / adesklets.xsl
blob0de37e9584d2acbef88015e3f3b57d3edc8af333
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="latin1" />
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 </head>
19 <body>
20 <xsl:apply-templates select="*"/>
22 <!--
23 <xsl:value-of name="out" select="count(child::news)"/>
24 !-->
26 <xsl:if test="count(child::info)=1">
27 <xsl:for-each select="child::info">
28 <p id="Footer" class="footer">
29 The latest version is
30 <a href="http://freshmeat.net/projects/adesklets/">
31 <xsl:value-of select="@version" />
32 </a>, and there are <a href="desklets.html">
33 <xsl:value-of
34 select="count(document('../desklets.xml')/page/desklet)"/>
35 desklets</a> listed online
36 (<xsl:value-of
37 select="@last_modified" />).
38 </p>
39 </xsl:for-each>
41 <xsl:text disable-output-escaping="yes">
42 &lt;!--#include virtual="/cgi-bin/counter.sh" --&gt;
43 </xsl:text>
44 </xsl:if>
45 </body>
46 </html>
47 </xsl:template>
49 <!-- Page title in place !-->
50 <xsl:template match="title">
51 <div id="Header">
52 <h1><xsl:apply-templates /></h1>
53 </div>
54 </xsl:template>
56 <!-- Left menu
57 <menu>
58 <a href=...
59 </menu>
60 !-->
61 <xsl:template match="menu">
62 <div id="Menu">
63 <xsl:for-each select="a">
64 <xsl:if test="@href">
65 <xsl:element name="a">
66 <xsl:attribute name="href">
67 <xsl:value-of select="@href"/>
68 </xsl:attribute>
69 <xsl:apply-templates/>
70 </xsl:element>
71 </xsl:if>
72 <br/>
73 </xsl:for-each>
74 </div>
75 <div id="Logo">
76 <h1>Proudly hosted on:</h1><p>
77 <a href="http://sourceforge.net/projects/adesklets/">
78 <img src="http://sourceforge.net/sflogo.php?group_id=126227&amp;type=5"
79 width="210" height="62" border="0" alt="SourceForge.net Logo" />
80 </a>
81 </p>
82 </div>
83 </xsl:template>
85 <!-- Boxed item
86 <item title="Some title">Some content</item>
87 !-->
88 <xsl:template match="item">
89 <div class="content">
90 <xsl:if test="@title">
91 <h2>
92 <xsl:value-of select="@title"/>
93 </h2>
94 </xsl:if>
95 <xsl:apply-templates/>
96 </div>
97 </xsl:template>
99 <!-- News item
100 <news date="some date" title="some title">Some content</news>
101 !-->
102 <xsl:template match="news">
103 <div class="content">
104 <xsl:choose>
105 <xsl:when test="@date">
106 <h3 class="minititle">
107 <xsl:value-of select="@date"/>
108 <xsl:if test="@title">
109 - <xsl:value-of select="@title"/>
110 </xsl:if>
111 </h3>
112 </xsl:when>
113 <xsl:otherwise>
114 <h3>
115 Unknown date
116 <xsl:if test="@title">
117 - <xsl:value-of select="@title"/>
118 </xsl:if>
119 </h3>
120 </xsl:otherwise>
121 </xsl:choose>
123 <xsl:apply-templates/>
124 </div>
125 </xsl:template>
127 <!-- Desklet description item
128 <desklets name="name" version="version"
129 thumbnail="image_uri" screenshot="image_uri"
130 download="download_uri">
131 Description paragraph
132 </desklets>
134 If thumbnail is omitted, link to default values will be created
135 (possible screenshot will ignored). Same thing for download.
136 !-->
137 <xsl:template match="desklet">
138 <div class="content2">
139 <h3 class="minititle">
140 <xsl:value-of select="@name"/>
141 <xsl:text> </xsl:text>
142 <xsl:value-of select="@version"/>
143 </h3>
145 <xsl:choose>
146 <xsl:when test="@thumbnail">
147 <xsl:element name="a">
148 <xsl:attribute name="href">
149 <xsl:value-of select="@screenshot"/>
150 </xsl:attribute>
151 <xsl:element name="img">
152 <xsl:attribute name="class">thumbnail</xsl:attribute>
153 <xsl:attribute name="src">
154 <xsl:value-of select="@thumbnail"/>
155 </xsl:attribute>
156 </xsl:element>
157 </xsl:element>
158 </xsl:when>
159 <xsl:otherwise>
160 <xsl:element name="a">
161 <xsl:attribute name="href">
162 <xsl:text>images/</xsl:text>
163 <xsl:value-of select="@name" />
164 <xsl:text>_screen.jpg</xsl:text>
165 </xsl:attribute>
166 <xsl:element name="img">
167 <xsl:attribute name="class">thumbnail</xsl:attribute>
168 <xsl:attribute name="src">
169 <xsl:text>images/</xsl:text>
170 <xsl:value-of select="@name" />
171 <xsl:text>_thumb.jpg</xsl:text>
172 </xsl:attribute>
173 </xsl:element>
174 </xsl:element>
175 </xsl:otherwise>
176 </xsl:choose>
179 <xsl:apply-templates/>
180 </p>
183 <xsl:choose>
184 <xsl:when test="@download">
185 <xsl:element name="a">
186 <xsl:attribute name="href">
187 <xsl:value-of select="@download" />
188 </xsl:attribute>
189 Download <xsl:value-of select="@name" />
190 <xsl:text> </xsl:text>
191 <xsl:value-of select="@version"/>
192 </xsl:element>
193 </xsl:when>
194 <xsl:otherwise>
195 <xsl:element name="a">
196 <xsl:attribute name="href">
197 <xsl:text>http://prdownloads.sourceforge.net/adesklets/</xsl:text>
198 <xsl:value-of select="@name" />
199 <xsl:text>-</xsl:text>
200 <xsl:value-of select="@version" />
201 <xsl:text>.tar.bz2?download</xsl:text>
202 </xsl:attribute>
203 Download <xsl:value-of select="@name" />
204 <xsl:text> </xsl:text>
205 <xsl:value-of select="@version"/>
206 </xsl:element>
207 </xsl:otherwise>
208 </xsl:choose>
209 </p>
210 </div>
211 </xsl:template>
213 <xsl:template match="author">
214 <div>
215 <strong>Author: </strong>
217 <xsl:choose>
218 <xsl:when test="@email">
219 <xsl:element name="a">
220 <xsl:attribute name="href">
221 mailto:<xsl:value-of select="@email" />
222 </xsl:attribute>
223 <xsl:value-of select="@name" />
224 </xsl:element>
225 </xsl:when>
226 <xsl:otherwise>
227 <xsl:value-of select="@name" />
228 </xsl:otherwise>
229 </xsl:choose>
230 </div>
231 </xsl:template>
233 <!-- Forward port of the HTML equivalent !-->
234 <xsl:template match="a">
235 <xsl:if test="@href">
236 <xsl:element
237 name="a">
238 <xsl:attribute name="href">
239 <xsl:value-of select="@href"/>
240 </xsl:attribute>
241 <xsl:apply-templates/>
242 </xsl:element>
243 </xsl:if>
244 </xsl:template>
246 <!-- Forward port of the HTML equivalent
247 <img src="some_uri" nocolor="">
248 !-->
249 <xsl:template match="img">
250 <xsl:element name="img">
251 <xsl:attribute name="src">
252 <xsl:value-of select="@src"/>
253 </xsl:attribute>
254 <xsl:if test="@nocolor">
255 <xsl:attribute name="class">nocolor</xsl:attribute>
256 </xsl:if>
257 </xsl:element>
258 </xsl:template>
260 <!-- Forward port of the HTML equivalent !-->
261 <xsl:template match="p">
262 <p><xsl:apply-templates/></p>
263 </xsl:template>
265 <xsl:template match="h2">
266 <h2><xsl:apply-templates/></h2>
267 </xsl:template>
269 </xsl:stylesheet>