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,v 1.23 2006/05/21 12:25:21 kosek Exp $
7     ********************************************************************
8
9     This file is part of the XSL DocBook Stylesheet distribution.
10     See ../README or http://nwalsh.com/docbook/xsl/ for copyright
11     and other information.
12
13     ******************************************************************** -->
14
15<!-- ==================================================================== -->
16<!-- What should we do about styling blockinfo? -->
17
18<xsl:template match="blockinfo">
19  <!-- suppress -->
20</xsl:template>
21
22<!-- ==================================================================== -->
23
24<xsl:template name="block.object">
25  <div class="{name(.)}">
26    <xsl:call-template name="anchor"/>
27    <xsl:apply-templates/>
28  </div>
29</xsl:template>
30
31<!-- ==================================================================== -->
32
33<xsl:template match="para">
34  <xsl:call-template name="paragraph">
35    <xsl:with-param name="class">
36      <xsl:if test="@role and $para.propagates.style != 0">
37        <xsl:value-of select="@role"/>
38      </xsl:if>
39    </xsl:with-param>
40    <xsl:with-param name="content">
41      <xsl:if test="position() = 1 and parent::listitem">
42        <xsl:call-template name="anchor">
43          <xsl:with-param name="node" select="parent::listitem"/>
44        </xsl:call-template>
45      </xsl:if>
46
47      <xsl:call-template name="anchor"/>
48      <xsl:apply-templates/>
49    </xsl:with-param>
50  </xsl:call-template>
51</xsl:template>
52
53<xsl:template name="paragraph">
54  <xsl:param name="class" select="''"/>
55  <xsl:param name="content"/>
56
57  <xsl:variable name="p">
58    <p>
59      <xsl:call-template name="dir"/>
60      <xsl:if test="$class != ''">
61        <xsl:attribute name="class">
62          <xsl:value-of select="$class"/>
63        </xsl:attribute>
64      </xsl:if>
65      <xsl:copy-of select="$content"/>
66    </p>
67  </xsl:variable>
68
69  <xsl:choose>
70    <xsl:when test="$html.cleanup != 0">
71      <xsl:call-template name="unwrap.p">
72        <xsl:with-param name="p" select="$p"/>
73      </xsl:call-template>
74    </xsl:when>
75    <xsl:otherwise>
76      <xsl:copy-of select="$p"/>
77    </xsl:otherwise>
78  </xsl:choose>
79</xsl:template>
80
81<xsl:template match="simpara">
82  <!-- see also listitem/simpara in lists.xsl -->
83  <p>
84    <xsl:if test="@role and $para.propagates.style != 0">
85      <xsl:attribute name="class">
86        <xsl:value-of select="@role"/>
87      </xsl:attribute>
88    </xsl:if>
89
90    <xsl:call-template name="anchor"/>
91    <xsl:apply-templates/>
92  </p>
93</xsl:template>
94
95<xsl:template match="formalpara">
96  <xsl:call-template name="paragraph">
97    <xsl:with-param name="class">
98      <xsl:if test="@role and $para.propagates.style != 0">
99        <xsl:value-of select="@role"/>
100      </xsl:if>
101    </xsl:with-param>
102    <xsl:with-param name="content">
103      <xsl:call-template name="anchor"/>
104      <xsl:apply-templates/>
105    </xsl:with-param>
106  </xsl:call-template>
107</xsl:template>
108
109<xsl:template match="formalpara/title">
110  <xsl:variable name="titleStr">
111      <xsl:apply-templates/>
112  </xsl:variable>
113  <xsl:variable name="lastChar">
114    <xsl:if test="$titleStr != ''">
115      <xsl:value-of select="substring($titleStr,string-length($titleStr),1)"/>
116    </xsl:if>
117  </xsl:variable>
118
119  <b>
120    <xsl:copy-of select="$titleStr"/>
121    <xsl:if test="$lastChar != ''
122                  and not(contains($runinhead.title.end.punct, $lastChar))">
123      <xsl:value-of select="$runinhead.default.title.end.punct"/>
124    </xsl:if>
125    <xsl:text>&#160;</xsl:text>
126  </b>
127</xsl:template>
128
129<xsl:template match="formalpara/para">
130  <xsl:apply-templates/>
131</xsl:template>
132
133<!-- ==================================================================== -->
134
135<xsl:template match="blockquote">
136  <div class="{local-name(.)}">
137    <xsl:if test="@lang or @xml:lang">
138      <xsl:call-template name="language.attribute"/>
139    </xsl:if>
140    <xsl:call-template name="anchor"/>
141
142    <xsl:choose>
143      <xsl:when test="attribution">
144        <table border="0" width="100%"
145               cellspacing="0" cellpadding="0" class="blockquote"
146               summary="Block quote">
147          <tr>
148            <td width="10%" valign="top">&#160;</td>
149            <td width="80%" valign="top">
150              <xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
151            </td>
152            <td width="10%" valign="top">&#160;</td>
153          </tr>
154          <tr>
155            <td width="10%" valign="top">&#160;</td>
156            <td colspan="2" align="right" valign="top">
157              <xsl:text>--</xsl:text>
158              <xsl:apply-templates select="attribution"/>
159            </td>
160          </tr>
161        </table>
162      </xsl:when>
163      <xsl:otherwise>
164        <blockquote class="{local-name(.)}">
165          <xsl:apply-templates/>
166        </blockquote>
167      </xsl:otherwise>
168    </xsl:choose>
169  </div>
170</xsl:template>
171
172<xsl:template match="blockquote/title">
173  <div class="blockquote-title">
174    <p>
175      <b>
176        <xsl:apply-templates/>
177      </b>
178    </p>
179  </div>
180</xsl:template>
181
182<xsl:template match="epigraph">
183  <div class="{name(.)}">
184      <xsl:apply-templates select="para|simpara|formalpara|literallayout"/>
185      <xsl:if test="attribution">
186        <div class="attribution">
187          <span>--<xsl:apply-templates select="attribution"/></span>
188        </div>
189      </xsl:if>
190  </div>
191</xsl:template>
192
193<xsl:template match="attribution">
194  <span class="{name(.)}"><xsl:apply-templates/></span>
195</xsl:template>
196
197<!-- ==================================================================== -->
198
199<xsl:template match="sidebar">
200  <div class="{name(.)}">
201    <xsl:call-template name="anchor"/>
202    <xsl:apply-templates/>
203  </div>
204</xsl:template>
205
206<xsl:template match="sidebar/title">
207  <p class="title">
208    <b><xsl:apply-templates/></b>
209  </p>
210</xsl:template>
211
212<!-- ==================================================================== -->
213
214<xsl:template match="abstract">
215  <div class="{name(.)}">
216    <xsl:call-template name="anchor"/>
217    <xsl:call-template name="formal.object.heading">
218      <xsl:with-param name="title">
219        <xsl:apply-templates select="." mode="title.markup">
220          <xsl:with-param name="allow-anchors" select="'1'"/>
221        </xsl:apply-templates>
222      </xsl:with-param>
223    </xsl:call-template>
224    <xsl:apply-templates/>
225  </div>
226</xsl:template>
227
228<xsl:template match="abstract/title">
229</xsl:template>
230
231<!-- ==================================================================== -->
232
233<xsl:template match="msgset">
234  <xsl:apply-templates/>
235</xsl:template>
236
237<xsl:template match="msgentry">
238  <xsl:call-template name="block.object"/>
239</xsl:template>
240
241<xsl:template match="simplemsgentry">
242  <xsl:call-template name="block.object"/>
243</xsl:template>
244
245<xsl:template match="msg">
246  <xsl:call-template name="block.object"/>
247</xsl:template>
248
249<xsl:template match="msgmain">
250  <xsl:apply-templates/>
251</xsl:template>
252
253<xsl:template match="msgmain/title">
254  <b><xsl:apply-templates/></b>
255</xsl:template>
256
257<xsl:template match="msgsub">
258  <xsl:apply-templates/>
259</xsl:template>
260
261<xsl:template match="msgsub/title">
262  <b><xsl:apply-templates/></b>
263</xsl:template>
264
265<xsl:template match="msgrel">
266  <xsl:apply-templates/>
267</xsl:template>
268
269<xsl:template match="msgrel/title">
270  <b><xsl:apply-templates/></b>
271</xsl:template>
272
273<xsl:template match="msgtext">
274  <xsl:apply-templates/>
275</xsl:template>
276
277<xsl:template match="msginfo">
278  <xsl:call-template name="block.object"/>
279</xsl:template>
280
281<xsl:template match="msglevel">
282  <p>
283    <b>
284      <xsl:call-template name="gentext.template">
285        <xsl:with-param name="context" select="'msgset'"/>
286        <xsl:with-param name="name" select="'MsgLevel'"/>
287      </xsl:call-template>
288    </b>
289    <xsl:apply-templates/>
290  </p>
291</xsl:template>
292
293<xsl:template match="msgorig">
294  <p>
295    <b>
296      <xsl:call-template name="gentext.template">
297        <xsl:with-param name="context" select="'msgset'"/>
298        <xsl:with-param name="name" select="'MsgOrig'"/>
299      </xsl:call-template>
300    </b>
301    <xsl:apply-templates/>
302  </p>
303</xsl:template>
304
305<xsl:template match="msgaud">
306  <p>
307    <b>
308      <xsl:call-template name="gentext.template">
309        <xsl:with-param name="context" select="'msgset'"/>
310        <xsl:with-param name="name" select="'MsgAud'"/>
311      </xsl:call-template>
312    </b>
313    <xsl:apply-templates/>
314  </p>
315</xsl:template>
316
317<xsl:template match="msgexplan">
318  <xsl:call-template name="block.object"/>
319</xsl:template>
320
321<xsl:template match="msgexplan/title">
322  <p><b><xsl:apply-templates/></b></p>
323</xsl:template>
324
325<!-- ==================================================================== -->
326
327<xsl:template match="revhistory">
328  <div class="{name(.)}">
329    <table border="0" width="100%" summary="Revision history">
330      <tr>
331        <th align="left" valign="top" colspan="3">
332          <b>
333            <xsl:call-template name="gentext">
334              <xsl:with-param name="key" select="'RevHistory'"/>
335            </xsl:call-template>
336          </b>
337        </th>
338      </tr>
339      <xsl:apply-templates/>
340    </table>
341  </div>
342</xsl:template>
343
344<xsl:template match="revhistory/revision">
345  <xsl:variable name="revnumber" select="revnumber"/>
346  <xsl:variable name="revdate"   select="date"/>
347  <xsl:variable name="revauthor" select="authorinitials|author"/>
348  <xsl:variable name="revremark" select="revremark|revdescription"/>
349  <tr>
350    <td align="left">
351      <xsl:if test="$revnumber">
352        <xsl:call-template name="gentext">
353          <xsl:with-param name="key" select="'Revision'"/>
354        </xsl:call-template>
355        <xsl:call-template name="gentext.space"/>
356        <xsl:apply-templates select="$revnumber"/>
357      </xsl:if>
358    </td>
359    <td align="left">
360      <xsl:apply-templates select="$revdate"/>
361    </td>
362    <xsl:choose>
363      <xsl:when test="count($revauthor)=0">
364        <td align="left">
365          <xsl:call-template name="dingbat">
366            <xsl:with-param name="dingbat">nbsp</xsl:with-param>
367          </xsl:call-template>
368        </td>
369      </xsl:when>
370      <xsl:otherwise>
371        <td align="left">
372          <xsl:for-each select="$revauthor">
373            <xsl:apply-templates select="."/>
374            <xsl:if test="position() != last()">
375	      <xsl:text>, </xsl:text>
376	    </xsl:if>
377	  </xsl:for-each>
378        </td>
379      </xsl:otherwise>
380    </xsl:choose>
381  </tr>
382  <xsl:if test="$revremark">
383    <tr>
384      <td align="left" colspan="3">
385        <xsl:apply-templates select="$revremark"/>
386      </td>
387    </tr>
388  </xsl:if>
389</xsl:template>
390
391<xsl:template match="revision/revnumber">
392  <xsl:apply-templates/>
393</xsl:template>
394
395<xsl:template match="revision/date">
396  <xsl:apply-templates/>
397</xsl:template>
398
399<xsl:template match="revision/authorinitials">
400  <xsl:text>, </xsl:text>
401  <xsl:apply-templates/>
402</xsl:template>
403
404<xsl:template match="revision/authorinitials[1]" priority="2">
405  <xsl:apply-templates/>
406</xsl:template>
407
408<xsl:template match="revision/revremark">
409  <xsl:apply-templates/>
410</xsl:template>
411
412<xsl:template match="revision/revdescription">
413  <xsl:apply-templates/>
414</xsl:template>
415
416<!-- ==================================================================== -->
417
418<xsl:template match="ackno">
419  <p class="{name(.)}">
420    <xsl:apply-templates/>
421  </p>
422</xsl:template>
423
424<!-- ==================================================================== -->
425
426<xsl:template match="highlights">
427  <xsl:call-template name="block.object"/>
428</xsl:template>
429
430<!-- ==================================================================== -->
431
432</xsl:stylesheet>
433