-
Notifications
You must be signed in to change notification settings - Fork 5
/
interface.xsl
381 lines (363 loc) · 13.1 KB
/
interface.xsl
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
<?xml version="1.0" encoding="UTF-8"?>
<!--
Author: Tim Cuthbertson
Modified by Thomas Leonard and Bastian Eicher.
License: Creative Commons Attribution-ShareAlike 2.5 license
http://creativecommons.org/licenses/by-sa/2.5/
-->
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:zi="http://zero-install.sourceforge.net/2004/injector/interface"
version="1.0">
<xsl:output method="xml" encoding="utf-8" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
<xsl:template match="/zi:interface">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Language" content="en"/>
<title><xsl:value-of select="zi:name"/></title>
<link rel="stylesheet" type="text/css" href='https://0install.net/resources/feed.css'/>
</head>
<body>
<div class="site">
<div class="title">
<a href="https://0install.net">https://0install.net</a>
</div>
<div class="main">
<div class="content">
<div class="post inner">
<xsl:variable name="icon-href" select="(zi:icon[@type='image/png'][1])/@href"/>
<xsl:if test="$icon-href != ''">
<img src="{$icon-href}" class="alpha icon"/>
</xsl:if>
<h1><xsl:value-of select="zi:name"/></h1>
<xsl:if test="zi:summary[@xml:lang='en']">
<h2><xsl:value-of select="zi:summary[@xml:lang='en']"/></h2>
</xsl:if>
<xsl:if test="not(zi:summary[@xml:lang='en'])">
<h2><xsl:value-of select="zi:summary"/></h2>
</xsl:if>
<div class="what-is-this">
<xsl:if test="//zi:implementation[@main] | //zi:group[@main] | //zi:command[@name='run'] | //zi:package-implementation[@main]">
<form action="https://get.0install.net/bootstrap/" method="get" style="float: left; margin-right: 4px;">
<input type="hidden" name="name" value="{zi:name}"/>
<input type="hidden" name="uri" value="{/zi:interface/@uri}"/>
<input type="hidden" name="mode" value="run"/>
<input type="submit" value="Run {zi:name}"/>
</form>
<form action="https://get.0install.net/bootstrap/" method="get" style="clear: right;">
<input type="hidden" name="name" value="{zi:name}"/>
<input type="hidden" name="uri" value="{/zi:interface/@uri}"/>
<input type="hidden" name="mode" value="integrate"/>
<input type="submit" value="Integrate {zi:name}"/>
</form>
</xsl:if>
This page is a Zero Install feed.<br/>
<a href="#what-is-this">Learn more...</a>
</div>
<dl>
<xsl:if test="zi:replaced-by">
<dt>This interface is obsolete!</dt>
<dd>
<p class="yourinfo">
Please use this one instead:
</p>
<ul>
<xsl:for-each select="zi:replaced-by">
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="@interface"/>
</xsl:attribute>
<xsl:value-of select="@interface"/>
</a>
</li>
</xsl:for-each>
</ul>
</dd>
</xsl:if>
<xsl:if test="zi:feed-for">
<dt>Interface</dt>
<dd>
<p class="yourinfo">
In most cases, you should use the interface URI instead of this feed's URI.
</p>
<ul>
<xsl:for-each select="zi:feed-for">
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="@interface"/>
</xsl:attribute>
<xsl:value-of select="@interface"/>
</a>
</li>
</xsl:for-each>
</ul>
</dd>
</xsl:if>
<xsl:if test="zi:description[@xml:lang='en']">
<xsl:call-template name='description'>
<xsl:with-param name='text'><xsl:value-of select="zi:description[@xml:lang='en']"/></xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:if test="not(zi:description[@xml:lang='en']) and zi:description">
<xsl:call-template name='description'>
<xsl:with-param name='text'><xsl:value-of select="zi:description"/></xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:apply-templates mode="dl" select="*|@*"/>
<dt>Required libraries</dt>
<dd>
<xsl:choose>
<xsl:when test="//zi:requires|//zi:runner">
<p class="yourinfo">(Zero Install will automatically download any required libraries for you)</p>
<ul>
<xsl:for-each select="//zi:requires|//zi:runner">
<xsl:variable name="interface" select="@interface"/>
<xsl:if test="not(preceding::zi:requires[@interface = $interface]) and not(preceding::zi:runner[@interface = $interface])">
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="$interface"/>
</xsl:attribute>
<xsl:value-of select="$interface"/>
</a>
</li>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:when>
<xsl:otherwise>
<p>This feed does not list any additional requirements.</p>
</xsl:otherwise>
</xsl:choose>
</dd>
<xsl:if test="zi:feed">
<dt>Other feeds for this interface:</dt>
<dd>
<p class="yourinfo">
(Zero Install will also check these feeds when deciding which version to use)
</p>
<ul>
<xsl:for-each select="zi:feed">
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="@src"/>
</xsl:attribute>
<xsl:value-of select="@src"/>
</a>
</li>
</xsl:for-each>
</ul>
</dd>
</xsl:if>
<dt>Available versions</dt>
<dd>
<xsl:choose>
<xsl:when test="//zi:implementation|//zi:package-implementation">
<p class="yourinfo">
(Zero Install will automatically download one of these versions for you)
</p>
<xsl:if test='//zi:implementation'>
<table cellpadding="0" cellspacing="0">
<tr>
<th>Version</th>
<th>Released</th>
<th>Stability</th>
<th>Platform</th>
<th>Download</th>
</tr>
<xsl:for-each select="//zi:implementation">
<tr>
<td>
<xsl:value-of select="(ancestor-or-self::*[@version])[last()]/@version"/>
<xsl:if test="(ancestor-or-self::*[@version])[last()]/@version-modifier">
<xsl:value-of select="(ancestor-or-self::*[@version])[last()]/@version-modifier"/>
</xsl:if>
</td>
<td>
<xsl:value-of select="(ancestor-or-self::*[@released])[last()]/@released"/>
</td>
<td>
<xsl:value-of select="(ancestor-or-self::*[@stability])[last()]/@stability"/>
</td>
<td>
<xsl:variable name="arch" select="(ancestor-or-self::*[@arch])[last()]/@arch"/>
<xsl:choose>
<xsl:when test="$arch = "*-src"">Source code</xsl:when>
<xsl:when test="not($arch)">Any</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$arch"/>
</xsl:otherwise>
</xsl:choose>
</td>
<td>
<xsl:for-each select=".//zi:archive">
<a href="{@href}">Download</a> (<xsl:value-of select="@size"/> bytes)
</xsl:for-each>
<xsl:for-each select=".//zi:file">
<a href="{@href}">Download</a> (<xsl:value-of select="@size"/> bytes)
</xsl:for-each>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:if>
<xsl:if test='//zi:package-implementation'>
<p>Non-Zero Install packages provided by distributions can provide this interface:</p>
<table cellpadding="0" cellspacing="0">
<tr>
<th>Distribution</th>
<th>Package name</th>
</tr>
<xsl:for-each select='//zi:package-implementation'>
<tr>
<td>
<xsl:value-of select='(ancestor-or-self::*[@distributions])[last()]/@distributions'/>
</td>
<td>
<xsl:value-of select='(ancestor-or-self::*[@package])[last()]/@package'/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<p>No versions are available for downlad.</p>
</xsl:otherwise>
</xsl:choose>
</dd>
</dl>
</div>
</div>
<div class="clear"/>
</div>
<div class="chrome">
<div class="inner">
<div class="explanation">
<a name="what-is-this"></a>
<h3>What is this page, and how do I use it?</h3>
<xsl:choose>
<xsl:when test="//zi:implementation[@main] | //zi:group[@main] | //zi:command[@name='run'] | //zi:package-implementation[@main]">
<p>
This is a Zero Install feed. If you have <a href="https://0install.net/">Zero Install</a> on your system you
can use it to run <xsl:value-of select="zi:name"/> from the command-line:
</p>
<pre>0install run <xsl:value-of select="/zi:interface/@uri"/></pre>
<p>
This will download a suitable implementation of <xsl:value-of select="zi:name"/> (along with any dependencies)
and then run it without any side effects for other software on your system.
</p>
</xsl:when>
<xsl:otherwise>
<p>
This is a Zero Install feed for <xsl:value-of select="zi:name"/>.
<xsl:value-of select="zi:name"/> is a library and cannot be run as an application directly.
</p>
<p>
For more information about using Zero Install packages, see the <a href="https://docs.0install.net/packaging/">Zero Install packaging guide</a>.
</p>
</xsl:otherwise>
</xsl:choose>
</div>
</div>
</div>
</div>
<!--
<div class="clear"/>
<div class="inner footer">
</div>
-->
</body>
</html>
</xsl:template>
<xsl:template mode="dl" match="/zi:interface/@uri">
<dt>Full URL</dt>
<dd>
<p>
<a href="{.}">
<xsl:value-of select="."/>
</a>
</p>
</dd>
</xsl:template>
<xsl:template mode="dl" match="zi:homepage">
<dt>Homepage</dt>
<dd>
<p>
<a href="{.}">
<xsl:value-of select="."/>
</a>
</p>
</dd>
</xsl:template>
<xsl:template name='description'>
<xsl:param name="text"/>
<dt>Description</dt>
<dd class="description">
<xsl:if test='normalize-space($text)'>
<xsl:variable name='first' select='substring-before($text, "

