Whamcloud - gitweb
LUDOC-120 presentation: build bits for webhelp.
[doc/manual.git] / webhelp / 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 9997 2015-10-15 17:44:09Z bobstayton $
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="id.attribute"/>
29     <xsl:call-template name="anchor"/>
30     <xsl:apply-templates/>
31   </div>
32 </xsl:template>
33
34 <!-- ==================================================================== -->
35
36 <xsl:template match="para">
37   <xsl:call-template name="paragraph">
38     <xsl:with-param name="class">
39       <xsl:if test="@role and $para.propagates.style != 0">
40         <xsl:value-of select="@role"/>
41       </xsl:if>
42     </xsl:with-param>
43     <xsl:with-param name="content">
44       <xsl:if test="position() = 1 and parent::listitem">
45         <xsl:call-template name="anchor">
46           <xsl:with-param name="node" select="parent::listitem"/>
47         </xsl:call-template>
48       </xsl:if>
49
50       <xsl:call-template name="anchor"/>
51       <xsl:apply-templates/>
52     </xsl:with-param>
53   </xsl:call-template>
54 </xsl:template>
55
56 <xsl:template name="paragraph">
57   <xsl:param name="class" select="''"/>
58   <xsl:param name="content"/>
59
60   <xsl:variable name="p">
61     <p>
62       <xsl:call-template name="id.attribute"/>
63       <xsl:choose>
64         <xsl:when test="$class != ''">
65           <xsl:call-template name="common.html.attributes">
66             <xsl:with-param name="class" select="$class"/>
67           </xsl:call-template>
68         </xsl:when>
69         <xsl:otherwise>
70           <xsl:call-template name="common.html.attributes">
71             <xsl:with-param name="class" select="''"/>
72           </xsl:call-template>
73         </xsl:otherwise>
74       </xsl:choose>
75
76       <xsl:copy-of select="$content"/>
77     </p>
78   </xsl:variable>
79
80   <xsl:choose>
81     <xsl:when test="$html.cleanup != 0">
82       <xsl:call-template name="unwrap.p">
83         <xsl:with-param name="p" select="$p"/>
84       </xsl:call-template>
85     </xsl:when>
86     <xsl:otherwise>
87       <xsl:copy-of select="$p"/>
88     </xsl:otherwise>
89   </xsl:choose>
90 </xsl:template>
91
92 <xsl:template match="simpara">
93   <!-- see also listitem/simpara in lists.xsl -->
94   <p>
95     <xsl:call-template name="id.attribute"/>
96     <xsl:call-template name="locale.html.attributes"/>
97     <xsl:if test="@role and $para.propagates.style != 0">
98       <xsl:apply-templates select="." mode="class.attribute">
99         <xsl:with-param name="class" select="@role"/>
100       </xsl:apply-templates>
101     </xsl:if>
102
103     <xsl:call-template name="anchor"/>
104     <xsl:apply-templates/>
105   </p>
106 </xsl:template>
107
108 <xsl:template match="formalpara">
109   <xsl:call-template name="paragraph">
110     <xsl:with-param name="class">
111       <xsl:if test="@role and $para.propagates.style != 0">
112         <xsl:value-of select="@role"/>
113       </xsl:if>
114     </xsl:with-param>
115     <xsl:with-param name="content">
116       <xsl:call-template name="anchor"/>
117       <xsl:apply-templates/>
118     </xsl:with-param>
119   </xsl:call-template>
120 </xsl:template>
121
122 <!-- Only use title from info -->
123 <xsl:template match="formalpara/info">
124   <xsl:apply-templates select="title"/>
125 </xsl:template>
126
127 <xsl:template match="formalpara/title|formalpara/info/title">
128   <xsl:variable name="titleStr">
129       <xsl:apply-templates/>
130   </xsl:variable>
131   <xsl:variable name="lastChar">
132     <xsl:if test="$titleStr != ''">
133       <xsl:value-of select="substring($titleStr,string-length($titleStr),1)"/>
134     </xsl:if>
135   </xsl:variable>
136
137   <xsl:choose>
138     <xsl:when test="$make.clean.html != 0">
139       <span class="formalpara-title">
140         <xsl:copy-of select="$titleStr"/>
141         <xsl:if test="$lastChar != ''                       and not(contains($runinhead.title.end.punct, $lastChar))">
142           <xsl:value-of select="$runinhead.default.title.end.punct"/>
143         </xsl:if>
144         <xsl:text>&#160;</xsl:text>
145       </span>
146     </xsl:when>
147     <xsl:otherwise>
148       <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
149         <xsl:copy-of select="$titleStr"/>
150         <xsl:if test="$lastChar != ''                       and not(contains($runinhead.title.end.punct, $lastChar))">
151           <xsl:value-of select="$runinhead.default.title.end.punct"/>
152         </xsl:if>
153         <xsl:text>&#160;</xsl:text>
154       </strong>
155     </xsl:otherwise>
156   </xsl:choose>
157 </xsl:template>
158
159 <xsl:template match="formalpara/para">
160   <xsl:apply-templates/>
161 </xsl:template>
162
163 <!-- ==================================================================== -->
164
165 <xsl:template match="blockquote">
166   <div>
167     <xsl:call-template name="common.html.attributes"/>
168     <xsl:call-template name="id.attribute"/>
169     <xsl:call-template name="anchor"/>
170
171     <xsl:choose>
172       <xsl:when test="attribution">
173         <table border="{$table.border.off}" class="blockquote">
174           <xsl:if test="$css.decoration != 0">
175             <xsl:attribute name="style">
176               <xsl:text>width: 100%; cellspacing: 0; cellpadding: 0;</xsl:text>
177             </xsl:attribute>
178           </xsl:if>
179           <xsl:if test="$div.element != 'section'">
180             <xsl:attribute name="summary">Block quote</xsl:attribute>
181           </xsl:if>
182           <tr>
183             <td width="10%" valign="top">&#160;</td>
184             <td width="80%" valign="top">
185               <xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
186             </td>
187             <td width="10%" valign="top">&#160;</td>
188           </tr>
189           <tr>
190             <td width="10%" valign="top">&#160;</td>
191             <td colspan="2" align="{$direction.align.end}" valign="top">
192               <xsl:text>--</xsl:text>
193               <xsl:apply-templates select="attribution"/>
194             </td>
195           </tr>
196         </table>
197       </xsl:when>
198       <xsl:otherwise>
199         <blockquote>
200           <xsl:call-template name="common.html.attributes"/>
201           <xsl:apply-templates/>
202         </blockquote>
203       </xsl:otherwise>
204     </xsl:choose>
205   </div>
206 </xsl:template>
207
208 <xsl:template match="blockquote/title|blockquote/info/title">
209   <xsl:choose>
210     <xsl:when test="$make.clean.html != 0">
211       <div class="blockquote-title">
212         <xsl:apply-templates/>
213       </div>
214     </xsl:when>
215     <xsl:otherwise>
216       <div class="blockquote-title">
217         <p>
218           <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
219             <xsl:apply-templates/>
220           </strong>
221         </p>
222       </div>
223     </xsl:otherwise>
224   </xsl:choose>
225 </xsl:template>
226
227 <!-- 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 -->
228 <xsl:template match="epigraph">
229   <div>
230     <xsl:call-template name="common.html.attributes"/>
231     <xsl:call-template name="id.attribute"/>
232     <xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
233     <xsl:if test="attribution">
234       <div class="attribution">
235         <span>&#8212;<xsl:apply-templates select="attribution"/></span>
236       </div>
237     </xsl:if>
238   </div>
239 </xsl:template>
240
241 <xsl:template match="attribution">
242   <span>
243     <xsl:call-template name="common.html.attributes"/>
244     <xsl:call-template name="id.attribute"/>
245     <xsl:apply-templates/>
246   </span>
247 </xsl:template>
248
249 <!-- ==================================================================== -->
250
251 <xsl:template match="sidebar">
252   <div>
253     <xsl:call-template name="common.html.attributes"/>
254     <xsl:call-template name="id.attribute"/>
255     <xsl:call-template name="anchor"/>
256     <xsl:call-template name="sidebar.titlepage"/>
257     <xsl:apply-templates/>
258   </div>
259 </xsl:template>
260
261 <xsl:template match="abstract/title|sidebar/title">
262 </xsl:template>
263
264 <xsl:template match="sidebar/sidebarinfo|sidebar/info"/>
265
266 <xsl:template match="abstract">
267   <div>
268     <xsl:call-template name="common.html.attributes"/>
269     <xsl:call-template name="anchor"/>
270     <xsl:call-template name="formal.object.heading">
271       <xsl:with-param name="title">
272         <xsl:apply-templates select="." mode="title.markup">
273           <xsl:with-param name="allow-anchors" select="'1'"/>
274         </xsl:apply-templates>
275       </xsl:with-param>
276     </xsl:call-template>
277     <xsl:apply-templates/>
278   </div>
279 </xsl:template>
280
281 <!-- ==================================================================== -->
282
283 <xsl:template match="msgset">
284   <xsl:apply-templates/>
285 </xsl:template>
286
287 <xsl:template match="msgentry">
288   <xsl:call-template name="block.object"/>
289 </xsl:template>
290
291 <xsl:template match="simplemsgentry">
292   <xsl:call-template name="block.object"/>
293 </xsl:template>
294
295 <xsl:template match="msg">
296   <xsl:call-template name="block.object"/>
297 </xsl:template>
298
299 <xsl:template match="msgmain">
300   <xsl:apply-templates/>
301 </xsl:template>
302
303 <xsl:template match="msgmain/title">
304   <xsl:choose>
305     <xsl:when test="$make.clean.html != 0">
306       <span class="msgmain-title">
307         <xsl:apply-templates/>
308       </span>
309     </xsl:when>
310     <xsl:otherwise>
311       <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></strong>
312     </xsl:otherwise>
313   </xsl:choose>
314 </xsl:template>
315
316 <xsl:template match="msgsub">
317   <xsl:apply-templates/>
318 </xsl:template>
319
320 <xsl:template match="msgsub/title">
321   <xsl:choose>
322     <xsl:when test="$make.clean.html != 0">
323       <span class="msgsub-title">
324         <xsl:apply-templates/>
325       </span>
326     </xsl:when>
327     <xsl:otherwise>
328       <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></strong>
329     </xsl:otherwise>
330   </xsl:choose>
331 </xsl:template>
332
333 <xsl:template match="msgrel">
334   <xsl:apply-templates/>
335 </xsl:template>
336
337 <xsl:template match="msgrel/title">
338   <xsl:choose>
339     <xsl:when test="$make.clean.html != 0">
340       <span class="msgrel-title">
341         <xsl:apply-templates/>
342       </span>
343     </xsl:when>
344     <xsl:otherwise>
345       <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates/></strong>
346     </xsl:otherwise>
347   </xsl:choose>
348 </xsl:template>
349
350 <xsl:template match="msgtext">
351   <xsl:apply-templates/>
352 </xsl:template>
353
354 <xsl:template match="msginfo">
355   <xsl:call-template name="block.object"/>
356 </xsl:template>
357
358 <xsl:template match="msglevel">
359   <xsl:choose>
360     <xsl:when test="$make.clean.html != 0">
361       <div class="msglevel">
362         <span class="msglevel-title">
363           <xsl:call-template name="gentext.template">
364             <xsl:with-param name="context" select="'msgset'"/>
365             <xsl:with-param name="name" select="'MsgLevel'"/>
366           </xsl:call-template>
367         </span>
368         <xsl:apply-templates/>
369       </div>
370     </xsl:when>
371     <xsl:otherwise>
372       <p>
373         <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
374           <xsl:call-template name="gentext.template">
375             <xsl:with-param name="context" select="'msgset'"/>
376             <xsl:with-param name="name" select="'MsgLevel'"/>
377           </xsl:call-template>
378         </strong>
379         <xsl:apply-templates/>
380       </p>
381     </xsl:otherwise>
382   </xsl:choose>
383 </xsl:template>
384
385 <xsl:template match="msgorig">
386   <xsl:choose>
387     <xsl:when test="$make.clean.html != 0">
388       <div class="msgorig">
389         <span class="msgorig-title">
390           <xsl:call-template name="gentext.template">
391             <xsl:with-param name="context" select="'msgset'"/>
392             <xsl:with-param name="name" select="'MsgOrig'"/>
393           </xsl:call-template>
394         </span>
395         <xsl:apply-templates/>
396       </div>
397     </xsl:when>
398     <xsl:otherwise>
399       <p>
400         <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
401           <xsl:call-template name="gentext.template">
402             <xsl:with-param name="context" select="'msgset'"/>
403             <xsl:with-param name="name" select="'MsgOrig'"/>
404           </xsl:call-template>
405         </strong>
406         <xsl:apply-templates/>
407       </p>
408     </xsl:otherwise>
409   </xsl:choose>
410 </xsl:template>
411
412 <xsl:template match="msgaud">
413   <xsl:choose>
414     <xsl:when test="$make.clean.html != 0">
415       <div class="msgaud">
416         <span class="msgaud-title">
417           <xsl:call-template name="gentext.template">
418             <xsl:with-param name="context" select="'msgset'"/>
419             <xsl:with-param name="name" select="'MsgAud'"/>
420           </xsl:call-template>
421         </span>
422         <xsl:apply-templates/>
423       </div>
424     </xsl:when>
425     <xsl:otherwise>
426       <p>
427         <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
428           <xsl:call-template name="gentext.template">
429             <xsl:with-param name="context" select="'msgset'"/>
430             <xsl:with-param name="name" select="'MsgAud'"/>
431           </xsl:call-template>
432         </strong>
433         <xsl:apply-templates/>
434       </p>
435     </xsl:otherwise>
436   </xsl:choose>
437 </xsl:template>
438
439 <xsl:template match="msgexplan">
440   <xsl:call-template name="block.object"/>
441 </xsl:template>
442
443 <xsl:template match="msgexplan/title">
444   <xsl:choose>
445     <xsl:when test="$make.clean.html != 0">
446       <div class="msgexplan">
447         <span class="msgexplan-title">
448           <xsl:apply-templates/>
449         </span>
450       </div>
451     </xsl:when>
452     <xsl:otherwise>
453       <p>
454         <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
455           <xsl:apply-templates/>
456         </strong>
457       </p>
458     </xsl:otherwise>
459   </xsl:choose>
460 </xsl:template>
461
462 <!-- ==================================================================== -->
463
464 <xsl:template match="revhistory">
465   <div>
466     <xsl:call-template name="common.html.attributes"/>
467     <xsl:call-template name="id.attribute"/>
468     <table>
469       <xsl:if test="$css.decoration != 0">
470         <xsl:attribute name="style">
471           <xsl:text>border-style:solid; width:100%;</xsl:text>
472         </xsl:attribute>
473       </xsl:if>
474       <!-- include summary attribute if not HTML5 -->
475       <xsl:if test="$div.element != 'section'">
476         <xsl:attribute name="summary">
477           <xsl:call-template name="gentext">
478             <xsl:with-param name="key">revhistory</xsl:with-param>
479           </xsl:call-template>
480         </xsl:attribute>
481       </xsl:if>
482       <tr>
483         <th align="{$direction.align.start}" valign="top" colspan="3">
484           <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
485             <xsl:call-template name="gentext">
486               <xsl:with-param name="key" select="'RevHistory'"/>
487             </xsl:call-template>
488           </strong>
489         </th>
490       </tr>
491       <xsl:apply-templates/>
492     </table>
493   </div>
494 </xsl:template>
495
496 <xsl:template match="revhistory/revision">
497   <xsl:variable name="revnumber" select="revnumber"/>
498   <xsl:variable name="revdate" select="date"/>
499   <xsl:variable name="revauthor" select="authorinitials|author"/>
500   <xsl:variable name="revremark" select="revremark|revdescription"/>
501   <tr>
502     <td align="{$direction.align.start}">
503       <xsl:if test="$revnumber">
504         <xsl:call-template name="gentext">
505           <xsl:with-param name="key" select="'Revision'"/>
506         </xsl:call-template>
507         <xsl:call-template name="gentext.space"/>
508         <xsl:apply-templates select="$revnumber"/>
509       </xsl:if>
510     </td>
511     <td align="{$direction.align.start}">
512       <xsl:apply-templates select="$revdate"/>
513     </td>
514     <xsl:choose>
515       <xsl:when test="count($revauthor)=0">
516         <td align="{$direction.align.start}">
517           <xsl:call-template name="dingbat">
518             <xsl:with-param name="dingbat">nbsp</xsl:with-param>
519           </xsl:call-template>
520         </td>
521       </xsl:when>
522       <xsl:otherwise>
523         <td align="{$direction.align.start}">
524           <xsl:for-each select="$revauthor">
525             <xsl:apply-templates select="."/>
526             <xsl:if test="position() != last()">
527               <xsl:text>, </xsl:text>
528             </xsl:if>
529           </xsl:for-each>
530         </td>
531       </xsl:otherwise>
532     </xsl:choose>
533   </tr>
534   <xsl:if test="$revremark">
535     <tr>
536       <td align="{$direction.align.start}" colspan="3">
537         <xsl:apply-templates select="$revremark"/>
538       </td>
539     </tr>
540   </xsl:if>
541 </xsl:template>
542
543 <xsl:template match="revision/revnumber">
544   <xsl:apply-templates/>
545 </xsl:template>
546
547 <xsl:template match="revision/date">
548   <xsl:apply-templates/>
549 </xsl:template>
550
551 <xsl:template match="revision/authorinitials">
552   <xsl:text>, </xsl:text>
553   <xsl:apply-templates/>
554 </xsl:template>
555
556 <xsl:template match="revision/authorinitials[1]" priority="2">
557   <xsl:apply-templates/>
558 </xsl:template>
559
560 <xsl:template match="revision/revremark">
561   <xsl:apply-templates/>
562 </xsl:template>
563
564 <xsl:template match="revision/revdescription">
565   <xsl:apply-templates/>
566 </xsl:template>
567
568 <!-- ==================================================================== -->
569
570 <xsl:template match="ackno|acknowledgements[parent::article]">
571   <xsl:call-template name="block.object"/>
572 </xsl:template>
573
574 <!-- ==================================================================== -->
575
576 <xsl:template match="highlights">
577   <xsl:call-template name="block.object"/>
578 </xsl:template>
579
580 <!-- ==================================================================== -->
581
582 </xsl:stylesheet>