Project

General

Profile

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 8441 2009-05-24 02:14:56Z abdelazer $
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="anchor"/>
28
    <xsl:apply-templates/>
29
  </div>
30
</xsl:template>
31

    
32
<!-- ==================================================================== -->
33

    
34
<xsl:template match="para">
35
  <xsl:call-template name="paragraph">
36
    <xsl:with-param name="class">
37
      <xsl:if test="@role and $para.propagates.style != 0">
38
        <xsl:value-of select="@role"/>
39
      </xsl:if>
40
    </xsl:with-param>
41
    <xsl:with-param name="content">
42
      <xsl:if test="position() = 1 and parent::listitem">
43
        <xsl:call-template name="anchor">
44
          <xsl:with-param name="node" select="parent::listitem"/>
45
        </xsl:call-template>
46
      </xsl:if>
47

    
48
      <xsl:call-template name="anchor"/>
49
      <xsl:apply-templates/>
50
    </xsl:with-param>
51
  </xsl:call-template>
52
</xsl:template>
53

    
54
<xsl:template name="paragraph">
55
  <xsl:param name="class" select="''"/>
56
  <xsl:param name="content"/>
57

    
58
  <xsl:variable name="p">
59
    <p>
60
      <xsl:choose>
61
        <xsl:when test="$class != ''">
62
          <xsl:call-template name="common.html.attributes">
63
            <xsl:with-param name="class" select="$class"/>
64
          </xsl:call-template>
65
        </xsl:when>
66
        <xsl:otherwise>
67
          <xsl:call-template name="locale.html.attributes"/>
68
        </xsl:otherwise>
69
      </xsl:choose>
70
      <xsl:copy-of select="$content"/>
71
    </p>
72
  </xsl:variable>
73

    
74
  <xsl:choose>
75
    <xsl:when test="$html.cleanup != 0">
76
      <xsl:call-template name="unwrap.p">
77
        <xsl:with-param name="p" select="$p"/>
78
      </xsl:call-template>
79
    </xsl:when>
80
    <xsl:otherwise>
81
      <xsl:copy-of select="$p"/>
82
    </xsl:otherwise>
83
  </xsl:choose>
84
</xsl:template>
85

    
86
<xsl:template match="simpara">
87
  <!-- see also listitem/simpara in lists.xsl -->
88
  <p>
89
    <xsl:call-template name="locale.html.attributes"/>
90
    <xsl:if test="@role and $para.propagates.style != 0">
91
      <xsl:apply-templates select="." mode="class.attribute">
92
        <xsl:with-param name="class" select="@role"/>
93
      </xsl:apply-templates>
94
    </xsl:if>
95

    
96
    <xsl:call-template name="anchor"/>
97
    <xsl:apply-templates/>
98
  </p>
99
</xsl:template>
100

    
101
<xsl:template match="formalpara">
102
  <xsl:call-template name="paragraph">
103
    <xsl:with-param name="class">
104
      <xsl:if test="@role and $para.propagates.style != 0">
105
        <xsl:value-of select="@role"/>
106
      </xsl:if>
107
    </xsl:with-param>
108
    <xsl:with-param name="content">
109
      <xsl:call-template name="anchor"/>
110
      <xsl:apply-templates/>
111
    </xsl:with-param>
112
  </xsl:call-template>
113
</xsl:template>
114

    
115
<!-- Only use title from info -->
116
<xsl:template match="formalpara/info">
117
  <xsl:apply-templates select="title"/>
118
</xsl:template>
119

    
120
<xsl:template match="formalpara/title|formalpara/info/title">
121
  <xsl:variable name="titleStr">
122
      <xsl:apply-templates/>
123
  </xsl:variable>
124
  <xsl:variable name="lastChar">
125
    <xsl:if test="$titleStr != ''">
126
      <xsl:value-of select="substring($titleStr,string-length($titleStr),1)"/>
127
    </xsl:if>
128
  </xsl:variable>
129

    
130
  <b>
131
    <xsl:copy-of select="$titleStr"/>
132
    <xsl:if test="$lastChar != ''
133
                  and not(contains($runinhead.title.end.punct, $lastChar))">
134
      <xsl:value-of select="$runinhead.default.title.end.punct"/>
135
    </xsl:if>
136
    <xsl:text>&#160;</xsl:text>
137
  </b>
138
</xsl:template>
139

    
140
<xsl:template match="formalpara/para">
141
  <xsl:apply-templates/>
142
</xsl:template>
143

    
144
<!-- ==================================================================== -->
145

    
146
<xsl:template match="blockquote">
147
  <div>
148
    <xsl:call-template name="common.html.attributes"/>
149
    <xsl:call-template name="anchor"/>
150

    
151
    <xsl:choose>
152
      <xsl:when test="attribution">
153
        <table border="0" width="100%"
154
               cellspacing="0" cellpadding="0" class="blockquote"
