/[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 5934 - (show annotations)
Tue Feb 23 11:38:05 2021 UTC (2 months, 2 weeks ago) by msdemlei
File size: 16819 byte(s)
ivoatx: maintenance commit: Undoing html debug, whitespace in XSLT.

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
161 div.caption {
162 font-style: italic;
163 margin-top: 3mm;
164 margin-bottom: 6mm;
165 }
166
167 body div {
168 max-width: 21cm;
169 }
170 </xsl:text></style>
171
172 <xsl:apply-templates/>
173 </xsl:copy>
174 </xsl:template>
175
176 <xsl:template match="div[@id='titlepage']">
177 <xsl:copy>
178 <table cellspacing="0" cellpadding="0" width="450">
179 <tr>
180 <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>
181 <td>
182 <div style="padding: 3.6pt 7.2pt;">
183 <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>
184 <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>
185 <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>
186 <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>
187 </i></p>
188 </div>
189 <i></i></td>
190 </tr>
191 </table>
192 <br/>
193 </xsl:copy>
194
195 <h1><xsl:value-of select="h1[@align='center']"/></h1>
196 <div id="versionstatement">
197 Version <xsl:value-of select="span[@id='version']"/>
198 </div>
199 <div id="dateline">
200 <xsl:apply-templates select="span[@id='doctype']" mode="humanreadable"/>
201 <xsl:text> </xsl:text>
202 <xsl:apply-templates select="span[@id='docdate']"/>
203 </div>
204 <dl id="docmeta">
205
206 <dt>Working Group</dt>
207 <xsl:copy-of select="dd[@id='ivoagroup']"/>
208
209 <dt>This Version</dt>
210 <dd>
211 <xsl:call-template name="currentlink"/>
212 </dd>
213
214 <dt>Latest Version</dt>
215 <dd>
216 <xsl:call-template name="latestlink"/>
217 </dd>
218
219 <dt>Previous Versions</dt>
220 <dd>
221 <ul class="previousversions">
222 <xsl:apply-templates select="li[@class='previousversion']"/>
223 </ul>
224 </dd>
225
226 <dt>Author(s)</dt>
227 <dd>
228 <ul class="authors">
229 <xsl:apply-templates select="li[@class='author']"/>
230 </ul>
231 </dd>
232
233 <dt>Editor(s)</dt>
234 <dd>
235 <ul class="editors">
236 <xsl:apply-templates select="li[@class='editor']"/>
237 </ul>
238 </dd>
239
240 <xsl:if test="span[@id='vcsRev']">
241 <dt>Version Control</dt>
242 <dd>Revision <xsl:value-of select="span[@id='vcsRev']"
243 /><xsl:if test="span[@id='vcsDate']">, last change
244 <xsl:value-of select="span[@id='vcsDate']"/>
245 </xsl:if>
246 <xsl:if test="span[@id='vcsURL']"><br/>
247 <a>
248 <xsl:attribute name="href">
249 <xsl:value-of select="span[@id='vcsURL']"/>
250 </xsl:attribute>Source file in VCS</a>
251 </xsl:if>
252 </dd>
253 </xsl:if>
254 </dl>
255 </xsl:template>
256
257 <xsl:template match="a/@name">
258 <xsl:if test="not(starts-with(., 'CITE'))">
259 <xsl:copy/>
260 </xsl:if>
261 </xsl:template>
262
263 <xsl:template match="a/@href">
264 <xsl:if test="not(starts-with(., '#CITE'))">
265 <xsl:copy/>
266 </xsl:if>
267 </xsl:template>
268
269 <xsl:template match="style[./@type='text/css']">
270 </xsl:template>
271
272 <xsl:template match="span[@class='customcss']">
273 <link type="text/css" rel="stylesheet">
274 <xsl:attribute name="href"><xsl:value-of select="@ref"/></xsl:attribute>
275 </link>
276 </xsl:template>
277
278 <xsl:template match="dd/div[./@class='p']">
279 </xsl:template>
280
281 <xsl:template match="span[@id='doctype']" mode="humanreadable">
282 <xsl:variable name="doctype" select="."/>
283 <xsl:choose>
284 <xsl:when test="$doctype='WD'">
285 <xsl:text>IVOA Working Draft </xsl:text>
286 </xsl:when>
287 <xsl:when test="$doctype='PR'">
288 <xsl:text>IVOA Proposed Recommendation </xsl:text>
289 </xsl:when>
290 <xsl:when test="$doctype='REC'">
291 <xsl:text>IVOA Recommendation </xsl:text>
292 </xsl:when>
293 <xsl:when test="$doctype='NOTE'">
294 <xsl:text>IVOA Note </xsl:text>
295 </xsl:when>
296 <xsl:when test="$doctype='PEN'">
297 <xsl:text>Proposed Endorsed Note </xsl:text>
298 </xsl:when>
299 <xsl:when test="$doctype='EN'">
300 <xsl:text>Endorsed Note </xsl:text>
301 </xsl:when>
302 <xsl:otherwise>
303 <xsl:message terminate='yes'>doctype must be one of
304 WD, PR, REC, NOTE, EN, PEN not
305 '<xsl:value-of select="$doctype"/>'</xsl:message>
306 </xsl:otherwise>
307 </xsl:choose>
308 </xsl:template>
309
310 <xsl:template match="div[@id='statusOfThisDocument']">
311 <xsl:variable name="doctype" select="."/>
312 <p id="statusdecl"><em>
313 <xsl:choose>
314 <xsl:when test="$doctype='NOTE'">
315 This is an IVOA Note expressing suggestions from and
316 opinions of the authors. It is intended to share best
317 practices, possible approaches, or other perspectives on
318 interoperability with the Virtual Observatory. It should
319 not be referenced or otherwise interpreted as a standard
320 specification.
321 </xsl:when>
322 <xsl:when test="$doctype='WD'">
323 This is an IVOA Working Draft for review by IVOA members
324 and other interested parties. It is a draft document and
325 may be updated, replaced, or obsoleted by other documents
326 at any time. It is inappropriate to use IVOA Working Drafts
327 as reference materials or to cite them as other than "work
328 in progress".
329 </xsl:when>
330 <xsl:when test="$doctype='PR'">
331 This is an IVOA Proposed Recommendation made available for
332 public review. It is appropriate to reference this document
333 only as a recommended standard that is under review and
334 which may be changed before it is accepted as a full
335 Recommendation.
336 </xsl:when>
337 <xsl:when test="$doctype='REC'">
338 This document has been reviewed by IVOA Members and other
339 interested parties, and has been endorsed by the IVOA
340 Executive Committee as an IVOA Recommendation. It is a
341 stable document and may be used as reference material or
342 cited as a normative reference from another document.
343 IVOA's role in making the Recommendation is to draw
344 attention to the specification and to promote its
345 widespread deployment. This enhances the functionality and
346 interoperability inside the Astronomical Community.
347 </xsl:when>
348 <xsl:when test="$doctype='PEN'">
349 This is an IVOA Proposed Endorsed Note for review by IVOA
350 members and other interested parties. It is appropriate to
351 reference this document only as a Proposed Endorsed Note that
352 is under review and may change before it is endorsed or may
353 not be endorsed.
354 </xsl:when>
355 <xsl:when test="$doctype='EN'">
356 This document is an IVOA Endorsed Note. It has been reviewed
357 and endorsed by the IVOA Technical Coordination Group as a
358 stable, citable document which constitutes valuable information
359 for the IVOA community and beyond.
360 </xsl:when>
361 <xsl:otherwise>
362 <xsl:message terminate='yes'>Invalid document
363 status (this cannot happen).</xsl:message>
364 </xsl:otherwise>
365 </xsl:choose>
366 </em></p>
367
368 <p>A list of current IVOA Recommendations and other technical documents
369 can be found in the <a href="http://www.ivoa.net/documents">IVOA
370 document repository</a>.</p>
371 </xsl:template>
372
373 <xsl:template name="selectDoctypeStyle">
374 <xsl:variable name="doctype" select="//span[@id='doctype']"/>
375 <link rel="stylesheet" type="text/css">
376 <xsl:attribute name="href">
377 <xsl:choose>
378 <xsl:when test="$doctype='WD'"
379 >http://www.ivoa.net/misc/ivoa_wd.css</xsl:when>
380 <xsl:when test="$doctype='PR'"
381 >http://www.ivoa.net/misc/ivoa_pr.css</xsl:when>
382 <xsl:when test="$doctype='REC'"
383 >http://www.ivoa.net/misc/ivoa_rec.css</xsl:when>
384 <xsl:when test="$doctype='NOTE'"
385 >http://www.ivoa.net/misc/ivoa_note.css</xsl:when>
386 <xsl:when test="$doctype='PEN'"
387 >http://www.ivoa.net/misc/ivoa_note.css</xsl:when>
388 <xsl:when test="$doctype='EN'"
389 >http://www.ivoa.net/misc/ivoa_note.css</xsl:when>
390 </xsl:choose>
391 </xsl:attribute>
392 </link>
393 </xsl:template>
394
395 <!-- To somewhat support keyval-style arguments (as in, e.g., listings)
396 this allows translating them into css classes. Essentially,
397 generate a div with a keyvals attribute; see lstlisting in tthdefs -->
398
399 <xsl:template match="*[@keyvals]">
400 <div>
401 <xsl:attribute name="class">
402 <xsl:value-of select="translate(@keyvals, ',=\\', ' __')"/>
403 </xsl:attribute>
404 <xsl:apply-templates/>
405 </div>
406 </xsl:template>
407
408 <!-- In verbatim listings, we may want to play tricks with lines.
409 So, let's mark them up with spans. -->
410
411 <xsl:template name="split-into-lines">
412 <xsl:param name="arg"/>
413 <span class="verbline"><xsl:value-of
414 select="substring-before($arg, '&#xa;')"/>
415 <xsl:text>&#xa;</xsl:text>
416 </span>
417
418 <xsl:if test="substring-after($arg, '&#xa;')">
419 <xsl:call-template name="split-into-lines">
420 <xsl:with-param name="arg" select="substring-after($arg, '&#xa;')"/>
421 </xsl:call-template>
422 </xsl:if>
423 </xsl:template>
424
425 <xsl:template match="pre">
426 <pre>
427 <xsl:copy-of select="@*"/>
428 <xsl:call-template name="split-into-lines">
429 <xsl:with-param name="arg" select="."/>
430 </xsl:call-template>
431 </pre>
432 </xsl:template>
433
434 <!-- Make a link to the current version on the ivoa doc server.
435 The format of the URI here is as mandated by the IVOA
436 Document Standards Standard Document (ahem). -->
437 <xsl:template name="currentlink">
438 <xsl:variable name="docdate" select="span[@id='docdate']"/>
439 <xsl:variable name="currenturl">
440 <xsl:value-of select="$docbase"/>
441 <xsl:value-of select="//span[@id='docname']"/>
442 <xsl:text>/</xsl:text>
443 <xsl:value-of select="concat(
444 substring($docdate, 1, 4),
445 substring($docdate, 6, 2),
446 substring($docdate, 9, 2))"/>
447 </xsl:variable>
448 <xsl:element name="a">
449 <xsl:attribute name="class">currentlink</xsl:attribute>
450 <xsl:attribute name="href">
451 <xsl:value-of select="$currenturl"/>
452 </xsl:attribute>
453 <xsl:value-of select="$currenturl"/>
454 </xsl:element>
455 </xsl:template>
456
457 <!-- Make a link to the LATEST version on the ivoa doc server.
458 This is a URL without a version, which will redirect, on the
459 doc server, to the versioned URL. -->
460 <xsl:template name="latestlink">
461 <xsl:variable name="currenturl">
462 <xsl:value-of select="$docbase"/>
463 <xsl:value-of select="//span[@id='docname']"/>
464 </xsl:variable>
465 <xsl:element name="a">
466 <xsl:attribute name="class">latestlink</xsl:attribute>
467 <xsl:attribute name="href">
468 <xsl:value-of select="$currenturl"/>
469 </xsl:attribute>
470 <xsl:value-of select="$currenturl"/>
471 </xsl:element>
472 </xsl:template>
473
474 <!-- I want to style the role diagram; ideally, we'd add a class
475 through LaTeX, but TTH doesn't have a straightforward facility
476 for doing this. Hence, I'm adding a class manually. -->
477 <xsl:template match="img[@src='role_diagram.svg']">
478 <xsl:copy>
479 <xsl:attribute name="class">archdiag</xsl:attribute>
480 <xsl:apply-templates select="@*|node()"/>
481 </xsl:copy>
482 </xsl:template>
483
484 <!-- tth has given up detecting p elements in TeX source and hacks in
485 div class="p" elements as paragraph separators. These
486 are potentially very confusing to browsers. We hence
487 replace them with hopefully less confusing constructs -->
488 <xsl:template match="div[@class='p']">
489 <p class="parsep"><span> </span></p>
490 </xsl:template>
491
492 <xsl:template match="body">
493 <xsl:apply-templates/>
494 </xsl:template>
495
496 </xsl:stylesheet>

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