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