]> git.stg.codes - stg.git/blob - doc/xslt/xhtml/block.xsl
Set output encoding to utf-8.
[stg.git] / doc / xslt / xhtml / block.xsl
1 <?xml version="1.0" encoding="ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
5
6 <!-- ********************************************************************
7      $Id: block.xsl 8831 2010-08-13 17:08:49Z mzjn $
8      ********************************************************************
9
10      This file is part of the XSL DocBook Stylesheet distribution.
11      See ../README or http://docbook.sf.net/release/xsl/current/ for
12      copyright and other information.
13
14      ******************************************************************** -->
15
16 <!-- ==================================================================== -->
17 <!-- What should we do about styling blockinfo? -->
18
19 <xsl:template match="blockinfo|info">
20   <!-- suppress -->
21 </xsl:template>
22
23 <!-- ==================================================================== -->
24
25 <xsl:template name="block.object">
26   <div>
27     <xsl:call-template name="common.html.attributes"/>
28     <xsl:call-template name="anchor"/>
29     <xsl:apply-templates/>
30   </div>
31 </xsl:template>
32
33 <!-- ==================================================================== -->
34
35 <xsl:template match="para">
36   <xsl:call-template name="paragraph">
37     <xsl:with-param name="class">
38       <xsl:if test="@role and $para.propagates.style != 0">
39         <xsl:value-of select="@role"/>
40       </xsl:if>
41     </xsl:with-param>
42     <xsl:with-param name="content">
43       <xsl:if test="position() = 1 and parent::listitem">
44         <xsl:call-template name="anchor">
45           <xsl:with-param name="node" select="parent::listitem"/>
46         </xsl:call-template>
47       </xsl:if>
48
49       <xsl:call-template name="anchor"/>
50       <xsl:apply-templates/>
51     </xsl:with-param>
52   </xsl:call-template>
53 </xsl:template>
54
55 <xsl:template name="paragraph">
56   <xsl:param name="class" select="''"/>
57   <xsl:param name="content"/>
58
59   <xsl:variable name="p">
60     <p>
61       <xsl:choose>
62         <xsl:when test="$class != ''">
63           <xsl:call-template name="common.html.attributes">
64             <xsl:with-param name="class" select="$class"/>
65           </xsl:call-template>
66         </xsl:when>
67         <xsl:otherwise>
68           <xsl:call-template name="locale.html.attributes"/>
69         </xsl:otherwise>
70       </xsl:choose>
71       <xsl:copy-of select="$content"/>
72     </p>
73   </xsl:variable>
74
75   <xsl:choose>
76     <xsl:when test="$html.cleanup != 0">
77       <xsl:call-template name="unwrap.p">
78         <xsl:with-param name="p" select="$p"/>
79       </xsl:call-template>
80     </xsl:when>
81     <xsl:otherwise>
82       <xsl:copy-of select="$p"/>
83     </xsl:otherwise>
84   </xsl:choose>
85 </xsl:template>
86
87 <xsl:template match="simpara">
88   <!-- see also listitem/simpara in lists.xsl -->
89   <p>
90     <xsl:call-template name="locale.html.attributes"/>
91     <xsl:if test="@role and $para.propagates.style != 0">
92       <xsl:apply-templates select="." mode="class.attribute">
93         <xsl:with-param name="class" select="@role"/>
94       </xsl:apply-templates>
95     </xsl:if>
96
97     <xsl:call-template name="anchor"/>
98     <xsl:apply-templates/>
99   </p>
100 </xsl:template>
101
102 <xsl:template match="formalpara">
103   <xsl:call-template name="paragraph">
104     <xsl:with-param name="class">
105       <xsl:if test="@role and $para.propagates.style != 0">
106         <xsl:value-of select="@role"/>
107       </xsl:if>
108     </xsl:with-param>
109     <xsl:with-param name="content">
110       <xsl:call-template name="anchor"/>
111       <xsl:apply-templates/>
112     </xsl:with-param>
113   </xsl:call-template>
114 </xsl:template>
115
116 <!-- Only use title from info -->
117 <xsl:template match="formalpara/info">
118   <xsl:apply-templates select="title"/>
119 </xsl:template>
120
121 <xsl:template match="formalpara/title|formalpara/info/title">
122   <xsl:variable name="titleStr">
123       <xsl:apply-templates/>
124   </xsl:variable>
125   <xsl:variable name="lastChar">
126     <xsl:if test="$titleStr != ''">
127       <xsl:value-of select="substring($titleStr,string-length($titleStr),1)"/>
128     </xsl:if>
129   </xsl:variable>
130
131   <xsl:choose>
132     <xsl:when test="$make.clean.html != 0">
133       <span class="formalpara-title">
134         <xsl:copy-of select="$titleStr"/>
135         <xsl:if test="$lastChar != ''                       and not(contains($runinhead.title.end.punct, $lastChar))">
136           <xsl:value-of select="$runinhead.default.title.end.punct"/>
137         </xsl:if>
138         <xsl:text>&#160;</xsl:text>
139       </span>
140     </xsl:when>
141     <xsl:otherwise>
142       <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
143         <xsl:copy-of select="$titleStr"/>
144         <xsl:if test="$lastChar != ''                       and not(contains($runinhead.title.end.punct, $lastChar))">
145           <xsl:value-of select="$runinhead.default.title.end.punct"/>
146         </xsl:if>
147         <xsl:text>&#160;</xsl:text>
148       </strong>
149     </xsl:otherwise>
150   </xsl:choose>
151 </xsl:template>
152
153 <xsl:template match="formalpara/para">
154   <xsl:apply-templates/>
155 </xsl:template>
156
157 <!-- ==================================================================== -->
158
159 <xsl:template match="blockquote">
160   <div>
161     <xsl:call-template name="common.html.attributes"/>
162     <xsl:call-template name="anchor"/>
163
164     <xsl:choose>
165       <xsl:when test="attribution">
166         <table border="0" width="100%" cellspacing="0" cellpadding="0" class="blockquote" summary="Block quote">
167           <tr>
168             <td width="10%" valign="top">&#160;</td>
169             <td width="80%" valign="top">
170               <xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
171             </td>
172             <td width="10%" valign="top">&#160;</td>
173           </tr>
174           <tr>
175             <td width="10%" valign="top">&#160;</td>
176             <td colspan="2" align="{$direction.align.end}" valign="top">
177               <xsl:text>--</xsl:text>
178               <xsl:apply-templates select="attribution"/>
179             </td>
180           </tr>
181         </table>
182       </xsl:when>
183       <xsl:otherwise>
184         <blockquote>
185           <xsl:call-template name="common.html.attributes"/>
186           <xsl:apply-templates/>
187         </blockquote>
188       </xsl:otherwise>
189     </xsl:choose>
190   </div>
191 </xsl:template>
192
193 <xsl:template match="blockquote/title|blockquote/info/title">
194   <xsl:choose>
195     <xsl:when test="$make.clean.html != 0">
196       <div class="blockquote-title">
197         <xsl:apply-templates/>
198       </div>
199     </xsl:when>
200     <xsl:otherwise>
201       <div class="blockquote-title">
202         <p>
203           <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
204             <xsl:apply-templates/>
205           </strong>
206         </p>
207       </div>
208     </xsl:otherwise>
209   </xsl:choose>
210 </xsl:template>
211
212 <!-- Use an em dash per Chicago Manual of Style and https://sourceforge.net/tracker/index.php?func=detail&aid=2793878&group_id=21935&atid=373747 -->
213 <xsl:template match="epigraph">
214   <div>
215     <xsl:call-template name="common.html.attributes"/>
216       <xsl:apply-templates select="para|simpara|formalpara|literallayout"/>
217       <xsl:if test="attribution">
218         <div class="attribution">
219           <span>&#8212;<xsl:apply-templates select="attribution"/></span>
220         </div>
221       </xsl:if>
222   </div>
223 </xsl:template>
224
225 <xsl:template match="attribution">
226   <span>
227     <xsl:call-template name="common.html.attributes"/>
228     <xsl:apply-templates/>
229   </span>
230 </xsl:template>
231
232 <!-- ==================================================================== -->
233
234 <xsl:template match="abstract|sidebar">
235   <div>
236     <xsl:call-template name="common.html.attributes"/>
237     <xsl:call-template name="anchor"/>
238     <xsl:call-template name="sidebar.titlepage"/>
239     <xsl:apply-templates/>
240   </div>
241 </xsl:template>
242
243 <xsl:template match="abstract/title|sidebar/title">
244 </xsl:template>
245
246 <xsl:template match="sidebar/sidebarinfo|sidebar/info"/>
247
248 <!-- ==================================================================== -->
249
250 <xsl:template match="msgset">
251   <xsl:apply-templates/>
252 </xsl:template>
253
254 <xsl:template match="msgentry">
255   <xsl:call-template name="block.object"/>
256 </xsl:template>
257
258 <xsl:template match="simplemsgentry">
259   <xsl:call-template name="block.object"/>
260 </xsl:template>
261
262 <xsl:template match="msg">
263   <xsl:call-template name="block.object"/>
264 </xsl:template>
265
266 <xsl:template match="msgmain">
267   <xsl:apply-templates/>
268 </xsl:template>
269
270 <xsl:template match="msgmain/title">
271   <xsl:choose>
272     <xsl:when test="$make.clean.html != 0">
273       <span class="msgmain-title">
274         <xsl:apply-templates/>
275       </span>
276     </xsl:when>
277     <xsl:otherwise>
278       <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></strong>
279     </xsl:otherwise>
280   </xsl:choose>
281 </xsl:template>
282
283 <xsl:template match="msgsub">
284   <xsl:apply-templates/>
285 </xsl:template>
286
287 <xsl:template match="msgsub/title">
288   <xsl:choose>
289     <xsl:when test="$make.clean.html != 0">
290       <span class="msgsub-title">
291         <xsl:apply-templates/>
292       </span>
293     </xsl:when>
294     <xsl:otherwise>
295       <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></strong>
296     </xsl:otherwise>
297   </xsl:choose>
298 </xsl:template>
299
300 <xsl:template match="msgrel">
301   <xsl:apply-templates/>
302 </xsl:template>
303
304 <xsl:template match="msgrel/title">
305   <xsl:choose>
306     <xsl:when test="$make.clean.html != 0">
307       <span class="msgrel-title">
308         <xsl:apply-templates/>
309       </span>
310     </xsl:when>
311     <xsl:otherwise>
312       <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></strong>
313     </xsl:otherwise>
314   </xsl:choose>
315 </xsl:template>
316
317 <xsl:template match="msgtext">
318   <xsl:apply-templates/>
319 </xsl:template>
320
321 <xsl:template match="msginfo">
322   <xsl:call-template name="block.object"/>
323 </xsl:template>
324
325 <xsl:template match="msglevel">
326   <xsl:choose>
327     <xsl:when test="$make.clean.html != 0">
328       <div class="msglevel">
329         <span class="msglevel-title">
330           <xsl:call-template name="gentext.template">
331             <xsl:with-param name="context" select="'msgset'"/>
332             <xsl:with-param name="name" select="'MsgLevel'"/>
333           </xsl:call-template>
334         </span>
335         <xsl:apply-templates/>
336       </div>
337     </xsl:when>
338     <xsl:otherwise>
339       <p>
340         <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
341           <xsl:call-template name="gentext.template">
342             <xsl:with-param name="context" select="'msgset'"/>
343             <xsl:with-param name="name" select="'MsgLevel'"/>
344           </xsl:call-template>
345         </strong>
346         <xsl:apply-templates/>
347       </p>
348     </xsl:otherwise>
349   </xsl:choose>
350 </xsl:template>
351
352 <xsl:template match="msgorig">
353   <xsl:choose>
354     <xsl:when test="$make.clean.html != 0">
355       <div class="msgorig">
356         <span class="msgorig-title">
357           <xsl:call-template name="gentext.template">
358             <xsl:with-param name="context" select="'msgset'"/>
359             <xsl:with-param name="name" select="'MsgOrig'"/>
360           </xsl:call-template>
361         </span>
362         <xsl:apply-templates/>
363       </div>
364     </xsl:when>
365     <xsl:otherwise>
366       <p>
367         <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
368           <xsl:call-template name="gentext.template">
369             <xsl:with-param name="context" select="'msgset'"/>
370             <xsl:with-param name="name" select="'MsgOrig'"/>
371           </xsl:call-template>
372         </strong>
373         <xsl:apply-templates/>
374       </p>
375     </xsl:otherwise>
376   </xsl:choose>
377 </xsl:template>
378
379 <xsl:template match="msgaud">
380   <xsl:choose>
381     <xsl:when test="$make.clean.html != 0">
382       <div class="msgaud">
383         <span class="msgaud-title">
384           <xsl:call-template name="gentext.template">
385             <xsl:with-param name="context" select="'msgset'"/>
386             <xsl:with-param name="name" select="'MsgAud'"/>
387           </xsl:call-template>
388         </span>
389         <xsl:apply-templates/>
390       </div>
391     </xsl:when>
392     <xsl:otherwise>
393       <p>
394         <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
395           <xsl:call-template name="gentext.template">
396             <xsl:with-param name="context" select="'msgset'"/>
397             <xsl:with-param name="name" select="'MsgAud'"/>
398           </xsl:call-template>
399         </strong>
400         <xsl:apply-templates/>
401       </p>
402     </xsl:otherwise>
403   </xsl:choose>
404 </xsl:template>
405
406 <xsl:template match="msgexplan">
407   <xsl:call-template name="block.object"/>
408 </xsl:template>
409
410 <xsl:template match="msgexplan/title">
411   <xsl:choose>
412     <xsl:when test="$make.clean.html != 0">
413       <div class="msgexplan">
414         <span class="msgexplan-title">
415           <xsl:apply-templates/>
416         </span>
417       </div>
418     </xsl:when>
419     <xsl:otherwise>
420       <p>
421         <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
422           <xsl:apply-templates/>
423         </strong>
424       </p>
425     </xsl:otherwise>
426   </xsl:choose>
427 </xsl:template>
428
429 <!-- ==================================================================== -->
430
431 <xsl:template match="revhistory">
432   <div>
433     <xsl:call-template name="common.html.attributes"/>
434     <table border="0" width="100%" summary="Revision history">
435       <tr>
436         <th align="{$direction.align.start}" valign="top" colspan="3">
437           <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
438             <xsl:call-template name="gentext">
439               <xsl:with-param name="key" select="'RevHistory'"/>
440             </xsl:call-template>
441           </strong>
442         </th>
443       </tr>
444       <xsl:apply-templates/>
445     </table>
446   </div>
447 </xsl:template>
448
449 <xsl:template match="revhistory/revision">
450   <xsl:variable name="revnumber" select="revnumber"/>
451   <xsl:variable name="revdate" select="date"/>
452   <xsl:variable name="revauthor" select="authorinitials|author"/>
453   <xsl:variable name="revremark" select="revremark|revdescription"/>
454   <tr>
455     <td align="{$direction.align.start}">
456       <xsl:if test="$revnumber">
457         <xsl:call-template name="gentext">
458           <xsl:with-param name="key" select="'Revision'"/>
459         </xsl:call-template>
460         <xsl:call-template name="gentext.space"/>
461         <xsl:apply-templates select="$revnumber"/>
462       </xsl:if>
463     </td>
464     <td align="{$direction.align.start}">
465       <xsl:apply-templates select="$revdate"/>
466     </td>
467     <xsl:choose>
468       <xsl:when test="count($revauthor)=0">
469         <td align="{$direction.align.start}">
470           <xsl:call-template name="dingbat">
471             <xsl:with-param name="dingbat">nbsp</xsl:with-param>
472           </xsl:call-template>
473         </td>
474       </xsl:when>
475       <xsl:otherwise>
476         <td align="{$direction.align.start}">
477           <xsl:for-each select="$revauthor">
478             <xsl:apply-templates select="."/>
479             <xsl:if test="position() != last()">
480               <xsl:text>, </xsl:text>
481             </xsl:if>
482           </xsl:for-each>
483         </td>
484       </xsl:otherwise>
485     </xsl:choose>
486   </tr>
487   <xsl:if test="$revremark">
488     <tr>
489       <td align="{$direction.align.start}" colspan="3">
490         <xsl:apply-templates select="$revremark"/>
491       </td>
492     </tr>
493   </xsl:if>
494 </xsl:template>
495
496 <xsl:template match="revision/revnumber">
497   <xsl:apply-templates/>
498 </xsl:template>
499
500 <xsl:template match="revision/date">
501   <xsl:apply-templates/>
502 </xsl:template>
503
504 <xsl:template match="revision/authorinitials">
505   <xsl:text>, </xsl:text>
506   <xsl:apply-templates/>
507 </xsl:template>
508
509 <xsl:template match="revision/authorinitials[1]" priority="2">
510   <xsl:apply-templates/>
511 </xsl:template>
512
513 <xsl:template match="revision/revremark">
514   <xsl:apply-templates/>
515 </xsl:template>
516
517 <xsl:template match="revision/revdescription">
518   <xsl:apply-templates/>
519 </xsl:template>
520
521 <!-- ==================================================================== -->
522
523 <xsl:template match="ackno|acknowledgements[parent::article]">
524   <xsl:call-template name="block.object"/>
525 </xsl:template>
526
527 <!-- ==================================================================== -->
528
529 <xsl:template match="highlights">
530   <xsl:call-template name="block.object"/>
531 </xsl:template>
532
533 <!-- ==================================================================== -->
534
535 </xsl:stylesheet>