155
               summary="Block quote">
156
          <tr>
157
            <td width="10%" valign="top">&#160;</td>
158
            <td width="80%" valign="top">
159
              <xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
160
            </td>
161
            <td width="10%" valign="top">&#160;</td>
162
          </tr>
163
          <tr>
164
            <td width="10%" valign="top">&#160;</td>
165
            <td colspan="2" align="{$direction.align.end}" valign="top">
166
              <xsl:text>--</xsl:text>
167
              <xsl:apply-templates select="attribution"/>
168
            </td>
169
          </tr>
170
        </table>
171
      </xsl:when>
172
      <xsl:otherwise>
173
        <blockquote>
174
          <xsl:call-template name="common.html.attributes"/>
175
          <xsl:apply-templates/>
176
        </blockquote>
177
      </xsl:otherwise>
178
    </xsl:choose>
179
  </div>
180
</xsl:template>
181

    
182
<xsl:template match="blockquote/title|blockquote/info/title">
183
  <div class="blockquote-title">
184
    <p>
185
      <b>
186
        <xsl:apply-templates/>
187
      </b>
188
    </p>
189
  </div>
190
</xsl:template>
191

    
192
<!-- 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 -->
193
<xsl:template match="epigraph">
194
  <div>
195
    <xsl:call-template name="common.html.attributes"/>
196
      <xsl:apply-templates select="para|simpara|formalpara|literallayout"/>
197
      <xsl:if test="attribution">
198
        <div class="attribution">
199
          <span>&#x2014;<xsl:apply-templates select="attribution"/></span>
200
        </div>
201
      </xsl:if>
202
  </div>
203
</xsl:template>
204

    
205
<xsl:template match="attribution">
206
  <span>
207
    <xsl:call-template name="common.html.attributes"/>
208
    <xsl:apply-templates/>
209
  </span>
210
</xsl:template>
211

    
212
<!-- ==================================================================== -->
213

    
214
<xsl:template match="abstract|sidebar">
215
  <div>
216
    <xsl:call-template name="common.html.attributes"/>
217
    <xsl:call-template name="anchor"/>
218
    <xsl:call-template name="formal.object.heading">
219
      <xsl:with-param name="title">
220
        <xsl:apply-templates select="." mode="title.markup">
221
          <xsl:with-param name="allow-anchors" select="'1'"/>
222
        </xsl:apply-templates>
223
      </xsl:with-param>
224
    </xsl:call-template>
225
    <xsl:apply-templates/>
226
  </div>
227
</xsl:template>
228

    
229
<xsl:template match="abstract/title|sidebar/title">
230
</xsl:template>
231

    
232
<xsl:template match="sidebar/sidebarinfo|sidebar/info"/>
233

    
234
<!-- ==================================================================== -->
235

    
236
<xsl:template match="msgset">
237
  <xsl:apply-templates/>
238
</xsl:template>
239

    
240
<xsl:template match="msgentry">
241
  <xsl:call-template name="block.object"/>
242
</xsl:template>
243

    
244
<xsl:template match="simplemsgentry">
245
  <xsl:call-template name="block.object"/>
246
</xsl:template>
247

    
248
<xsl:template match="msg">
249
  <xsl:call-template name="block.object"/>
250
</xsl:template>
251

    
252
<xsl:template match="msgmain">
253
  <xsl:apply-templates/>
254
</xsl:template>
255

    
256
<xsl:template match="msgmain/title">
257
  <b><xsl:apply-templates/></b>
258
</xsl:template>
259

    
260
<xsl:template match="msgsub">
261
  <xsl:apply-templates/>
262
</xsl:template>
263

    
264
<xsl:template match="msgsub/title">
265
  <b><xsl:apply-templates/></b>
266
</xsl:template>
267

    
268
<xsl:template match="msgrel">
269
  <xsl:apply-templates/>
270
</xsl:template>
271

    
272
<xsl:template match="msgrel/title">
273
  <b><xsl:apply-templates/></b>
274
</xsl:template>
275

    
276
<xsl:template match="msgtext">
277
  <xsl:apply-templates/>
278
</xsl:template>
279

    
280
<xsl:template match="msginfo">
281
  <xsl:call-template name="block.object"/>
282
</xsl:template>
283

    
284
<xsl:template match="msglevel">
285
  <p>
286
    <b>
287
      <xsl:call-template name="gentext.template">
288
        <xsl:with-param name="context" select="'msgset'"/>
289
        <xsl:with-param name="name" select="'MsgLevel'"/>
290
      </xsl:call-template>
291
    </b>
292
    <xsl:apply-templates/>
293
  </p>
294
</xsl:template>
295

    
296
<xsl:template match="msgorig">
297
  <p>
298
    <b>
299
      <xsl:call-template name="gentext.template">
300
        <xsl:with-param name="context" select="'msgset'"/>
