/[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 4485 - (show annotations)
Wed Oct 11 07:58:03 2017 UTC (3 years, 11 months ago) by msdemlei
File size: 14902 byte(s)
ivoatex: HTML output lstlisting numbering left.

Original support was for numbers=right, which made for different LaTeX vs. 
HTML output.


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

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