2 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
3 xmlns:
exsl=
"http://exslt.org/common"
4 exclude-result-prefixes=
"exsl"
7 <!-- ********************************************************************
8 $Id: block.xsl,v 1.1 2007/03/10 05:15:34 scott Exp $
9 ********************************************************************
11 This file is part of the XSL DocBook Stylesheet distribution.
12 See ../README or http://docbook.sf.net/release/xsl/current/ for
13 copyright and other information.
15 ******************************************************************** -->
17 <!-- ==================================================================== -->
19 <xsl:template match=
"caution|important|note|tip|warning">
20 <xsl:call-template name=
"nested-section-title"/>
21 <xsl:apply-templates/>
22 <xsl:text> </xsl:text>
25 <xsl:template match=
"formalpara">
26 <xsl:variable name=
"title.wrapper">
27 <bold><xsl:value-of select=
"normalize-space(title[1])"/></bold>
29 <xsl:text>.PP
</xsl:text>
30 <!-- * don't put linebreak after head; instead render it as a "run in" -->
31 <!-- * head, that is, inline, with a period and space following it -->
32 <xsl:apply-templates mode=
"bold" select=
"exsl:node-set($title.wrapper)"/>
33 <xsl:text>.
</xsl:text>
34 <xsl:apply-templates/>
37 <xsl:template match=
"formalpara/para">
38 <xsl:call-template name=
"mixed-block"/>
39 <xsl:text> </xsl:text>
42 <xsl:template match=
"para">
43 <!-- * FIXME: Need to extract the ancestor::footnote, etc. checking and -->
44 <!-- * move to named template so that we can call it from templates for -->
45 <!-- * other block elements also -->
47 <!-- * If a para is a descendant of a footnote, etc., then indent it -->
48 <!-- * (unless it is the first child, in which case don't generate -->
49 <!-- * anything at all to mark its start). -->
50 <!-- * FIXME: *blurb checking should not be munged in here the way -->
51 <!-- * it currently is; this probably breaks blurb indenting. -->
52 <xsl:when test=
"ancestor::footnote or
53 ancestor::annotation or
54 ancestor::authorblurb or
55 ancestor::personblurb">
56 <xsl:if test=
"preceding-sibling::*[not(name() ='')]">
57 <xsl:text>.sp
</xsl:text>
58 <xsl:text> </xsl:text>
59 <xsl:text>.RS
4n
</xsl:text>
60 <xsl:text> </xsl:text>
64 <xsl:text>.PP
</xsl:text>
65 <xsl:text> </xsl:text>
68 <xsl:call-template name=
"mixed-block"/>
69 <xsl:if test=
"ancestor::footnote or
70 ancestor::annotation or
71 ancestor::authorblurb or
72 ancestor::personblurb">
73 <xsl:if test=
"preceding-sibling::*[not(name() ='')]">
74 <xsl:text> </xsl:text>
75 <xsl:text>.RE
</xsl:text>
76 <xsl:text> </xsl:text>
79 <xsl:text> </xsl:text>
82 <xsl:template match=
"simpara">
83 <xsl:variable name=
"content">
84 <xsl:apply-templates/>
86 <xsl:value-of select=
"normalize-space($content)"/>
87 <xsl:text> </xsl:text>
88 <xsl:if test=
"not(ancestor::authorblurb) and
89 not(ancestor::personblurb)">
90 <xsl:text>.sp
</xsl:text>
94 <!-- ==================================================================== -->
96 <!-- * Yes, address, synopsis, and funcsynopsisinfo are verbatim environments. -->
97 <xsl:template match=
"literallayout|programlisting|screen|
98 address|synopsis|funcsynopsisinfo">
99 <xsl:param name=
"indent">
100 <!-- * Only indent this verbatim if $man.indent.verbatims is -->
101 <!-- * non-zero and it is not a child of a *synopsis element -->
102 <xsl:if test=
"not($man.indent.verbatims = 0) and
103 not(substring(local-name(..),
104 string-length(local-name(..))-7) = 'synopsis')">
105 <xsl:text>Yes
</xsl:text>
110 <!-- * Check to see if this verbatim item is within a parent element that -->
111 <!-- * allows mixed content. -->
113 <!-- * If it is within a mixed-content parent, then a line space is -->
114 <!-- * already added before it by the mixed-block template, so we don't -->
115 <!-- * need to add one here. -->
117 <!-- * If it is not within a mixed-content parent, then we need to add a -->
118 <!-- * line space before it. -->
119 <xsl:when test=
"parent::caption|parent::entry|parent::para|
120 parent::td|parent::th" /> <!-- do nothing -->
122 <xsl:text> </xsl:text>
123 <xsl:text>.sp
</xsl:text>
126 <xsl:if test=
"$indent = 'Yes'">
127 <!-- * start indented section -->
128 <xsl:text>.RS
</xsl:text>
129 <xsl:if test=
"not($man.indent.width = '')">
130 <xsl:text> </xsl:text>
131 <xsl:value-of select=
"$man.indent.width"/>
133 <xsl:text> </xsl:text>
136 <xsl:when test=
"self::funcsynopsisinfo">
137 <!-- * All Funcsynopsisinfo content is by default rendered in bold, -->
138 <!-- * because the man(7) man page says this: -->
140 <!-- * For functions, the arguments are always specified using -->
141 <!-- * italics, even in the SYNOPSIS section, where the rest of -->
142 <!-- * the function is specified in bold -->
144 <!-- * Look through the contents of the man/man2 and man3 directories -->
145 <!-- * on your system, and you'll see that most existing pages do follow -->
146 <!-- * this "bold everything in function synopsis" rule. -->
148 <!-- * Users who don't want the bold output can choose to adjust the -->
149 <!-- * man.font.funcsynopsisinfo parameter on their own. So even if you -->
150 <!-- * don't personally like the way it looks, please don't change the -->
151 <!-- * default to be non-bold - because it's a convention that's -->
152 <!-- * followed is the vast majority of existing man pages that document -->
153 <!-- * functions, and we need to follow it by default, like it or no. -->
154 <xsl:text>.ft
</xsl:text>
155 <xsl:value-of select=
"$man.font.funcsynopsisinfo"/>
156 <xsl:text> </xsl:text>
157 <xsl:text>.nf
</xsl:text>
158 <xsl:apply-templates/>
159 <xsl:text> </xsl:text>
160 <xsl:text>.fi
</xsl:text>
161 <xsl:text>.ft
</xsl:text>
164 <!-- * Other verbatims do not need to get bolded -->
165 <xsl:text>.nf
</xsl:text>
166 <xsl:apply-templates/>
167 <xsl:text> </xsl:text>
168 <xsl:text>.fi
</xsl:text>
171 <xsl:if test=
"$indent = 'Yes'">
172 <!-- * end indented section -->
173 <xsl:text>.RE
</xsl:text>
175 <!-- * if first following sibling node of this verbatim -->
176 <!-- * environment is a text node, output a line of space before it -->
177 <xsl:if test=
"following-sibling::node()[1][name(.) = '']">
178 <xsl:text>.sp
</xsl:text>
182 <!-- ==================================================================== -->
184 <xsl:template match=
"table|informaltable">
185 <xsl:apply-templates select=
"." mode=
"to.tbl">
186 <!--* we call the to.tbl mode with the "source" param so that we can -->
187 <!--* preserve the context information and pass it down to the -->
188 <!--* named templates that do the actual table processing -->
189 <xsl:with-param name=
"source" select=
"ancestor::refentry/refnamediv[1]/refname[1]"/>
190 </xsl:apply-templates>
193 <!-- ==================================================================== -->
195 <xsl:template match=
"informalexample">
196 <xsl:apply-templates/>
199 <!-- ==================================================================== -->
201 <xsl:template match=
"figure">
202 <xsl:variable name=
"param.placement"
203 select=
"substring-after(normalize-space($formal.title.placement),
204 concat(local-name(.), ' '))"/>
206 <xsl:variable name=
"placement">
208 <xsl:when test=
"contains($param.placement, ' ')">
209 <xsl:value-of select=
"substring-before($param.placement, ' ')"/>
211 <xsl:when test=
"$param.placement = ''">before
</xsl:when>
213 <xsl:value-of select=
"$param.placement"/>
218 <xsl:text>.PP
</xsl:text>
219 <xsl:call-template name=
"formal.object">
220 <xsl:with-param name=
"placement" select=
"$placement"/>
222 <xsl:text> </xsl:text>
225 <!-- ==================================================================== -->
227 <xsl:template match=
"mediaobject">
228 <xsl:text>.sp
</xsl:text>
229 <xsl:text> </xsl:text>
230 <xsl:text>.RS
</xsl:text>
231 <xsl:if test=
"not($list-indent = '')">
232 <xsl:text> </xsl:text>
233 <xsl:value-of select=
"$list-indent"/>
235 <xsl:text> </xsl:text>
236 <xsl:apply-templates/>
237 <xsl:text> </xsl:text>
238 <xsl:text>.RE
</xsl:text>
241 <xsl:template match=
"imageobject">
242 <xsl:text>[IMAGE]
</xsl:text>
243 <xsl:apply-templates/>
244 <xsl:text> </xsl:text>
247 <xsl:template match=
"textobject[parent::inlinemediaobject]">
248 <xsl:text>[
</xsl:text>
249 <xsl:value-of select=
"."/>
250 <xsl:text>]
</xsl:text>
253 <xsl:template match=
"textobject">
254 <xsl:apply-templates/>
257 <!-- ==================================================================== -->
259 <xsl:template name=
"formal.object">
260 <xsl:param name=
"placement" select=
"'before'"/>
261 <xsl:param name=
"class" select=
"local-name(.)"/>
264 <xsl:when test=
"$placement = 'before'">
265 <xsl:call-template name=
"formal.object.heading"/>
266 <xsl:apply-templates/>
269 <xsl:apply-templates/>
270 <xsl:call-template name=
"formal.object.heading"/>
275 <xsl:template name=
"formal.object.heading">
276 <xsl:param name=
"object" select=
"."/>
277 <xsl:param name=
"title">
278 <bold><xsl:apply-templates select=
"$object" mode=
"object.title.markup.textonly"/></bold>
280 <xsl:apply-templates mode=
"bold" select=
"exsl:node-set($title)"/>
281 <xsl:text> </xsl:text>
284 <!-- ==================================================================== -->
286 <!-- * suppress abstract -->
287 <xsl:template match=
"abstract"/>