")'/>
<xsl:choose>
<xsl:when test='normalize-space($first)'>
<p><xsl:value-of select='$first'/></p>
<xsl:call-template name='description'>
<xsl:with-param name='text'><xsl:value-of select='substring-after($text, "

")'/></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<p><xsl:value-of select='$text'/></p>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</dd>
</xsl:template>
<!-- <xsl:template mode="dl" match="zi:icon"> -->
<!-- <dt>Icon</dt> -->
<!-- <dd> -->
<!-- <p> -->
<!-- <img src="{@href}" class="alpha"/> -->
<!-- </p> -->
<!-- </dd> -->
<!-- </xsl:template> -->
<xsl:template mode="dl" match="*|@*"/>
<xsl:template match="zi:group">
<dl class="group">
<xsl:apply-templates mode="attribs" select="@stability|@version|@id|@arch|@released"/>
<xsl:apply-templates select="zi:group|zi:requires|zi:runner|zi:implementation"/>
</dl>
</xsl:template>
<xsl:template match="zi:requires | zi:runner">
<dt>Requires</dt>
<dd>
<a href="{@interface}">
<xsl:value-of select="@interface"/>
</a>
</dd>
</xsl:template>
<xsl:template match="zi:implementation">
<dl class="impl">
<xsl:apply-templates mode="attribs" select="@stability|@version|@id|@arch|@released"/>
<xsl:apply-templates/>
</dl>
</xsl:template>
<xsl:template mode="attribs" match="@*">
<dt>
<xsl:value-of select="name(.)"/>
</dt>
<dd>
<xsl:value-of select="."/>
</dd>
</xsl:template>
<xsl:template match="zi:archive">
<dt>Download</dt>
<dd>
<a href="{@href}">
<xsl:value-of select="@href"/>
</a>
(<xsl:value-of select="@size"/> bytes)
</dd>
</xsl:template>
</xsl:stylesheet>