2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5
<!-- ********************************************************************
6
$Id: refentry.xsl 8235 2009-02-09 16:22:14Z xmldoc $
7
********************************************************************
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.
13
******************************************************************** -->
15
<!-- ==================================================================== -->
17
<xsl:template match="refnamediv">
19
<xsl:when test="preceding-sibling::refnamediv">
20
<!-- * No title on secondary refnamedivs! -->
21
<!-- * Just put a single line break instead -->
22
<xsl:text>.br </xsl:text>
25
<xsl:call-template name="make.subheading">
26
<xsl:with-param name="title">
27
<xsl:apply-templates select="." mode="subheading.markup"/>
32
<xsl:call-template name="mark.subheading"/>
33
<!-- * if we have multiple Refname instances, separate the names -->
34
<!-- * with commas -->
35
<xsl:for-each select="refname">
36
<xsl:if test="position()>1">
37
<xsl:text>, </xsl:text>
39
<xsl:call-template name="string.subst">
40
<!-- * To create the name(s) for this man page, replace any -->
41
<!-- * spaces in the refname(s) with underscores. This ensures -->
42
<!-- * that tools like lexgrog(1) will be able to parse the name -->
43
<!-- * (lexgrog won’t parse names that contain spaces). -->
44
<xsl:with-param name="string" select="."/>
45
<xsl:with-param name="target" select="' '"/>
46
<xsl:with-param name="replacement" select="'_'"/>
49
<!-- * The man(7) man pages says: -->
51
<!-- * The only required heading is NAME, which should be the -->
52
<!-- * first section and be followed on the next line by a one -->
53
<!-- * line description of the program: -->
55
<!-- * .SH NAME chess \- the game of chess -->
57
<!-- * It is extremely important that this format is followed, -->
58
<!-- * and that there is a backslash before the single dash -->
59
<!-- * which follows the command name. This syntax is used by -->
60
<!-- * the makewhatis(8) program to create a database of short -->
61
<!-- * command descriptions for the whatis(1) and apropos(1) -->
64
<xsl:if test="refpurpose/node()">
65
<xsl:text> \- </xsl:text>
66
<xsl:variable name="refpurpose">
67
<xsl:apply-templates select="refpurpose/node()"/>
69
<xsl:value-of select="normalize-space($refpurpose)"/>
71
<xsl:text> </xsl:text>
74
<xsl:template match="refsynopsisdiv">
75
<xsl:call-template name="make.subheading">
76
<xsl:with-param name="title">
77
<xsl:apply-templates select="." mode="subheading.markup"/>
80
<xsl:apply-templates/>
83
<xsl:template match="refsect1|refentry/refsection">
84
<xsl:variable name="title">
85
<xsl:apply-templates select="." mode="subheading.markup"/>
87
<xsl:call-template name="make.subheading">
88
<xsl:with-param name="title">
89
<xsl:value-of select="normalize-space($title)"/>
92
<xsl:apply-templates/>
95
<xsl:template match="refsect2|refentry/refsection/refsection">
96
<xsl:call-template name="mark.subheading"/>
97
<xsl:variable name="title">
100
|refsectioninfo/title
104
<xsl:text>.SS "</xsl:text>
105
<xsl:value-of select="normalize-space($title)"/>
106
<xsl:text>" </xsl:text>
107
<xsl:call-template name="mark.subheading"/>
109
<!-- * If default-indentation adjustment is on, then indent the -->
110
<!-- * child content of this Refsect2 -->
111
<xsl:when test="not($man.indent.refsect = 0)">
112
<xsl:text>.RS </xsl:text>
113
<xsl:apply-templates/>
114
<xsl:text>.RE </xsl:text>
117
<!-- * If default-indentation adjustment is on, then do not -->
118
<!-- * indent the child content of this Refsect2, because -->
119
<!-- * the title is already "sticking out to the left" -->
120
<!-- * (as the groff_man(7) man page describes it), which -->
121
<!-- * actually means the title is indented by the value of -->
122
<!-- * the SN register, which appears by default to be -->
123
<!-- * about half of the default indentation value -->
124
<xsl:apply-templates/>
129
<xsl:template match="refsect3|refentry/refsection/refsection/refsection">
130
<xsl:variable name="title">
131
<xsl:value-of select="(info/title
132
|refsectioninfo/title
137
<!-- * If default-indentation adjustment is on, then indent the -->
138
<!-- * child content of this Refsect3 or Refsection. -->
139
<xsl:when test="not($man.indent.refsect != 0)">
140
<xsl:call-template name="nested-section-title"/>
141
<xsl:text>.RS</xsl:text>
142
<xsl:if test="not($man.indent.width = '')">
143
<xsl:text> </xsl:text>
144
<xsl:value-of select="$man.indent.width"/>
146
<xsl:text> </xsl:text>
147
<xsl:apply-templates/>
148
<xsl:text>.RE </xsl:text>
151
<!-- * If default-indentation adjustment is on, then do not -->
152
<!-- * indent the child content of this Refsect2, because -->
153
<!-- * the title is already "sticking out to the left" -->
154
<!-- * (as the groff_man(7) man page describes it), which -->
155
<!-- * actually means the title is indented by the value of -->
156
<!-- * the SN register, which appears by default to be -->
157
<!-- * about half of the default indentation value -->
158
<xsl:text>.ti (\n(SNu * 5u / 3u) </xsl:text>
159
<xsl:call-template name="nested-section-title"/>
160
<xsl:apply-templates/>
165
<xsl:template match="refsection">
166
<!-- * This template is used for a nested Refsection that is -->
167
<!-- * is a child of a Refsect3-level section (The numberd -->
168
<!-- * Refsect hierarchy in DocBook ends with Refsect3, so -->
169
<!-- * there is not actually a Refsect4 element.) -->
170
<xsl:variable name="title">
171
<xsl:value-of select="(info/title
172
|refsectioninfo/title
176
<xsl:variable name="indent-width">
177
<xsl:if test="not($man.indent.refsect = 0)">
178
<!-- * If default-indentation adjustment is on, then indent the -->
179
<!-- * child content of this Refsect3 or Refsection. -->
180
<xsl:text>(\n(SNu) </xsl:text>
183
<xsl:call-template name="nested-section-title"/>
184
<xsl:text>.RS (\n(SNu) </xsl:text>
185
<xsl:apply-templates/>
186
<xsl:text>.RE </xsl:text>
189
<!-- ==================================================================== -->
191
<xsl:template match="refsect1|refentry/refsection"
192
mode="subheading.markup">
193
<xsl:variable name="title" select="(info/title
194
|refsectioninfo/title
197
<xsl:apply-templates select="$title" mode="title.markup"/>
200
<xsl:template match="refsect1|refentry/refsection"
202
<!-- * Note: This template is used just for generating the text for -->
203
<!-- * cross-references to Refsect1 or top-level Refsection instances. -->
204
<xsl:variable name="title" select="(info/title
205
|refsectioninfo/title
208
<xsl:call-template name="process.SH.xref">
209
<xsl:with-param name="title">
210
<xsl:apply-templates select="$title" mode="title.markup"/>
215
<!-- * Output of Titles from Xref with Endterm needs to be handled -->
216
<!-- * separately from output for Endterm-less Xref -->
217
<xsl:template match="refsect1/title
218
|refentry/refsection/title
219
|refsynopsisdiv/title"
221
<xsl:call-template name="process.SH.xref">
222
<xsl:with-param name="title">
223
<xsl:apply-templates/>
228
<xsl:template match="refsynopsisdiv" mode="subheading.markup">
229
<xsl:param name="allow-anchors" select="0"/>
230
<xsl:variable name="title">
231
<xsl:call-template name="get.refsynopsisdiv.title">
232
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
235
<xsl:value-of select="$title"/>
238
<xsl:template match="refsynopsisdiv" mode="title.markup">
239
<!-- * Note: This template is used just for generating the text for -->
240
<!-- * cross-references to Refsynopsisdiv instances. -->
241
<xsl:param name="allow-anchors" select="0"/>
242
<xsl:variable name="title">
243
<xsl:call-template name="get.refsynopsisdiv.title">
244
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
247
<xsl:call-template name="process.SH.xref">
248
<xsl:with-param name="title" select="$title"/>
252
<xsl:template name="get.refsynopsisdiv.title">
253
<xsl:param name="allow-anchors"/>
255
<xsl:when test="info/title
256
|refsynopsisdivinfo/title
260
|refsynopsisdivinfo/title
261
|title)[1]" mode="title.markup">
262
<xsl:with-param name="allow-anchors" select="$allow-anchors"/>
263
</xsl:apply-templates>
266
<xsl:call-template name="gentext">
267
<xsl:with-param name="key" select="'RefSynopsisDiv'"/>
273
<xsl:template match="refnamediv" mode="subheading.markup">
274
<xsl:call-template name="gentext">
275
<xsl:with-param name="key" select="'RefName'"/>
279
<xsl:template match="refnamediv" mode="title.markup">
280
<xsl:call-template name="process.SH.xref">
281
<xsl:with-param name="title">
282
<xsl:call-template name="gentext">
283
<xsl:with-param name="key" select="'RefName'"/>
289
<xsl:template match="refnamediv" mode="xref-to">
290
<xsl:apply-templates select="." mode="title.markup"/>
293
<!-- * suppress any title we don't otherwise process elsewhere -->
294
<xsl:template match="title"/>
296
<!-- ==================================================================== -->
298
<xsl:template name="process.SH.xref">
299
<xsl:param name="title"/>
301
<xsl:when test="not($man.output.better.ps.enabled = 0)">
302
<xsl:text>\c</xsl:text>
303
<xsl:text>▒</xsl:text>
304
<xsl:text>.SH-xref </xsl:text>
305
<xsl:text>"</xsl:text>
306
<xsl:value-of select="$title"/>
307
<xsl:text>\c"</xsl:text>
308
<xsl:text>▒</xsl:text>
309
<xsl:text>\&</xsl:text>
312
<xsl:call-template name="string.upper">
313
<xsl:with-param name="string" select="$title"/>