-
Notifications
You must be signed in to change notification settings - Fork 0
/
vor-to-landing.xslt
343 lines (291 loc) · 12.4 KB
/
vor-to-landing.xslt
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
<!-- -*- indent-offset: 8; -*- -->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ri="http://www.ivoa.net/xml/RegistryInterface/v1.0"
xmlns:vr="http://www.ivoa.net/xml/VOResource/v1.0"
xmlns="http://www.w3.org/1999/xhtml"
version="1.0">
<!-- ############################################## Global behaviour -->
<xsl:output method="xml" indent="yes"/>
<!-- Don't spill the content of unknown elements. -->
<xsl:template match="text()"/>
<xsl:param name="favicon">/favicon.png</xsl:param>
<!-- XXX TODO: we'll need to be more careful when there are
more altIdentifier schemes. Promise. -->
<xsl:variable name="doi" select="//ri:Resource/altIdentifier"/>
<xsl:template match="ri:Resource">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title><xsl:value-of select="title"/></title>
<link rel="icon">
<xsl:attribute name="href"
><xsl:value-of select="$favicon"
/></xsl:attribute>
</link>
<link rel="stylesheet" type="text/css"
href="/ADAPT/FOR/YOUR/SITE/landingpage.css"/>
</head>
<body>
<h1 id="doctitle"><xsl:apply-templates select="title"/>
<span class="doctype"><xsl:call-template name="doctype"/></span></h1>
<div class="infobox" id="overview">
<dl id="idbox">
<dt>Authors</dt>
<dd id="authors"><ol class="inline"><xsl:apply-templates select="curation/creator"/>
<dl class="publisher inline"><xsl:apply-templates select="curation/publisher"/></dl>
</ol></dd>
<dt>Abstract</dt>
<dd id="abstract"><xsl:apply-templates select="content/description"/></dd>
<dt>Keywords</dt>
<dd id="keywords"><ol class="inline"><xsl:apply-templates select="content/subject"/></ol></dd>
<xsl:apply-templates select="content/source"/>
<xsl:apply-templates select="content/referenceURL"/>
<xsl:apply-templates select="identifier"/>
<!-- DOI comes from the dataset, so has to be provided there first,
despite this being a landing page from the DOI, it doesn't know it! -->
<dt>Document Object Identifer <span class="protocol">DOI</span></dt>
<dd><span class="dc:identifier"><xsl:value-of select="$doi"/></span></dd>
</dl>
</div>
<div class="infobox" id="metadata">
<h2>Access<!-- Use <span class="joiner">+</span> cite--></h2>
<dl>
<xsl:apply-templates select="capability"/>
</dl>
</div>
<div class="infobox sidebyside" id="dates">
<h2>History</h2>
<dl>
<dt><span class="datestamp"><xsl:value-of select="//ri:Resource/@created"/></span></dt>
<dd>Resource record created</dd>
<xsl:apply-templates select="curation/date">
<xsl:sort data-type="text"
select="."
order="ascending"/>
</xsl:apply-templates>
</dl>
</div>
<div class="infobox sidebyside" id="contact">
<h2>Contact</h2>
<dl>
<xsl:apply-templates select="curation/contact"/>
</dl>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="title">
<span class="dc:title"><xsl:value-of select="."/></span>
</xsl:template>
<xsl:template match="identifier">
<dt>IVOA Identifier <span class="protocol">IVOID</span></dt>
<dd><span class="identifier"
><xsl:value-of select="."/></span></dd>
</xsl:template>
<xsl:template match="name">
<li class="name"><xsl:value-of select="."/></li>
</xsl:template>
<xsl:template match="creator">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="subject">
<li><xsl:value-of select="."/></li>
</xsl:template>
<xsl:template match="content/description">
<!-- assume that material is pre-formatted if it contains lfs -->
<xsl:choose>
<xsl:when test="contains(., '
')">
<pre class="abstract"><xsl:value-of select="text()"/></pre>
</xsl:when>
<xsl:otherwise>
<p class="abstract"><xsl:value-of select="text()"/></p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="contact/name">
<dt>Name</dt><dd><xsl:value-of select="."/></dd>
</xsl:template>
<xsl:template match="email">
<dt>E-Mail</dt><dd id="email"><xsl:value-of select="."/></dd>
</xsl:template>
<xsl:template match="address">
<dt>Postal Address</dt><dd><address><xsl:value-of select="."/></address></dd>
</xsl:template>
<xsl:template match="telephone">
<dt>Telephone</dt><dd><xsl:value-of select="."/></dd>
</xsl:template>
<xsl:template match="referenceURL">
<dt class="browsable">See also <span class="protocol">HTML</span></dt>
<dd><a>
<xsl:attribute name="href">
<xsl:value-of
select="."/>
</xsl:attribute>
<xsl:value-of select="."/>
</a></dd>
</xsl:template>
<xsl:template match="source[@format='bibcode']">
<dt class="browsable">Bibliographic source <span class="protocol">Bibcode</span></dt>
<dd><a>
<xsl:attribute name="href"
>http://adsabs.harvard.edu/abs/<xsl:value-of
select="."/>
</xsl:attribute>
<xsl:value-of select="."/>
</a></dd>
</xsl:template>
<xsl:template match="source[starts-with(., 'http')]">
<dt class="browsable">Bibliographic source <span class="protocol">HTTP</span></dt>
<dd><a>
<xsl:attribute name="href"
><xsl:value-of select="."/>
</xsl:attribute>
<xsl:value-of select="."/>
</a></dd>
</xsl:template>
<xsl:template match="source">
<dt>Bibliographic source</dt>
<dd><xsl:value-of select="."/></dd>
</xsl:template>
<xsl:template match="publisher">
<dt>Published by</dt>
<dd><a href="#contact"><xsl:value-of select="."/></a></dd>
</xsl:template>
<xsl:template match="publisher-simple">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="version">
<dt>Version</dt>
<dd><xsl:value-of select="."/></dd>
</xsl:template>
<xsl:template match="date">
<dt><span class="datestamp"><xsl:value-of select="text()"/></span></dt>
<dd><xsl:value-of select="@role"/></dd>
</xsl:template>
<xsl:template name="doctype">
<xsl:choose>
<xsl:when test="/*/@xsi:type='vstd:Standard'">
Virtual Observatory Standard
</xsl:when>
<xsl:otherwise>
Virtual Observatory Resource
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="accessURL|mirrorURL" mode="browser">
<a>
<xsl:attribute name="href">
<xsl:value-of select="."/>
</xsl:attribute>
<xsl:value-of select="."/>
</a>
<br/>
</xsl:template>
<xsl:template match="accessURL|mirrorURL" mode="non-web">
<span class="serviceURL">
<a title="Copy this URL and paste it into a suitable client"
onclick="return false">
<xsl:attribute name="href">
<xsl:value-of select="."/>
</xsl:attribute>
<xsl:value-of select="."/>
</a>
</span>
<br/>
</xsl:template>
<xsl:template match="interface" mode="non-web">
<xsl:apply-templates select="accessURL" mode="non-web"/>
<xsl:apply-templates select="mirrorURL" mode="non-web"/>
</xsl:template>
<xsl:template match="capability[interface[@xsi:type='vr:WebBrowser']]">
<dt class="browsable">Web browser access <span class="protocol">HTML</span></dt>
<dd><xsl:apply-templates select="interface" mode="browser"/></dd>
</xsl:template>
<xsl:template match="capability" mode="conesearch">
<dt>IVOA Cone Search <span class="protocol">SCS</span></dt>
<dd>For use with a cone search client (e.g., TOPCAT).<br/>
<xsl:apply-templates select="interface" mode="non-web"/>
</dd>
</xsl:template>
<xsl:template match="capability" mode="siap">
<dt>IVOA Simple Image Search <span class="protocol">SIAP</span></dt>
<dd>For use with a VO-enabled image processor (e.g., Aladin).<br/>
<xsl:apply-templates select="interface" mode="non-web"/>
</dd>
</xsl:template>
<xsl:template match="capability" mode="ssap">
<dt>IVOA Simple Spectrum Search <span class="protocol">SSAP</span></dt>
<dd>For use with a VO-enabled spectral analysis program
(e.g., Splat, VOSpec).<br/>
<xsl:apply-templates select="interface" mode="non-web"/>
</dd>
</xsl:template>
<xsl:template match="capability" mode="tap">
<dt>IVOA Table Access <span class="protocol">TAP</span></dt>
<dd><xsl:apply-templates select="interface" mode="non-web"/>
<span class="explanation">Run SQL-like queries with TAP-enabled clients (e.g., TOPCAT).</span>
</dd>
</xsl:template>
<xsl:template match="capability" mode="slap">
<dt>IVOA Simple Line Access <span class="protocol">SLAP</span></dt>
<dd><xsl:apply-templates select="interface" mode="non-web"/>
<span class="explanation">Find spectral lines.</span>
</dd>
</xsl:template>
<xsl:template match="capability" mode="examples">
<dt>DALI Examples <span class="protocol">DALI</span></dt>
<dd><xsl:apply-templates select="interface" mode="browser"/>
<span class="explanation">RDFa-annotated human-readable
usage examples.</span>
</dd>
</xsl:template>
<xsl:template match="capability[@standardID]">
<xsl:variable name="standardID"
select="translate(@standardID,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
<xsl:choose>
<xsl:when test="starts-with($standardID,
'ivo://ivoa.net/std/conesearch')">
<xsl:apply-templates select="." mode="conesearch"/>
</xsl:when>
<xsl:when test="starts-with($standardID,
'ivo://ivoa.net/std/vosi')">
<!-- don't show VOSI endpoints at this point; let's see
what people think -->
</xsl:when>
<xsl:when test="starts-with($standardID,
'ivo://ivoa.net/std/tap')">
<xsl:apply-templates select="." mode="tap"/>
</xsl:when>
<xsl:when test="starts-with($standardID,
'ivo://ivoa.net/std/sia')">
<xsl:apply-templates select="." mode="siap"/>
</xsl:when>
<xsl:when test="starts-with($standardID,
'ivo://ivoa.net/std/ssa')">
<xsl:apply-templates select="." mode="ssap"/>
</xsl:when>
<xsl:when test="starts-with($standardID,
'ivo://ivoa.net/std/slap')">
<xsl:apply-templates select="." mode="slap"/>
</xsl:when>
<xsl:when test="starts-with($standardID,
'ivo://ivoa.net/std/dali#examples')">
<xsl:apply-templates select="." mode="examples"/>
</xsl:when>
<xsl:otherwise>
<dt>Unknown endpoint</dt>
<dd>Capability for unknown standard <xsl:value-of
select="$standardID"/>.
The VO Registry may have more details; look for
IVOID
<xsl:value-of select="/ri:Resource/identifier"/>.</dd>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
<!-- vim:et:sw=4:sta
-->