This repository has been archived by the owner on Aug 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
interface.xsl
197 lines (178 loc) · 7.3 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
<?xml version="1.0" encoding="UTF-8"?>
<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>
<title>
<xsl:value-of select="zi:name"/>
</title>
<style type='text/css'>
html { background: #d0d0ff; }
body { background: #d0d0ff; margin: 0; padding: 0; color: black;}
h1 { text-align: center; border-bottom: 2px solid #d0d0ff; padding-bottom: .5em; }
div.main { padding: 1em; background: white;
-moz-border-radius: 1em 1em 1em 1em; max-width: 60em;
margin-left: auto; margin-right: auto;
margin-top: 1em; margin-bottom: 1em;}
dt { font-weight: bold; text-transform:capitalize; }
dd { padding-bottom: 1em; }
dl.group { margin: 0.5em; padding: 0.5em; border: 1px dashed #888;}
dl.impl { padding: 0.2em 1em 0.2em 1em; margin: 0.5em; border: 1px solid black; background: white;}
pre { background: #ddd; color: black; padding: 0.2cm; }
table { width: 100% }
th { background: #d0d0ff; text-align: left; }
td { background: #e0e0ff; text-align: left; }
</style>
</head>
<body>
<div class='main'>
<h1><xsl:value-of select="zi:name"/> - <xsl:value-of select='zi:summary'/></h1>
<dl>
<dt>Overview</dt>
<dd>
<xsl:choose>
<xsl:when test='//zi:implementation[@main] | //zi:group[@main]'>
<p>This is a Zero Install feed. To add this program to your Applications menu, choose
<b>Zero Install -> Add New Program</b> from the <b>Applications</b> menu. e.g. on Ubuntu:</p>
<p style='text-align: center'>
<img width="335" height="259" src="http://0install.net/tutorial/add-with-gnome.png" alt='Adding with GNOME'/>
</p>
<p>If you don't see this menu item, install the <b>zeroinstall-injector</b> package from your
distribution's repository, or from <a href='http://0install.net/injector.html'>0install.net</a>.</p>
<p>
Drag <a href='{/zi:interface/@uri}'>the feed's URL</a> to the dialog box that appears.
Other environments may use other systems. For example, if you are a ROX desktop user, drag
the link to <a href='http://rox.sourceforge.net/desktop/AddApp'>AddApp</a> instead.
</p>
<p>Alternatively, to run it from the command-line:</p>
<pre>$ 0launch <xsl:value-of select='/zi:interface/@uri'/></pre>
<p>
The <b>0alias</b> command can be used to create a short-cut to run it again later.
</p>
<p>
If you don't have the <b>0launch</b> command, download it from
<a href='http://0install.net/injector.html'>the 0install.net web-site</a>, which also contains
documentation about how the Zero Install system works.</p>
</xsl:when>
<xsl:otherwise>
<p>This is a Zero Install feed.
This software cannot be run as an application directly. It is a library for other programs to use.</p>
<p>For more information about Zero Install, see <a href='http://0install.net'>0install.net</a>.</p>
</xsl:otherwise>
</xsl:choose>
</dd>
<xsl:apply-templates mode='dl' select='*|@*'/>
<dt>Available versions</dt>
<dd>
<xsl:choose>
<xsl:when test='//zi:implementation'>
<p>The list below is just for information; Zero Install will automatically download one of
these versions for you.
</p>
<table>
<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>
<xsl:if test='@langs'>
(<xsl:value-of select='@langs'/>)
</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>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:when>
<xsl:otherwise>
<p>No versions are available for downlad.</p>
</xsl:otherwise>
</xsl:choose>
</dd>
<dt>Required libraries</dt>
<dd>
<xsl:choose>
<xsl:when test='//zi:requires'>
<p>The list below is just for information; Zero Install will automatically download any required
libraries for you.
</p>
<ul>
<xsl:for-each select='//zi:requires'>
<xsl:variable name='interface' select='@interface'/>
<xsl:if test='not(preceding::zi:requires[@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>
</dl>
</div>
</body>
</html>
</xsl:template>
<xsl:template mode='dl' match='/zi:interface/@uri'>
<dt>Full name</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 mode='dl' match='zi:description'>
<xsl:if test="not(@xml:lang)">
<dt>Description</dt><dd><p><xsl:value-of select="."/></p></dd>
</xsl:if>
</xsl:template>
<xsl:template mode='dl' match='zi:icon'>
<dt>Icon</dt><dd><p><img src='{@href}'/></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:implementation'/>
</dl>
</xsl:template>
<xsl:template match='zi:requires'>
<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>