cvsimport
[fvwm.git] / doc / docbook-xsl / manpages / refentry.xsl
blob36ca12098bedab767c8ebb4abcdb704bddf1c756
1 <?xml version='1.0'?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 version='1.0'>
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">
18 <xsl:choose>
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&#10;</xsl:text>
23 </xsl:when>
24 <xsl:otherwise>
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>&#10;</xsl:text>
30 </xsl:otherwise>
31 </xsl:choose>
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>
38 </xsl:if>
39 <xsl:value-of select="."/>
40 </xsl:for-each>
41 <!-- * The man(7) man pages says: -->
42 <!-- * -->
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: -->
46 <!-- * -->
47 <!-- * .SH NAME chess \- the game of chess -->
48 <!-- * -->
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) -->
54 <!-- * commands. -->
55 <!-- * -->
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)"/>
62 </xsl:if>
63 <xsl:text>&#10;</xsl:text>
64 </xsl:template>
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>"&#10;</xsl:text>
71 <xsl:call-template name="mark.subheading"/>
72 <xsl:apply-templates/>
73 </xsl:template>
75 <xsl:template match="refsect1|refentry/refsection">
76 <xsl:variable name="title">
77 <xsl:apply-templates select="." mode="title.markup"/>
78 </xsl:variable>
79 <xsl:call-template name="mark.subheading"/>
80 <xsl:text>.SH "</xsl:text>
81 <xsl:value-of select="normalize-space($title)"/>
82 <xsl:text>"&#10;</xsl:text>
83 <xsl:call-template name="mark.subheading"/>
84 <xsl:apply-templates/>
85 </xsl:template>
87 <xsl:template match="refsect2|refentry/refsection/refsection">
88 <xsl:call-template name="mark.subheading"/>
89 <xsl:variable name="title">
90 <xsl:apply-templates
91 select="(info/title
92 |refsectioninfo/title
93 |refsect1info/title
94 |title)[1]/node()"/>
96 </xsl:variable>
97 <xsl:text>.SS "</xsl:text>
98 <xsl:value-of select="normalize-space($title)"/>
99 <xsl:text>"&#10;</xsl:text>
100 <xsl:call-template name="mark.subheading"/>
101 <xsl:choose>
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&#10;</xsl:text>
106 <xsl:apply-templates/>
107 <xsl:text>.RE&#10;</xsl:text>
108 </xsl:when>
109 <xsl:otherwise>
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/>
118 </xsl:otherwise>
119 </xsl:choose>
120 </xsl:template>
122 <xsl:template match="refsect3|refentry/refsection/refsection/refsection">
123 <xsl:variable name="title">
124 <xsl:value-of select="(info/title
125 |refsectioninfo/title
126 |refsect1info/title
127 |title)[1]"/>
128 </xsl:variable>
129 <xsl:choose>
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&#10;</xsl:text>
135 <xsl:apply-templates/>
136 <xsl:text>.RE&#10;</xsl:text>
137 </xsl:when>
138 <xsl:otherwise>
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)&#10;</xsl:text>
147 <xsl:call-template name="nested-section-title"/>
148 <xsl:apply-templates/>
149 </xsl:otherwise>
150 </xsl:choose>
151 </xsl:template>
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
161 |refsect1info/title
162 |title)[1]"/>
163 </xsl:variable>
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)&#10;</xsl:text>
169 </xsl:if>
170 </xsl:variable>
171 <xsl:call-template name="nested-section-title"/>
172 <xsl:text>.RS (\n(SNu)&#10;</xsl:text>
173 <xsl:apply-templates/>
174 <xsl:text>.RE&#10;</xsl:text>
175 </xsl:template>
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"
182 mode="title.markup">
183 <xsl:variable name="title" select="(info/title
184 |refsectioninfo/title
185 |refsect1info/title
186 |title)[1]"/>
187 <xsl:call-template name="string.upper">
188 <xsl:with-param name="string">
189 <xsl:apply-templates select="$title" mode="title.markup"/>
190 </xsl:with-param>
191 </xsl:call-template>
192 </xsl:template>
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"
199 mode="endterm">
200 <xsl:call-template name="string.upper">
201 <xsl:with-param name="string">
202 <xsl:apply-templates/>
203 </xsl:with-param>
204 </xsl:call-template>
205 </xsl:template>
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">
213 <xsl:choose>
214 <xsl:when test="info/title
215 |refsynopsisdivinfo/title
216 |title">
217 <xsl:apply-templates
218 select="(info/title
219 |refsynopsisdivinfo/title
220 |title)[1]" mode="title.markup">
221 <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
222 </xsl:apply-templates>
223 </xsl:when>
224 <xsl:otherwise>
225 <xsl:call-template name="gentext">
226 <xsl:with-param name="key" select="'RefSynopsisDiv'"/>
227 </xsl:call-template>
228 </xsl:otherwise>
229 </xsl:choose>
230 </xsl:with-param>
231 </xsl:call-template>
232 </xsl:template>
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'"/>
241 </xsl:call-template>
242 </xsl:with-param>
243 </xsl:call-template>
244 </xsl:template>
246 <xsl:template match="refnamediv" mode="xref-to">
247 <xsl:apply-templates select="." mode="title.markup"/>
248 </xsl:template>
250 <!-- ==================================================================== -->
252 <!-- * suppress any title we don't otherwise process elsewhere -->
254 <xsl:template match="title"/>
256 </xsl:stylesheet>