/[volute]/trunk/projects/ivoapub/ivoatex/tth-ivoa.xslt
ViewVC logotype

Contents of /trunk/projects/ivoapub/ivoatex/tth-ivoa.xslt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5923 - (show annotations)
Thu Jan 14 08:16:05 2021 UTC (3 months, 3 weeks ago) by msdemlei
File size: 15876 byte(s)
recovering the styling of the architecture diagram.


1 <?xml version="1.0"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns="http://www.w3.org/1999/xhtml"
4 version="1.0">
5
6 <!-- The parameter docbase is the location where the final document
7 will be served from. This will always have the following value
8 in final versions, but draft versions may appear for a while at
9 a different location, and this can be parameterised when this
10 stylesheet is invoked. -->
11 <xsl:param name='docbase'>http://www.ivoa.net/documents/</xsl:param>
12
13 <xsl:param name="CSS_HREF" select="''"/>
14
15 <xsl:output method="xml" encoding="utf-8"/>
16 <xsl:output cdata-section-elements="pre"/>
17
18 <xsl:template match="*">
19 <xsl:copy>
20 <xsl:apply-templates select="*|@*|text()"/>
21 </xsl:copy>
22 </xsl:template>
23
24 <xsl:template match="@*">
25 <xsl:copy/>
26 </xsl:template>
27
28 <xsl:template match="head">
29 <xsl:copy>
30 <title><xsl:value-of select="//h1[1]"/></title>
31 <xsl:element name="link">
32 <xsl:attribute name="rel">stylesheet</xsl:attribute>
33 <xsl:attribute name="type">text/css</xsl:attribute>
34 <xsl:attribute name="href">
35 <xsl:value-of select="$CSS_HREF"/>
36 </xsl:attribute>
37 </xsl:element>
38 <xsl:call-template name="selectDoctypeStyle"/>
39
40 <xsl:apply-templates select="//span[@class='customcss']"/>
41
42 <style type="text/css">
43 <xsl:text disable-output-escaping="yes">
44 div#versionstatement, div#dateline {
45 color: #005A9C;
46 font-size: 150%;
47 }
48
49 p.parsep {
50 overflow: hidden;
51 height: 0pt;
52 margin-top:0.5ex;
53 margin-bottom:0.5ex;
54 }
55
56 div.generated {
57 padding-left: 5mm;
58 border-left: 4pt solid #dddddd;
59 }
60
61 div.admonition {
62 width: 30em;
63 position: relative;
64 float: right;
65 background-color: #dddddd;
66 font-size: 80%;
67 margin: 1ex;
68 padding: 3pt;
69 overflow: auto;
70 }
71
72 p.admonition-type {
73 background-color: #444444;
74 color: #ffffff;
75 margin-top: 0px;
76 padding-left: 5pt;
77 padding-top: 5pt;
78 padding-bottom: 5pt;
79 font-weight: bold;
80 }
81
82 a.tth_citation, a.tth_citeref {
83 color: #002A5C;
84 text-decoration: none;
85 }
86
87 .xmlel {
88 font-family: monospace;
89 font-style: italic;
90 }
91
92 .vorent {
93 font-variant: small-caps;
94 }
95
96 table {
97 border-collapse: collapse;
98 border-spacing: 0px;
99 }
100
101 table.tabular {
102 margin-top: 2ex;
103 margin-bottom: 1ex;
104 margin-left: 0.5em;
105 }
106
107 table.tabular > * > tr > td, table.tabular > tr > td {
108 border-top: 1pt solid gray;
109 border-bottom: 1pt solid gray;
110 padding: 2pt;
111 }
112
113 dt {
114 margin-top: 0.5ex;
115 }
116
117 .redaction {
118 background-color: #ffff33;
119 }
120
121 span.nolinkurl {
122 font-family: monospace;
123 }
124
125 .basicstyle__footnotesize {
126 font-size: 80%;
127 }
128
129 pre {
130 counter-reset: pre_line;
131 }
132
133 pre span {
134 counter-increment: pre_line;
135 }
136
137 div.numbers_left pre span:before {
138 content: counter(pre_line);
139 text-align: right;
140 user-select: none;
141 min-width: 1.5em;
142 display: inline-block;
143 padding-right: 1em;
144 }
145
146 img.archdiag {
147 display: block;
148 width: 90%;
149 margin-left: auto;
150 margin-right: auto;
151 max-width: 19cm;
152 }
153
154 ul.authors, ul.previousversions, ul.editors {
155 list-style-type: none;
156 padding-left: 0pt;
157 margin-top: 2pt;
158 margin-bottom: 2pt;
159 }
160 </xsl:text></style>
161
162 <xsl:apply-templates/>
163 </xsl:copy>
164 </xsl:template>
165
166 <xsl:template match="div[@id='titlepage']">
167 <xsl:copy>
168 <table cellspacing="0" cellpadding="0" width="450">
169 <tr>
170 <td><a href="http://www.ivoa.net/"><img height="169" alt="IVOA" src="http://www.ivoa.net/icons/IVOA_wb_300.jpg" width="300" border="0"/></a></td>
171 <td>
172 <div style="padding: 3.6pt 7.2pt;">
173 <p><b><i><span style="font-size: 14pt; color: rgb(0, 90, 156);"><span>&#xa0;</span>I</span></i></b><i><span style="font-size: 14pt; color: rgb(0, 90, 156);">nternational</span></i></p>
174 <p><b><i><span style="font-size: 14pt; color: rgb(0, 90, 156);"><span>&#xa0;&#xa0;&#xa0;</span>V</span></i></b><i><span style="font-size: 14pt; color: rgb(0, 90, 156);">irtual</span></i></p>
175 <p><b><i><span style="font-size: 14pt; color: rgb(0, 90, 156);"><span>&#xa0;</span><span>&#xa0;&#xa0;</span>O</span></i></b><i><span style="font-size: 14pt; color: rgb(0, 90, 156);">bservatory</span></i></p>
176 <p><b><i><span style="font-size: 14pt; color: rgb(0, 90, 156);">A</span></i></b><i><span style="font-size: 14pt; color: rgb(0, 90, 156);">lliance</span></i><i>
177 </i></p>
178 </div>
179 <i></i></td>
180 </tr>
181 </table>
182 <br/>
183 </xsl:copy>
184
185 <h1><xsl:value-of select="h1[@align='center']"/></h1>
186 <div id="versionstatement">
187 Version <xsl:value-of select="span[@id='version']"/>
188 </div>
189 <div id="dateline">
190 <xsl:apply-templates select="span[@id='doctype']" mode="humanreadable"/>
191 <xsl:text> </xsl:text>
192 <xsl:apply-templates select="span[@id='docdate']"/>
193 </div>
194 <dl id="docmeta">
195
196 <dt>Working Group</dt>
197 <xsl:copy-of select="dd[@id='ivoagroup']"/>
198
199 <dt>This Version</dt>
200 <dd>
201 <xsl:call-template name="currentlink"/>
202 </dd>
203
204 <dt>Latest Version</dt>
205 <dd>
206 <xsl:call-template name="latestlink"/>
207 </dd>
208
209 <dt>Previous Versions</dt>
210 <dd>
211 <ul class="previousversions">
212 <xsl:apply-templates select="li[@class='previousversion']"/>
213 </ul>
214 </dd>
215
216 <dt>Author(s)</dt>
217 <dd>
218 <ul class="authors">
219 <xsl:apply-templates select="li[@class='author']"/>
220 </ul>
221 </dd>
222
223 <dt>Editor(s)</dt>
224 <dd>
225 <ul class="editors">
226 <xsl:apply-templates select="li[@class='editor']"/>
227 </ul>
228 </dd>
229
230 <xsl:if test="span[@id='vcsRev']">
231 <dt>Version Control</dt>
232 <dd>Revision <xsl:value-of select="span[@id='vcsRev']"
233 /><xsl:if test="span[@id='vcsDate']">, last change
234 <xsl:value-of select="span[@id='vcsDate']"/>
235 </xsl:if>
236 <xsl:if test="span[@id='vcsURL']"><br/>
237 <a>
238 <xsl:attribute name="href">
239 <xsl:value-of select="span[@id='vcsURL']"/>
240 </xsl:attribute>Source file in VCS</a>
241 </xsl:if>
242 </dd>
243 </xsl:if>
244 </dl>
245 </xsl:template>
246
247 <xsl:template match="a/@name">
248 <xsl:if test="not(starts-with(., 'CITE'))">
249 <xsl:copy/>
250 </xsl:if>
251 </xsl:template>
252
253 <xsl:template match="a/@href">
254 <xsl:if test="not(starts-with(., '#CITE'))">
255 <xsl:copy/>
256 </xsl:if>
257 </xsl:template>
258
259 <xsl:template match="style[./@type='text/css']">
260 </xsl:template>
261
262 <xsl:template match="span[@class='customcss']">
263 <link type="text/css" rel="stylesheet">
264 <xsl:attribute name="href"><xsl:value-of select="@ref"/></xsl:attribute>
265 </link>
266 </xsl:template>
267
268 <xsl:template match="dd/div[./@class='p']">
269 </xsl:template>
270
271 <xsl:template match="span[@id='doctype']" mode="humanreadable">
272 <xsl:variable name="doctype" select="."/>
273 <xsl:choose>
274 <xsl:when test="$doctype='WD'">
275 <xsl:text>IVOA Working Draft </xsl:text>
276 </xsl:when>
277 <xsl:when test="$doctype='PR'">
278 <xsl:text>IVOA Proposed Recommendation </xsl:text>
279 </xsl:when>
280 <xsl:when test="$doctype='REC'">
281 <xsl:text>IVOA Recommendation </xsl:text>
282 </xsl:when>
283 <xsl:when test="$doctype='NOTE'">
284 <xsl:text>IVOA Note </xsl:text>
285 </xsl:when>
286 <xsl:when test="$doctype='PEN'">
287 <xsl:text>Proposed Endorsed Note </xsl:text>
288 </xsl:when>
289 <xsl:when test="$doctype='EN'">
290 <xsl:text>Endorsed Note </xsl:text>
291 </xsl:when>
292 <xsl:otherwise>
293 <xsl:message terminate='yes'>doctype must be one of
294 WD, PR, REC, NOTE, EN, PEN not
295 '<xsl:value-of select="$doctype"/>'</xsl:message>
296 </xsl:otherwise>
297 </xsl:choose>
298 </xsl:template>
299
300 <xsl:template match="div[@id='statusOfThisDocument']">
301 <xsl:variable name="doctype" select="."/>
302 <p id="statusdecl"><em>
303 <xsl:choose>
304 <xsl:when test="$doctype='NOTE'">
305 This is an IVOA Note expressing suggestions from and
306 opinions of the authors. It is intended to share best
307 practices, possible approaches, or other perspectives on
308 interoperability with the Virtual Observatory. It should
309 not be referenced or otherwise interpreted as a standard
310 specification.
311 </xsl:when>
312 <xsl:when test="$doctype='WD'">
313 This is an IVOA Working Draft for review by IVOA members
314 and other interested parties. It is a draft document and
315 may be updated, replaced, or obsoleted by other documents
316 at any time. It is inappropriate to use IVOA Working Drafts
317 as reference materials or to cite them as other than "work
318 in progress".
319 </xsl:when>
320 <xsl:when test="$doctype='PR'">
321 This is an IVOA Proposed Recommendation made available for
322 public review. It is appropriate to reference this document
323 only as a recommended standard that is under review and
324 which may be changed before it is accepted as a full
325 Recommendation.
326 </xsl:when>
327 <xsl:when test="$doctype='REC'">
328 This document has been reviewed by IVOA Members and other
329 interested parties, and has been endorsed by the IVOA
330 Executive Committee as an IVOA Recommendation. It is a
331 stable document and may be used as reference material or
332 cited as a normative reference from another document.
333 IVOA's role in making the Recommendation is to draw
334 attention to the specification and to promote its
335 widespread deployment. This enhances the functionality and
336 interoperability inside the Astronomical Community.
337 </xsl:when>
338 <xsl:when test="$doctype='PEN'">
339 This is an IVOA Proposed Endorsed Note for review by IVOA
340 members and other interested parties. It is appropriate to
341 reference this document only as a Proposed Endorsed Note that
342 is under review and may change before it is endorsed or may
343 not be endorsed.
344 </xsl:when>
345 <xsl:when test="$doctype='EN'">
346 This document is an IVOA Endorsed Note. It has been reviewed
347 and endorsed by the IVOA Technical Coordination Group as a
348 stable, citable document which constitutes valuable information
349 for the IVOA community and beyond.
350 </xsl:when>
351 <xsl:otherwise>
352 <xsl:message terminate='yes'>Invalid document
353 status (this cannot happen).</xsl:message>
354 </xsl:otherwise>
355 </xsl:choose>
356 </em></p>
357
358 <p>A list of current IVOA Recommendations and other technical documents
359 can be found in the <a href="http://www.ivoa.net/documents">IVOA
360 document repository</a>.</p>
361 </xsl:template>
362
363 <xsl:template name="selectDoctypeStyle">
364 <xsl:variable name="doctype" select="//span[@id='doctype']"/>
365 <link rel="stylesheet" type="text/css">
366 <xsl:attribute name="href">
367 <xsl:choose>
368 <xsl:when test="$doctype='WD'"
369 >http://www.ivoa.net/misc/ivoa_wd.css</xsl:when>
370 <xsl:when test="$doctype='PR'"
371 >http://www.ivoa.net/misc/ivoa_pr.css</xsl:when>
372 <xsl:when test="$doctype='REC'"
373 >http://www.ivoa.net/misc/ivoa_rec.css</xsl:when>
374 <xsl:when test="$doctype='NOTE'"
375 >http://www.ivoa.net/misc/ivoa_note.css</xsl:when>
376 <xsl:when test="$doctype='PEN'"
377 >http://www.ivoa.net/misc/ivoa_note.css</xsl:when>
378 <xsl:when test="$doctype='EN'"
379 >http://www.ivoa.net/misc/ivoa_note.css</xsl:when>
380 </xsl:choose>
381 </xsl:attribute>
382 </link>
383 </xsl:template>
384
385 <!-- To somewhat support keyval-style arguments (as in, e.g., listings)
386 this allows translating them into css classes. Essentially,
387 generate a div with a keyvals attribute; see lstlisting in tthdefs -->
388
389 <xsl:template match="*[@keyvals]">
390 <div>
391 <xsl:attribute name="class">
392 <xsl:value-of select="translate(@keyvals, ',=\\', ' __')"/>
393 </xsl:attribute>
394 <xsl:apply-templates/>
395 </div>
396 </xsl:template>
397
398 <!-- In verbatim listings, we may want to play tricks with lines.
399 So, let's mark them up with spans. -->
400
401 <xsl:template name="split-into-lines">
402 <xsl:param name="arg"/>
403 <span class="verbline"><xsl:value-of
404 select="substring-before($arg, '&#xa;')"/>
405 <xsl:text>&#xa;</xsl:text>
406 </span>
407
408 <xsl:if test="substring-after($arg, '&#xa;')">
409 <xsl:call-template name="split-into-lines">
410 <xsl:with-param name="arg" select="substring-after($arg, '&#xa;')"/>
411 </xsl:call-template>
412 </xsl:if>
413 </xsl:template>
414
415 <xsl:template match="pre">
416 <pre>
417 <xsl:copy-of select="@*"/>
418 <xsl:call-template name="split-into-lines">
419 <xsl:with-param name="arg" select="."/>
420 </xsl:call-template>
421 </pre>
422 </xsl:template>
423
424 <!-- Make a link to the current version on the ivoa doc server.
425 The format of the URI here is as mandated by the IVOA
426 Document Standards Standard Document (ahem). -->
427 <xsl:template name="currentlink">
428 <xsl:variable name="docdate" select="span[@id='docdate']"/>
429 <xsl:variable name="currenturl">
430 <xsl:value-of select="$docbase"/>
431 <xsl:value-of select="//span[@id='docname']"/>
432 <xsl:text>/</xsl:text>
433 <xsl:value-of select="concat(
434 substring($docdate, 1, 4),
435 substring($docdate, 6, 2),
436 substring($docdate, 9, 2))"/>
437 </xsl:variable>
438 <xsl:element name="a">
439 <xsl:attribute name="class">currentlink</xsl:attribute>
440 <xsl:attribute name="href">
441 <xsl:value-of select="$currenturl"/>
442 </xsl:attribute>
443 <xsl:value-of select="$currenturl"/>
444 </xsl:element>
445 </xsl:template>
446
447 <!-- Make a link to the LATEST version on the ivoa doc server.
448 This is a URL without a version, which will redirect, on the
449 doc server, to the versioned URL. -->
450 <xsl:template name="latestlink">
451 <xsl:variable name="currenturl">
452 <xsl:value-of select="$docbase"/>
453 <xsl:value-of select="//span[@id='docname']"/>
454 </xsl:variable>
455 <xsl:element name="a">
456 <xsl:attribute name="class">latestlink</xsl:attribute>
457 <xsl:attribute name="href">
458 <xsl:value-of select="$currenturl"/>
459 </xsl:attribute>
460 <xsl:value-of select="$currenturl"/>
461 </xsl:element>
462 </xsl:template>
463
464 <!-- I want to style the role diagram; ideally, we'd add a class
465 through LaTeX, but TTH doesn't have a straightforward facility
466 for doing this. Hence, I'm adding a class manually. -->
467 <xsl:template match="img[@src='role_diagram.svg']">
468 <xsl:copy>
469 <xsl:attribute name="class">archdiag</xsl:attribute>
470 <xsl:apply-templates select="@*|node()"/>
471 </xsl:copy>
472 </xsl:template>
473
474 <!-- tth has given up detecting p elements in TeX source and hacks in
475 div class="p" elements as paragraph separators. These
476 are potentially very confusing to browsers. We hence
477 replace them with hopefully less confusing constructs -->
478 <xsl:template match="div[@class='p']">
479 <p class="parsep"><span> </span></p>
480 </xsl:template>
481
482 <xsl:template match="body">
483 <xsl:apply-templates/>
484 </xsl:template>
485
486 </xsl:stylesheet>

msdemlei@ari.uni-heidelberg.de
ViewVC Help
Powered by ViewVC 1.1.26