Debian Codegraph @

misc/0install/interface.xsl

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:zi="http://zero-install.sourceforge.net/2004/injector/interface"
5 version="1.0">
6 <xsl:output method="xml" encoding="utf-8"
7 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
8 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
9 <xsl:template match="/zi:interface">
10 <html>
11 <head>
12 <title>
13 <xsl:value-of select="zi:name"/><xsl:if test="zi:summary and zi:summary != zi:name">—<xsl:value-of select="zi:summary"/></xsl:if>
14 </title>
15 <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato%3A400%2C700%2C900%2C400italic%2C700italic&#038;subset=latin%2Clatin-ext" type="text/css" media="all" />
16 <link rel="stylesheet" href="../theme/readme.css" />
17 <link rel="stylesheet" href="interface1.css" />
18 </head>
19 <body>
20 <h1>
21 <xsl:variable name="icon-href" select="(zi:icon[@type='image/png'][1])/@href"/>
22 <xsl:if test="$icon-href != ''">
23 <span class="reflect"><img id="icon"
24 src="{$icon-href}"
25 alt="" /></span>
26 <xsl:text> </xsl:text>
27 </xsl:if>
28 <xsl:choose>
29 <xsl:when test="zi:homepage">
30 <a href="{zi:homepage}">
31 <xsl:value-of select="zi:name"/>
32 </a>
33 </xsl:when>
34 <xsl:otherwise>
35 <a href="http://{zi:name}.org/">
36 <xsl:value-of select="zi:name"/>
37 </a>
38 </xsl:otherwise>
39 </xsl:choose>
40 <xsl:if test="zi:summary and zi:summary != zi:name">
41 <span><span class="dash">—</span><xsl:value-of select="zi:summary"/></span>
42 </xsl:if>
43 </h1>
44 <div id="info">
45 <h2>
46 This is a <strong><img src="0install-icon.png"
47 alt="" />
48 Zero Install</strong> feed.
49 </h2>
50 <xsl:choose>
51 <xsl:when test="zi:replaced-by">
52 <p>
53 This interface is obsolete! Please use this one
54 instead:
55 </p>
56 <div id="box">
57 <xsl:for-each select="zi:replaced-by">
58 <p>
59 <a class="button">
60 <xsl:attribute name="href">
61 <xsl:value-of select="@interface"/>
62 </xsl:attribute>
63 <xsl:value-of select="@interface"/>
64 </a>
65 </p>
66 </xsl:for-each>
67 </div>
68 </xsl:when>
69 <xsl:when test="//zi:implementation[@main] | //zi:group[@main] | //zi:command | //zi:package-implementation[@main] | //zi:entry-point">
70 <xsl:choose>
71 <xsl:when test="//zi:entry-point">
72 <p>
73 To add this program to your Applications menu,
74 choose <strong>Zero Install (0install)</strong>
75 from your <strong>Applications</strong> menu
76 (“Start” menu under Windows), and <strong>drag
77 this feed's URL into the window that
78 opens.</strong>
79 </p>
80 <p>
81 If you don't see this menu item, install the
82 <code>zeroinstall-injector</code> package from
83 your distribution's repository, or from
84 <a href="http://0install.net/injector.html">0install.net</a>.
85 </p>
86 <div id="box">
87 <p>
88 <img src="0install.png" alt="" />
89 </p>
90 <p>
91 <a class="button" href="{/zi:interface/@uri}">
92 <xsl:value-of select="/zi:interface/@uri"/>
93 </a>
94 </p>
95 <xsl:if test="zi:feed-for">
96 <p>
97 In most cases, you should use the
98 interface URI instead of this feed's
99 URI.
100 </p>
101 <xsl:for-each select="zi:feed-for">
102 <p>
103 <a class="button">
104 <xsl:attribute name="href">
105 <xsl:value-of select="@interface"/>
106 </xsl:attribute>
107 <xsl:value-of select="@interface"/>
108 </a>
109 </p>
110 </xsl:for-each>
111 </xsl:if>
112 </div>
113 <p>
114 Alternatively, to run it from the command-line:
115 </p>
116 </xsl:when>
117 <xsl:otherwise>
118 <p>
119 To run this program from the command-line:
120 </p>
121 </xsl:otherwise>
122 </xsl:choose>
123
124 <p>
125 <code>
126 0launch
127 <xsl:choose>
128 <xsl:when test="//zi:implementation[@main] | //zi:group[@main] | //zi:command[@name='run'] | //zi:package-implementation[@main]">
129 </xsl:when>
130 <xsl:otherwise>
131 --command=COMMAND
132 </xsl:otherwise>
133 </xsl:choose>
134 <xsl:value-of select="/zi:interface/@uri"/>
135 </code>
136 </p>
137 <p>
138 The <code>0alias</code> command can be used to
139 create a short-cut to run it again later. If you
140 don't have the <code>0launch</code> command,
141 download it from
142 <a href="http://0install.net/injector.html">0install.net</a>,
143 which also contains documentation about how the
144 Zero Install system works.
145 </p>
146 </xsl:when>
147 <xsl:otherwise>
148 <p>
149 This software cannot be run as an application
150 directly. It is a library for other programs to
151 use.
152 </p>
153 <p>
154 For more information about Zero Install, see
155 <a href="http://0install.net">0install.net</a>.
156 </p>
157 </xsl:otherwise>
158 </xsl:choose>
159 </div>
160 <div class="main" id="content">
161 <xsl:apply-templates mode="dl" select="*|@*"/>
162 <xsl:choose>
163 <xsl:when test="zi:entry-point">
164 <h2>Provides</h2>
165 <xsl:for-each select="zi:entry-point">
166 <div class="entry-point">
167 <xsl:variable name="icon-href" select="(zi:icon[@type='image/png'][1])/@href"/>
168 <xsl:if test="$icon-href != ''">
169 <img src="{$icon-href}"
170 alt="" />
171 </xsl:if>
172 <div>
173 <h3><xsl:value-of select="zi:name"/></h3>
174 <p><xsl:value-of select="zi:description"/></p>
175 </div>
176 </div>
177 </xsl:for-each>
178 </xsl:when>
179 <xsl:otherwise>
180 <xsl:if test="//zi:command[@name!='run']">
181 <h2>Provides</h2>
182 <ul>
183 <xsl:for-each select="//zi:command">
184 <li>
185 <xsl:value-of select="@name"/>
186 </li>
187 </xsl:for-each>
188 </ul>
189 </xsl:if>
190 </xsl:otherwise>
191 </xsl:choose>
192 <h2>Required libraries</h2>
193 <xsl:choose>
194 <xsl:when test="//zi:requires|//zi:runner">
195 <p>
196 The list below is just for information; Zero
197 Install will automatically download any required
198 libraries for you.
199 </p>
200 <ul>
201 <xsl:for-each select="//zi:requires|//zi:runner">
202 <xsl:variable name="interface"
203 select="@interface"/>
204 <xsl:if test="not(preceding::zi:requires[@interface = $interface]) and not(preceding::zi:runner[@interface = $interface])">
205 <li>
206 <a>
207 <xsl:attribute name="href">
208 <xsl:value-of select="$interface"/>
209 </xsl:attribute>
210 <xsl:value-of select="$interface"/>
211 </a>
212 </li>
213 </xsl:if>
214 </xsl:for-each>
215 </ul>
216 </xsl:when>
217 <xsl:otherwise>
218 <p>
219 This feed does not list any additional
220 requirements.
221 </p>
222 </xsl:otherwise>
223 </xsl:choose>
224 <xsl:if test="zi:feed">
225 <h2>Other feeds for this interface</h2>
226 <p>
227 Zero Install will also check these feeds when
228 deciding which version to use.
229 </p>
230 <ul>
231 <xsl:for-each select="zi:feed">
232 <li>
233 <a>
234 <xsl:attribute name="href">
235 <xsl:value-of select="@src"/>
236 </xsl:attribute>
237 <xsl:value-of select="@src"/>
238 </a>
239 </li>
240 </xsl:for-each>
241 </ul>
242 </xsl:if>
243 <h2>Available versions</h2>
244 <xsl:choose>
245 <xsl:when test="//zi:implementation|//zi:package-implementation">
246 <p>
247 The list below is just for information; Zero
248 Install will automatically download one of these
249 versions for you.
250 </p>
251 <xsl:if test="//zi:implementation">
252 <div id="friendlybox">
253 <table id="get">
254 <tr>
255 <th>Version</th>
256 <th>Released</th>
257 <th>Stability</th>
258 <th>Platform</th>
259 <th>Archive</th>
260 </tr>
261 <xsl:for-each select="//zi:implementation">
262 <xsl:variable name="stability"
263 select="(ancestor-or-self::*[@stability])[last()]/@stability"/>
264 <tr>
265 <xsl:if test="$stability = 'buggy' or $stability = 'insecure'">
266 <xsl:attribute name="style">
267 opacity: .5
268 </xsl:attribute>
269 </xsl:if>
270 <td>
271 <h2>
272 <xsl:if test="$stability = 'buggy' or $stability = 'insecure'">
273 <xsl:attribute name="style">
274 text-decoration: line-through
275 </xsl:attribute>
276 </xsl:if>
277 <xsl:value-of select="(ancestor-or-self::*[@version])[last()]/@version"/>
278 <xsl:if test="(ancestor-or-self::*[@version])[last()]/@version-modifier">
279 <xsl:value-of select="(ancestor-or-self::*[@version])[last()]/@version-modifier"/>
280 </xsl:if>
281 <xsl:if test="$stability = 'testing' or $stability = 'developer' or contains(.//zi:archive/@href, 'snapshot')">
282 Beta
283 </xsl:if>
284 </h2>
285 <xsl:if test="@langs">
286 (<xsl:value-of select="@langs"/>)
287 </xsl:if>
288 </td>
289 <td>
290 <xsl:value-of select="(ancestor-or-self::*[@released])[last()]/@released"/>
291 </td>
292 <td>
293 <xsl:value-of select="(ancestor-or-self::*[@stability])[last()]/@stability"/>
294 </td>
295 <td>
296 <xsl:variable name="arch"
297 select="(ancestor-or-self::*[@arch])[last()]/@arch"/>
298 <xsl:choose>
299 <xsl:when test="$arch = '*-src'">
300 Source code
301 </xsl:when>
302 <xsl:when test="not($arch) or $arch = '*-*'">
303 Any
304 </xsl:when>
305 <xsl:otherwise>
306 <xsl:value-of select="$arch"/>
307 </xsl:otherwise>
308 </xsl:choose>
309 </td>
310 <td class="download">
311 <xsl:apply-templates select=".//zi:archive | .//zi:file" />
312 </td>
313 </tr>
314 </xsl:for-each>
315 </table>
316 </div>
317 </xsl:if>
318 <xsl:if test="//zi:package-implementation">
319 <p>
320 Non-Zero Install packages
321 provided by distributions can
322 provide this interface:
323 </p>
324 <table id="packages">
325 <tr>
326 <th>Distribution</th>
327 <th>Package name</th>
328 </tr>
329 <xsl:for-each select="//zi:package-implementation">
330 <tr>
331 <td>
332 <xsl:value-of select="(ancestor-or-self::*[@distributions])[last()]/@distributions"/>
333 </td>
334 <td>
335 <xsl:value-of select="(ancestor-or-self::*[@package])[last()]/@package"/>
336 </td>
337 </tr>
338 </xsl:for-each>
339 </table>
340 </xsl:if>
341 </xsl:when>
342 <xsl:otherwise>
343 <p>
344 No versions are available for downlad.
345 </p>
346 </xsl:otherwise>
347 </xsl:choose>
348 </div>
349 </body>
350 </html>
351 </xsl:template>
352 <!--xsl:template mode="dl" match="/zi:interface/@uri">
353 <dt>Full URL</dt>
354 <dd>
355 <p>
356 <a href="{.}">
357 <xsl:value-of select="."/>
358 </a>
359 </p>
360 </dd>
361 </xsl:template-->
362 <!--xsl:template mode="dl" match="zi:homepage">
363 <dt>Homepage</dt>
364 <dd>
365 <p>
366 <a href="{.}">
367 <xsl:value-of select="."/>
368 </a>
369 </p>
370 </dd>
371 </xsl:template-->
372 <xsl:template mode="dl" match="zi:description">
373 <h2>Description</h2>
374 <div class="description">
375 <xsl:call-template name="description">
376 <xsl:with-param name="text"><xsl:value-of select="."/></xsl:with-param>
377 </xsl:call-template>
378 </div>
379 </xsl:template>
380 <xsl:template name="description">
381 <xsl:param name="text"/>
382 <xsl:if test="normalize-space($text)">
383 <xsl:variable name="first" select="substring-before($text, '&#xa;&#xa;')"/>
384 <xsl:choose>
385 <xsl:when test="normalize-space($first)">
386 <p><xsl:value-of select="$first"/></p>
387 <xsl:call-template name="description">
388 <xsl:with-param name="text"><xsl:value-of select="substring-after($text, '&#xa;&#xa;')"/></xsl:with-param>
389 </xsl:call-template>
390 </xsl:when>
391 <xsl:otherwise>
392 <p><xsl:value-of select="$text"/></p>
393 </xsl:otherwise>
394 </xsl:choose>
395 </xsl:if>
396 </xsl:template>
397 <!--xsl:template mode="dl" match="zi:icon">
398 <dt>Icon</dt>
399 <dd>
400 <p>
401 <img src="{@href}" class="alpha"/>
402 </p>
403 </dd>
404 </xsl:template-->
405 <xsl:template mode="dl" match="*|@*"/>
406 <xsl:template match="zi:group">
407 <dl class="group">
408 <xsl:apply-templates mode="attribs"
409 select="@stability|@version|@id|@arch|@released"/>
410 <xsl:apply-templates select="zi:group|zi:requires|zi:runner|zi:implementation"/>
411 </dl>
412 </xsl:template>
413 <xsl:template match="zi:requires | zi:runner">
414 <dt>Requires</dt>
415 <dd>
416 <a href="{@interface}">
417 <xsl:value-of select="@interface"/>
418 </a>
419 </dd>
420 </xsl:template>
421 <xsl:template match="zi:implementation">
422 <dl class="impl">
423 <xsl:apply-templates mode="attribs"
424 select="@stability|@version|@id|@arch|@released"/>
425 <xsl:apply-templates/>
426 </dl>
427 </xsl:template>
428 <xsl:template mode="attribs" match="@*">
429 <dt>
430 <xsl:value-of select="name(.)"/>
431 </dt>
432 <dd>
433 <xsl:value-of select="."/>
434 </dd>
435 </xsl:template>
436 <xsl:template match="zi:archive | zi:file">
437 <xsl:variable name="stability"
438 select="(ancestor-or-self::*[@stability])[last()]/@stability"/>
439 <span>
440 <xsl:if test="$stability = 'buggy' or $stability = 'insecure'">
441 <xsl:attribute name="style">
442 visibility: hidden
443 </xsl:attribute>
444 </xsl:if>
445 <a href="{@href}">Download</a>
446 (<xsl:value-of select="format-number(@size div 1024 div 1024, '####0.00')"/> MiB)
447 </span>
448 </xsl:template>
449 </xsl:stylesheet>