2 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
5 <!-- ********************************************************************
6 $Id: refentry.xsl,v 1.1 2007/03/10 05:15:34 scott Exp $
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=
"mark.subheading"/>
26 <xsl:text>.SH
"</xsl:text>
27 <xsl:apply-templates select=".
" mode="title.markup
"/>
28 <xsl:text>"</xsl:text>
29 <xsl:text> </xsl:text>
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:value-of select=
"."/>
41 <!-- * The man(7) man pages says: -->
43 <!-- * The only required heading is NAME, which should be the -->
44 <!-- * first section and be followed on the next line by a one -->
45 <!-- * line description of the program: -->
47 <!-- * .SH NAME chess \- the game of chess -->
49 <!-- * It is extremely important that this format is followed, -->
50 <!-- * and that there is a backslash before the single dash -->
51 <!-- * which follows the command name. This syntax is used by -->
52 <!-- * the makewhatis(8) program to create a database of short -->
53 <!-- * command descriptions for the whatis(1) and apropos(1) -->
56 <!-- * So why don't we precede the hyphen with a backslash here? -->
57 <!-- * Well, because it's added later, by the apply-string-subst-map -->
58 <!-- * template, before we generate final output -->
59 <xsl:if test=
"refpurpose/node()">
60 <xsl:text> -
</xsl:text>
61 <xsl:value-of select=
"normalize-space(refpurpose)"/>
63 <xsl:text> </xsl:text>
66 <xsl:template match=
"refsynopsisdiv">
67 <xsl:call-template name=
"mark.subheading"/>
68 <xsl:text>.SH
"</xsl:text>
69 <xsl:apply-templates select=".
" mode="title.markup
"/>
70 <xsl:text>" </xsl:text>
71 <xsl:call-template name=
"mark.subheading"/>
72 <xsl:apply-templates/>
75 <xsl:template match=
"refsect1|refentry/refsection">
76 <xsl:variable name=
"title">
77 <xsl:apply-templates select=
"." mode=
"title.markup"/>
79 <xsl:call-template name=
"mark.subheading"/>
80 <xsl:text>.SH
"</xsl:text>
81 <xsl:value-of select="normalize-space($title)
"/>
82 <xsl:text>" </xsl:text>
83 <xsl:call-template name=
"mark.subheading"/>
84 <xsl:apply-templates/>
87 <xsl:template match=
"refsect2|refentry/refsection/refsection">
88 <xsl:call-template name=
"mark.subheading"/>
89 <xsl:variable name=
"title">
97 <xsl:text>.SS
"</xsl:text>
98 <xsl:value-of select="normalize-space($title)
"/>
99 <xsl:text>" </xsl:text>
100 <xsl:call-template name=
"mark.subheading"/>
102 <!-- * If default-indentation adjustment is on, then indent the -->
103 <!-- * child content of this Refsect2 -->
104 <xsl:when test=
"not($man.indent.refsect = 0)">
105 <xsl:text>.RS
</xsl:text>
106 <xsl:apply-templates/>
107 <xsl:text>.RE
</xsl:text>
110 <!-- * If default-indentation adjustment is on, then do not -->
111 <!-- * indent the child content of thie Refsect2, because -->
112 <!-- * the title is already "sticking out to the left" -->
113 <!-- * (as the groff_man(7) man page describes it), which -->
114 <!-- * actually means the title is indented by the value of -->
115 <!-- * the SN register, which appears by default to be -->
116 <!-- * about half of the default indentation value -->
117 <xsl:apply-templates/>
122 <xsl:template match=
"refsect3|refentry/refsection/refsection/refsection">
123 <xsl:variable name=
"title">
124 <xsl:value-of select=
"(info/title
125 |refsectioninfo/title
130 <!-- * If default-indentation adjustment is on, then indent the -->
131 <!-- * child content of this Refsect3 or Refsection. -->
132 <xsl:when test=
"not($man.indent.refsect != 0)">
133 <xsl:call-template name=
"nested-section-title"/>
134 <xsl:text>.RS
</xsl:text>
135 <xsl:apply-templates/>
136 <xsl:text>.RE
</xsl:text>
139 <!-- * If default-indentation adjustment is on, then do not -->
140 <!-- * indent the child content of thie Refsect2, because -->
141 <!-- * the title is already "sticking out to the left" -->
142 <!-- * (as the groff_man(7) man page describes it), which -->
143 <!-- * actually means the title is indented by the value of -->
144 <!-- * the SN register, which appears by default to be -->
145 <!-- * about half of the default indentation value -->
146 <xsl:text>.ti (\n(SNu *
5u /
3u)
</xsl:text>
147 <xsl:call-template name=
"nested-section-title"/>
148 <xsl:apply-templates/>
153 <xsl:template match=
"refsection">
154 <!-- * This template is used for a nested Refsection that is -->
155 <!-- * is a child of a Refsect3-level section (The numberd -->
156 <!-- * Refsect hierarchy in DocBook ends with Refsect3, so -->
157 <!-- * there is not actually a Refsect4 element.) -->
158 <xsl:variable name=
"title">
159 <xsl:value-of select=
"(info/title
160 |refsectioninfo/title
164 <xsl:variable name=
"indent-width">
165 <xsl:if test=
"not($man.indent.refsect = 0)">
166 <!-- * If default-indentation adjustment is on, then indent the -->
167 <!-- * child content of this Refsect3 or Refsection. -->
168 <xsl:text>(\n(SNu)
</xsl:text>
171 <xsl:call-template name=
"nested-section-title"/>
172 <xsl:text>.RS (\n(SNu)
</xsl:text>
173 <xsl:apply-templates/>
174 <xsl:text>.RE
</xsl:text>
177 <!-- ==================================================================== -->
179 <!-- * Use uppercase to render titles of all instances of Refsect1 or -->
180 <!-- * top-level Refsection, including in cross-references -->
181 <xsl:template match=
"refsect1|refentry/refsection"
183 <xsl:variable name=
"title" select=
"(info/title
184 |refsectioninfo/title
187 <xsl:call-template name=
"string.upper">
188 <xsl:with-param name=
"string">
189 <xsl:apply-templates select=
"$title" mode=
"title.markup"/>
194 <!-- * Output of Titles from Xref with Endterm needs to be handled -->
195 <!-- * separately from output for Endterm-less Xref -->
196 <xsl:template match=
"refsect1/title
197 |refentry/refsection/title
198 |refsynopsisdiv/title"
200 <xsl:call-template name=
"string.upper">
201 <xsl:with-param name=
"string">
202 <xsl:apply-templates/>
207 <!-- * Use uppercase to render titles of all instances of Refsynopsisdiv, -->
208 <!-- * including in cross-references -->
209 <xsl:template match=
"refsynopsisdiv" mode=
"title.markup">
210 <xsl:param name=
"allow-anchors" select=
"0"/>
211 <xsl:call-template name=
"string.upper">
212 <xsl:with-param name=
"string">
214 <xsl:when test=
"info/title
215 |refsynopsisdivinfo/title
219 |refsynopsisdivinfo/title
220 |title)[1]" mode=
"title.markup">
221 <xsl:with-param name=
"allow-anchors" select=
"$allow-anchors"/>
222 </xsl:apply-templates>
225 <xsl:call-template name=
"gentext">
226 <xsl:with-param name=
"key" select=
"'RefSynopsisDiv'"/>
234 <!-- * Use uppercase to render titles of all instances of Refnamediv, -->
235 <!-- * including in cross-references -->
236 <xsl:template match=
"refnamediv" mode=
"title.markup">
237 <xsl:call-template name=
"string.upper">
238 <xsl:with-param name=
"string">
239 <xsl:call-template name=
"gentext">
240 <xsl:with-param name=
"key" select=
"'RefName'"/>
246 <xsl:template match=
"refnamediv" mode=
"xref-to">
247 <xsl:apply-templates select=
"." mode=
"title.markup"/>
250 <!-- ==================================================================== -->
252 <!-- * suppress any title we don't otherwise process elsewhere -->
254 <xsl:template match=
"title"/>