Debian Codegraph @

gavo/resources/web/xsl/vosi.xsl

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!-- A stylesheet to make VOSI responses (table, capability and availability)
4 palatable for web browsers.
5
6 This stylesheet is made available under CC-0 by the GAVO project,
7 http://www.g-vo.org.
8 See http://creativecommons.org/publicdomain/zero/1.0/ for details.
9 -->
10
11 <xsl:stylesheet
12 xmlns:avl="http://www.ivoa.net/xml/VOSIAvailability/v1.0"
13 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
14 xmlns:ri="http://www.ivoa.net/xml/RegistryInterface/v1.0"
15 xmlns:cap="http://www.ivoa.net/xml/VOSICapabilities/v1.0"
16 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
17 xmlns:vtm="http://www.ivoa.net/xml/VOSITables/v1.0"
18 xmlns:g-colstat="http://dc.g-vo.org/ColStats-1"
19 xmlns="http://www.w3.org/1999/xhtml"
20 version="1.0">
21
22 <xsl:include href="dachs-xsl-config.xsl"/>
23
24 <!-- ############################################## Global behaviour -->
25
26 <xsl:output method="xml"
27 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
28 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
29
30 <!-- Don't spill the content of unknown elements. -->
31 <xsl:template match="text()"/>
32
33
34 <!-- ################################### VOSI availability templates -->
35
36 <xsl:template match="avl:available">
37 <p>This service is <strong>
38 <xsl:choose>
39 <xsl:when test=".='true'">up</xsl:when>
40 <xsl:when test=".='false'">down</xsl:when>
41 <xsl:otherwise>broken</xsl:otherwise>
42 </xsl:choose></strong></p>
43 </xsl:template>
44
45 <xsl:template match="avl:upSince">
46 <p>It has been up since <xsl:value-of select="."/>.</p>
47 </xsl:template>
48
49 <xsl:template match="avl:downAt">
50 <p>It will go offline approximately at <xsl:value-of select="."/>.</p>
51 </xsl:template>
52
53 <xsl:template match="avl:backAt">
54 <p>The operators predict it will be back at
55 <xsl:value-of select="."/>.</p>
56 </xsl:template>
57
58 <xsl:template match="avl:note">
59 <p><xsl:value-of select="."/></p>
60 </xsl:template>
61
62 <xsl:template match="avl:availability">
63 <html>
64 <head>
65 <title>Service availability</title>
66 <xsl:call-template name="localCompleteHead"/>
67 </head>
68 <body>
69 <h1>Availability information for this service</h1>
70 <xsl:apply-templates/>
71 <p><em>All times in UTC</em></p>
72 <xsl:call-template name="localMakeFoot"/>
73 </body>
74 </html>
75 </xsl:template>
76
77
78 <!-- ################################### VOSI capabilities templates -->
79
80 <xsl:template match="identifier"/>
81
82 <xsl:template match="curation">
83 <dl class="curation">
84 <xsl:apply-templates/>
85 </dl>
86 </xsl:template>
87
88 <xsl:template match="content">
89 <div class="content">
90 <p>Further information may be found at the
91 <a>
92 <xsl:attribute name="href">
93 <xsl:value-of select="referenceURL"/>
94 </xsl:attribute>
95 reference URL</a>.
96 </p>
97 <xsl:apply-templates/>
98 </div>
99 </xsl:template>
100
101 <xsl:template match="title">
102 <p class="vosititle"><xsl:value-of select="."/></p>
103 </xsl:template>
104
105 <xsl:template match="publisher">
106 <dt>Publisher</dt><dd><xsl:value-of select="."/></dd>
107 </xsl:template>
108
109 <xsl:template match="creator/name">
110 <xsl:value-of select="."/>
111 </xsl:template>
112
113 <xsl:template match="creator/logo">
114 <xsl:text> </xsl:text>
115 <img alt="[Creator logo]">
116 <xsl:attribute
117 name="src"><xsl:value-of select="."/></xsl:attribute>
118 </img>
119 </xsl:template>
120
121 <xsl:template match="creator">
122 <dt>Created by</dt><dd><xsl:apply-templates/></dd>
123 </xsl:template>
124
125 <xsl:template match="contact">
126 <dt>Contact</dt>
127 <dd>
128 <xsl:value-of select="name"/><br/>
129 <xsl:value-of select="address"/><br/>
130 <xsl:value-of select="email"/><br/>
131 <xsl:value-of select="telephone"/><br/>
132 </dd>
133 </xsl:template>
134
135 <xsl:template match="content/description">
136 <p><strong>Description: </strong><xsl:value-of select="."/></p>
137 </xsl:template>
138
139 <xsl:template match="accessURL">
140 <a>
141 <xsl:attribute name="href">
142 <xsl:value-of select="."/>
143 </xsl:attribute>
144 <xsl:value-of select="."/>
145 </a>
146 </xsl:template>
147
148 <xsl:template match="param">
149 <dt>Parameter <strong><xsl:value-of select="name"/></strong>
150 <xsl:if test="unit">
151 [<xsl:value-of select="unit"/>]
152 </xsl:if>
153 </dt>
154 <dd><xsl:value-of select="dataType"/><xsl:if
155 test="dataType/@arraysize">[<xsl:value-of
156 select="dataType/@arraysize"/>]</xsl:if>
157
158 <xsl:if test="ucd">,
159 <em><xsl:value-of select="ucd"/></em>
160 </xsl:if><br/>
161 <xsl:value-of select="description"/>
162 </dd>
163 </xsl:template>
164
165 <xsl:template match="interface">
166 <dt>Interface
167 <xsl:if test="@xsi:type">
168 <xsl:value-of select="@xsi:type"/>
169 </xsl:if>
170 </dt>
171 <dd>
172 <xsl:apply-templates select="accessURL"/>
173 <xsl:if test="param">
174 <dt>Parameters</dt>
175 <dd class="parlist">
176 <xsl:apply-templates select="param"/>
177 </dd>
178 </xsl:if>
179 </dd>
180 </xsl:template>
181
182 <xsl:template match="dataModel">
183 <dt>Data model
184 <xsl:value-of select="."/>
185 </dt>
186 <dd>
187 <xsl:value-of select="@ivo-id"/>
188 </dd>
189 </xsl:template>
190
191 <xsl:template match="language/version">
192 Version <xsl:value-of select="."/>;
193 </xsl:template>
194
195 <xsl:template match="description" priority="0">
196 <xsl:value-of select="."/>
197 </xsl:template>
198
199 <xsl:template match="feature">
200 <dt class="udfsig"><xsl:value-of select="form"/></dt>
201 <dd><xsl:value-of select="description"/></dd>
202 </xsl:template>
203
204 <xsl:template match="feature" mode="function">
205 <dt class="udfsig">
206 <xsl:attribute name="id">
207 <xsl:value-of select="concat(
208 substring-before(form, '('),
209 string(string-length(form)))"/>
210 </xsl:attribute>
211 <xsl:value-of select="form"/></dt>
212 <dd><xsl:value-of select="description"/></dd>
213 </xsl:template>
214
215 <xsl:template match="languageFeatures">
216 <dt>
217 <p class="sechdr"><xsl:value-of select="@type"/> Features</p>
218 </dt>
219 <dd>
220 <dl>
221 <xsl:apply-templates mode="function"/>
222 </dl>
223 </dd>
224 </xsl:template>
225
226 <xsl:template match="languageFeatures[@type='ivo://ivoa.net/std/TAPRegExt#features-udf']">
227 <dt>
228 <p class="sechdr">User Defined Functions</p>
229 </dt>
230 <dd>
231 <dl>
232 <xsl:apply-templates mode="function"/>
233 </dl>
234 </dd>
235 </xsl:template>
236
237 <xsl:template match="languageFeatures[@type='ivo://ivoa.net/std/TAPRegExt#features-adqlgeo']">
238 <dt>
239 <p class="sechdr">Geometry Primitives implemented here</p>
240 </dt>
241 <dd>
242 <xsl:apply-templates/>
243 </dd>
244 </xsl:template>
245
246 <xsl:template match="language">
247 <dt>Query language <xsl:value-of select="name"/></dt>
248 <dd>
249 <xsl:apply-templates/>
250 </dd>
251 </xsl:template>
252
253 <xsl:template match="outputFormat">
254 <dt>Output format <xsl:value-of select="mime"/></dt>
255 <dd>
256 <xsl:apply-templates select="description"/>
257 <xsl:if test="alias"><br/>
258 Also available as <xsl:value-of select="alias"/>.
259 </xsl:if>
260 </dd>
261 </xsl:template>
262
263 <xsl:template match="uploadMethod">
264 <dt>Upload method supported</dt>
265 <dd><xsl:value-of select="@ivo-id"/>
266 </dd>
267 </xsl:template>
268
269 <xsl:template match="default">
270 by default: <xsl:value-of select="."/><xsl:text> </xsl:text>
271 <xsl:value-of select="@unit"/><br/>
272 </xsl:template>
273
274 <xsl:template match="hard">
275 not exceedable: <xsl:value-of select="."/><xsl:text> </xsl:text>
276 <xsl:value-of select="@unit"/>
277 </xsl:template>
278
279 <xsl:template match="retentionPeriod">
280 <dt>Time a job is kept (in seconds)</dt>
281 <dd><xsl:apply-templates/></dd>
282 </xsl:template>
283
284 <xsl:template match="executionDuration">
285 <dt>Maximal run time of a job</dt>
286 <dd><xsl:apply-templates/></dd>
287 </xsl:template>
288
289 <xsl:template match="outputLimit">
290 <dt>Maximal size of result sets</dt>
291 <dd><xsl:apply-templates/></dd>
292 </xsl:template>
293
294 <xsl:template match="uploadLimit">
295 <dt>Maximal size of result sets</dt>
296 <dd><xsl:apply-templates/></dd>
297 </xsl:template>
298
299 <xsl:template match="capability">
300 <h2>Capability <xsl:value-of select="@standardID"/></h2>
301 <xsl:choose>
302 <xsl:when test="@standardID='ivo://ivoa.net/std/TAP'">
303 <p>The endpoint for actual database queries.</p>
304 </xsl:when>
305 <xsl:when test="@standardID='ivo://ivoa.net/std/VOSI#availability'">
306 <p>Information on up- and downtimes of the service.</p>
307 </xsl:when>
308 <xsl:when test="@standardID='ivo://ivoa.net/std/VOSI#capabilities'">
309 <p>Information on service properties.</p>
310 </xsl:when>
311 <xsl:when test="@standardID='ivo://ivoa.net/std/VOSI#tables'">
312 <p>The tables exposed by this service (may be large!).</p>
313 </xsl:when>
314 <xsl:when test="@standardID='ivo://ivoa.net/std/voevent'">
315 <p>A VOEvent Stream.</p>
316 </xsl:when>
317 <xsl:otherwise>
318 <p>TBD: Describe this endpoint</p>
319 </xsl:otherwise>
320 </xsl:choose>
321 <dl class="caplist">
322 <xsl:apply-templates/>
323 </dl>
324
325 </xsl:template>
326
327 <xsl:template match="cap:capabilities">
328 <html>
329 <head>
330 <title>Service Capabilities</title>
331 <xsl:call-template name="localCompleteHead"/>
332 <style type="text/css">
333 table.caplist {
334 border: 1px solid grey;
335 }
336 .udfsig {
337 font-family: monospace;
338 }
339 p.sechdr { /* should be a h3, really, but that doesn't
340 result in a pretty doc structure either, so there. */
341 font-weight: bold;
342 font-size: 120%;
343 }
344 </style>
345 </head>
346 <body>
347 <h1>Service Capabilities</h1>
348 <xsl:apply-templates/>
349 <xsl:call-template name="localMakeFoot"/>
350 </body>
351 </html>
352 </xsl:template>
353
354
355 <!-- #################################################### Table Sets -->
356
357 <xsl:template match="dataType">
358 <xsl:value-of select="text()"/>
359 <xsl:if test="@arraysize and @arraysize!='1'"
360 >[<xsl:value-of select="@arraysize"/>]
361 </xsl:if>
362 </xsl:template>
363
364 <xsl:template match="column">
365 <tr>
366 <td><xsl:value-of select="name"/></td>
367 <td><xsl:value-of select="unit"/></td>
368 <td><xsl:value-of select="ucd"/></td>
369 <td><xsl:apply-templates select="dataType"/></td>
370 <td><xsl:value-of select="description"/></td>
371 </tr>
372 <xsl:if test="@g-colstat:fillFactor">
373 <tr>
374 <td/><td colspan="5"><xsl:call-template name="col-stats"/></td>
375 </tr>
376 </xsl:if>
377 </xsl:template>
378
379 <xsl:template name="col-stats">
380 Not-NULL-ratio: <xsl:value-of select="format-number(
381 @g-colstat:fillFactor * 100, '###')"/>%<br/>
382 <xsl:if test="@g-colstat:min-value">
383 <table class="stats-table">
384 <tr><th>Min</th><th>-2σ</th><th>Median</th>
385 <th>2σ</th><th>Max</th></tr>
386 <!-- XSLT 1.0 format-number doesn't support scientific notation,
387 which makes it rather useless for what we're doing here.
388 DaCHS does halfway sane number formatting when serialising
389 the XML, so I just hand this through -->
390 <tr><td><xsl:value-of select="format-number(@g-colstat:min-value, '0.###E0')"/></td>
391 <td><xsl:value-of select="@g-colstat:percentile03"/></td>
392 <td><xsl:value-of select="@g-colstat:median"/></td>
393 <td><xsl:value-of select="@g-colstat:percentile97"/></td>
394 <td><xsl:value-of select="@g-colstat:max-value"/></td>
395 </tr>
396 </table>
397 </xsl:if>
398 </xsl:template>
399
400 <xsl:template name="format-table">
401 <h2>Table <xsl:value-of select="name"/></h2>
402 <p><xsl:value-of select="description"/></p>
403 <table class="shorttable">
404 <tr>
405 <th>Name</th>
406 <th>Unit</th>
407 <th>UCD</th>
408 <th>VOTable type</th>
409 <th>Description</th>
410 </tr>
411 <xsl:apply-templates select="column"/>
412 </table>
413 </xsl:template>
414
415 <xsl:template match="table">
416 <xsl:call-template name="format-table"/>
417 </xsl:template>
418
419 <xsl:template match="vtm:tableset">
420 <html>
421 <head>
422 <title>VOSI Table Set</title>
423 <xsl:call-template name="localCompleteHead"/>
424 </head>
425 <body>
426 <h1>VOSI Table Set</h1>
427 <xsl:apply-templates select="*/table"/>
428 <xsl:call-template name="localMakeFoot"/>
429 </body>
430 </html>
431 </xsl:template>
432
433 <xsl:template match="vtm:table">
434 <html>
435 <head>
436 <title>Table <xsl:value-of select="name"/></title>
437 <xsl:call-template name="localCompleteHead"/>
438 </head>
439 <body>
440 <h1>Table Metadata</h1>
441 <xsl:call-template name="format-table"/>
442 <xsl:call-template name="localMakeFoot"/>
443 </body>
444 </html>
445 </xsl:template>
446
447
448 </xsl:stylesheet>
449
450
451 <!-- vim:et:sw=4:sta
452 -->