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