301
        <xsl:with-param name="name" select="'MsgOrig'"/>
302
      </xsl:call-template>
303
    </b>
304
    <xsl:apply-templates/>
305
  </p>
306
</xsl:template>
307

    
308
<xsl:template match="msgaud">
309
  <p>
310
    <b>
311
      <xsl:call-template name="gentext.template">
312
        <xsl:with-param name="context" select="'msgset'"/>
313
        <xsl:with-param name="name" select="'MsgAud'"/>
314
      </xsl:call-template>
315
    </b>
316
    <xsl:apply-templates/>
317
  </p>
318
</xsl:template>
319

    
320
<xsl:template match="msgexplan">
321
  <xsl:call-template name="block.object"/>
322
</xsl:template>
323

    
324
<xsl:template match="msgexplan/title">
325
  <p><b><xsl:apply-templates/></b></p>
326
</xsl:template>
327

    
328
<!-- ==================================================================== -->
329

    
330
<xsl:template match="revhistory">
331
  <div>
332
    <xsl:call-template name="common.html.attributes"/>
333
    <table border="0" width="100%" summary="Revision history">
334
      <tr>
335
        <th align="{$direction.align.start}" valign="top" colspan="3">
336
          <b>
337
            <xsl:call-template name="gentext">
338
              <xsl:with-param name="key" select="'RevHistory'"/>
339
            </xsl:call-template>
340
          </b>
341
        </th>
342
      </tr>
343
      <xsl:apply-templates/>
344
    </table>
345
  </div>
346
</xsl:template>
347

    
348
<xsl:template match="revhistory/revision">
349
  <xsl:variable name="revnumber" select="revnumber"/>
350
  <xsl:variable name="revdate"   select="date"/>
351
  <xsl:variable name="revauthor" select="authorinitials|author"/>
352
  <xsl:variable name="revremark" select="revremark|revdescription"/>
353
  <tr>
354
    <td align="{$direction.align.start}">
355
      <xsl:if test="$revnumber">
356
        <xsl:call-template name="gentext">
357
          <xsl:with-param name="key" select="'Revision'"/>
358
        </xsl:call-template>
359
        <xsl:call-template name="gentext.space"/>
360
        <xsl:apply-templates select="$revnumber"/>
361
      </xsl:if>
362
    </td>
363
    <td align="{$direction.align.start}">
364
      <xsl:apply-templates select="$revdate"/>
365
    </td>
366
    <xsl:choose>
367
      <xsl:when test="count($revauthor)=0">
368
        <td align="{$direction.align.start}">
369
          <xsl:call-template name="dingbat">
370
            <xsl:with-param name="dingbat">nbsp</xsl:with-param>
371
          </xsl:call-template>
372
        </td>
373
      </xsl:when>
374
      <xsl:otherwise>
375
        <td align="{$direction.align.start}">
376
          <xsl:for-each select="$revauthor">
377
            <xsl:apply-templates select="."/>
378
            <xsl:if test="position() != last()">
379
              <xsl:text>, </xsl:text>
380
            </xsl:if>
381
          </xsl:for-each>
382
        </td>
383
      </xsl:otherwise>
384
    </xsl:choose>
385
  </tr>
386
  <xsl:if test="$revremark">
387
    <tr>
388
      <td align="{$direction.align.start}" colspan="3">
389
        <xsl:apply-templates select="$revremark"/>
390
      </td>
391
    </tr>
392
  </xsl:if>
393
</xsl:template>
394

    
395
<xsl:template match="revision/revnumber">
396
  <xsl:apply-templates/>
397
</xsl:template>
398

    
399
<xsl:template match="revision/date">
400
  <xsl:apply-templates/>
401
</xsl:template>
402

    
403
<xsl:template match="revision/authorinitials">
404
  <xsl:text>, </xsl:text>
405
  <xsl:apply-templates/>
406
</xsl:template>
407

    
408
<xsl:template match="revision/authorinitials[1]" priority="2">
409
  <xsl:apply-templates/>
410
</xsl:template>
411

    
412
<xsl:template match="revision/revremark">
413
  <xsl:apply-templates/>
414
</xsl:template>
415

    
416
<xsl:template match="revision/revdescription">
417
  <xsl:apply-templates/>
418
</xsl:template>
419

    
420
<!-- ==================================================================== -->
421

    
422
<xsl:template match="ackno|acknowledgements[parent::article]">
423
  <p>
424
    <xsl:call-template name="common.html.attributes"/>
425
    <xsl:apply-templates/>
426
  </p>
427
</xsl:template>
428

    
429
<!-- ==================================================================== -->
430

    
431
<xsl:template match="highlights">
432
  <xsl:call-template name="block.object"/>
433
</xsl:template>
434

    
435
<!-- ==================================================================== -->
436

    
437
</xsl:stylesheet>
(7-7/39)