~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to docs/manual/style/xsl/nroff.xsl

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0"?>
 
2
 
 
3
<!--
 
4
 Licensed to the Apache Software Foundation (ASF) under one or more
 
5
 contributor license agreements.  See the NOTICE file distributed with
 
6
 this work for additional information regarding copyright ownership.
 
7
 The ASF licenses this file to You under the Apache License, Version 2.0
 
8
 (the "License"); you may not use this file except in compliance with
 
9
 the License.  You may obtain a copy of the License at
 
10
 
 
11
     http://www.apache.org/licenses/LICENSE-2.0
 
12
 
 
13
 Unless required by applicable law or agreed to in writing, software
 
14
 distributed under the License is distributed on an "AS IS" BASIS,
 
15
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
16
 See the License for the specific language governing permissions and
 
17
 limitations under the License.
 
18
-->
 
19
 
 
20
<!--
 
21
 * This software is based on initial work of Joe Orton <jorton redhat.com>
 
22
 * (contributed to the ASF) which is based on the db2man stylesheets developed
 
23
 * by Martijn van Beers. db2man is now part of docbook-xsl, which is
 
24
 * licensed under the following terms:
 
25
 *
 
26
 * Copyright
 
27
 * =========
 
28
 *
 
29
 * Copyright (C) 1999, 2000, 2001, 2002 Norman Walsh
 
30
 *
 
31
 * Permission is hereby granted, free of charge, to any person
 
32
 * obtaining a copy of this software and associated documentation
 
33
 * files (the ``Software''), to deal in the Software without
 
34
 * restriction, including without limitation the rights to use,
 
35
 * copy, modify, merge, publish, distribute, sublicense, and/or
 
36
 * sell copies of the Software, and to permit persons to whom the
 
37
 * Software is furnished to do so, subject to the following
 
38
 * conditions:
 
39
 *
 
40
 * The above copyright notice and this permission notice shall be
 
41
 * included in all copies or substantial portions of the Software.
 
42
 *
 
43
 * Except as contained in this notice, the names of individuals
 
44
 * credited with contribution to this software shall not be used in
 
45
 * advertising or otherwise to promote the sale, use or other
 
46
 * dealings in this Software without prior written authorization
 
47
 * from the individuals in question.
 
48
 *
 
49
 * Any stylesheet derived from this Software that is publically
 
50
 * distributed will be identified with a different name and the
 
51
 * version strings in any derived Software will be changed so that
 
52
 * no possibility of confusion between the derived package and this
 
53
 * Software will exist.
 
54
 *
 
55
 * Warranty
 
56
 * ========
 
57
 *
 
58
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 
59
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 
60
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 
61
 * NONINFRINGEMENT.  IN NO EVENT SHALL NORMAN WALSH OR ANY OTHER
 
62
 * CONTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 
63
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
64
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 
65
 * OTHER DEALINGS IN THE SOFTWARE. 
 
66
 */ -->
 
67
 
 
68
<!DOCTYPE xsl:stylesheet [
 
69
    <!ENTITY lf SYSTEM "../xsl/util/lf.xml">
 
70
]>
 
71
<xsl:stylesheet version="1.0"
 
72
              xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
73
 
 
74
<!--                                                                      -->
 
75
<!-- params injected from elsewhere                                       -->
 
76
<!--                                                                      -->
 
77
<xsl:param name="section" select="'1'" />
 
78
<xsl:param name="date" />
 
79
 
 
80
<!-- Constants used for case translation -->
 
81
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
 
82
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
 
83
 
 
84
<!-- ==================================================================== -->
 
85
<!-- <manualpage>                                                         -->
 
86
<!-- Process an entire document into an nroff formatted man page          -->
 
87
<!-- ==================================================================== -->
 
88
<xsl:template match="manualpage">
 
89
<!-- start at the beginning ;-) -->
 
90
<xsl:text>.\" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>&lf;
 
91
<xsl:text>.\" DO NOT EDIT! Generated from XML source.</xsl:text>&lf;
 
92
<xsl:text>.\" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</xsl:text>&lf;
 
93
<xsl:text>.de Sh \" Subsection</xsl:text>&lf;
 
94
<xsl:text>.br</xsl:text>&lf;
 
95
<xsl:text>.if t .Sp</xsl:text>&lf;
 
96
<xsl:text>.ne 5</xsl:text>&lf;
 
97
<xsl:text>.PP</xsl:text>&lf;
 
98
<xsl:text>\fB\\$1\fR</xsl:text>&lf;
 
99
<xsl:text>.PP</xsl:text>&lf;
 
100
<xsl:text>..</xsl:text>&lf;
 
101
<xsl:text>.de Sp \" Vertical space (when we can't use .PP)</xsl:text>&lf;
 
102
<xsl:text>.if t .sp .5v</xsl:text>&lf;
 
103
<xsl:text>.if n .sp</xsl:text>&lf;
 
104
<xsl:text>..</xsl:text>&lf;
 
105
<xsl:text>.de Ip \" List item</xsl:text>&lf;
 
106
<xsl:text>.br</xsl:text>&lf;
 
107
<xsl:text>.ie \\n(.$>=3 .ne \\$3</xsl:text>&lf;
 
108
<xsl:text>.el .ne 3</xsl:text>&lf;
 
109
<xsl:text>.IP "\\$1" \\$2</xsl:text>&lf;
 
110
<xsl:text>..</xsl:text>&lf;
 
111
 
 
112
<!-- reftitle -->
 
113
<xsl:text>.TH "</xsl:text>
 
114
<!-- standard man page width is 64 chars; 6 chars needed for the two
 
115
    (x) volume numbers, and 2 spaces, leaves 56 -->
 
116
<xsl:value-of select="substring(translate(substring-before(
 
117
    normalize-space(title), ' - '), $lowercase, $uppercase), 1, (56 -
 
118
    string-length(substring-before(normalize-space(title), ' - '))) div 2)" />
 
119
<xsl:text>" </xsl:text>
 
120
 
 
121
<!-- section -->
 
122
<xsl:value-of select="$section" />
 
123
<xsl:text> "</xsl:text>
 
124
 
 
125
<!-- date; perhaps injected via ant later. -->
 
126
<xsl:value-of select="$date" />
 
127
<xsl:text>" "</xsl:text>
 
128
 
 
129
<!-- productname -->
 
130
<xsl:value-of select="'Apache HTTP Server'" />
 
131
<xsl:text>" "</xsl:text>
 
132
 
 
133
<!-- title -->
 
134
<xsl:value-of select="substring-before(normalize-space(title), ' - ')" />
 
135
<xsl:text>"</xsl:text>&lf;
 
136
 
 
137
<!-- reorder the paragraphs a bit -->
 
138
<xsl:apply-templates select="title" />&lf;
 
139
<xsl:apply-templates select="section[@id='synopsis']" />&lf;
 
140
<xsl:apply-templates select="summary" />&lf;
 
141
<xsl:apply-templates select="section[@id!='synopsis']" />&lf;
 
142
</xsl:template>
 
143
<!-- /manualpage -->
 
144
 
 
145
 
 
146
<!-- ==================================================================== -->
 
147
<!-- <manualpage><title>                                                  -->
 
148
<!-- Process heading                                                      -->
 
149
<!-- ==================================================================== -->
 
150
<xsl:template match="manualpage/title">
 
151
&lf;
 
152
<xsl:text>.SH NAME</xsl:text>&lf;
 
153
<xsl:variable name="text">
 
154
    <xsl:call-template name="filter.escape">
 
155
        <xsl:with-param name="text" select="normalize-space(.)" />
 
156
    </xsl:call-template>
 
157
</xsl:variable>
 
158
<xsl:value-of select="substring-before($text, ' - ')" />
 
159
<xsl:text> \- </xsl:text>
 
160
<xsl:value-of select="substring-after($text, ' - ')" />
 
161
</xsl:template>
 
162
<!-- /manualpage/title -->
 
163
 
 
164
 
 
165
<!-- ==================================================================== -->
 
166
<!-- <p>                                                                  -->
 
167
<!-- Process paragraph                                                    -->
 
168
<!-- ==================================================================== -->
 
169
<xsl:template match="p">
 
170
&lf;
 
171
<xsl:text>.PP</xsl:text>&lf;
 
172
 
 
173
<xsl:for-each select="node()">
 
174
    <xsl:choose>
 
175
    <xsl:when test="self::text()">
 
176
            <xsl:if test="starts-with(translate(., '&#10;', ' '), ' ') and
 
177
                              preceding-sibling::node()[name(.) != '']">
 
178
                <xsl:text> </xsl:text>
 
179
            </xsl:if>
 
180
        <xsl:variable name="content">
 
181
                <xsl:apply-templates select="." />
 
182
            </xsl:variable>
 
183
            <xsl:value-of select="normalize-space($content)"/>
 
184
            <xsl:if test="translate(substring(., string-length(.), 1), '&#10;',
 
185
                      ' ') = ' ' and following-sibling::node()[name(.) != '']">
 
186
                <xsl:text> </xsl:text>
 
187
            </xsl:if>
 
188
    </xsl:when>
 
189
    <xsl:otherwise>
 
190
        <xsl:variable name="content">
 
191
            <xsl:apply-templates select="." />
 
192
        </xsl:variable>
 
193
        <xsl:value-of select="normalize-space($content)"/>
 
194
    </xsl:otherwise>
 
195
    </xsl:choose>
 
196
</xsl:for-each>&lf;
 
197
</xsl:template>
 
198
<!-- /p -->
 
199
 
 
200
 
 
201
<!-- ==================================================================== -->
 
202
<!-- <section>                                                            -->
 
203
<!-- process main section                                                 -->
 
204
<!-- ==================================================================== -->
 
205
<xsl:template match="section">
 
206
&lf;
 
207
<xsl:text>.SH "</xsl:text>
 
208
    <xsl:call-template name="filter.escape">
 
209
        <xsl:with-param name="text"
 
210
            select="normalize-space(translate(title, $lowercase, $uppercase))"/>
 
211
    </xsl:call-template>
 
212
<xsl:text>"</xsl:text>&lf;
 
213
<xsl:apply-templates />
 
214
</xsl:template>
 
215
<xsl:template match="section/title" />
 
216
<!-- /section -->
 
217
 
 
218
 
 
219
<!-- ==================================================================== -->
 
220
<!-- <section><section>                                                   -->
 
221
<!-- process subsection                                                   -->
 
222
<!-- ==================================================================== -->
 
223
<xsl:template match="section/section">
 
224
&lf;
 
225
<xsl:text>.SS "</xsl:text>
 
226
    <xsl:call-template name="filter.escape">
 
227
        <xsl:with-param name="text" select="normalize-space(title)"/>
 
228
    </xsl:call-template>
 
229
<xsl:text>"</xsl:text>&lf;
 
230
<xsl:apply-templates />
 
231
</xsl:template>
 
232
<!-- /section/section -->
 
233
 
 
234
 
 
235
<!-- ==================================================================== -->
 
236
<!-- <summary>                                                            -->
 
237
<!-- process summary section                                              -->
 
238
<!-- ==================================================================== -->
 
239
<xsl:template match="summary">
 
240
&lf;
 
241
<xsl:text>.SH "</xsl:text>
 
242
    <xsl:call-template name="filter.escape">
 
243
        <xsl:with-param name="text" select="normalize-space(translate($message
 
244
                          [@id='summary'], $lowercase, $uppercase))"/>
 
245
    </xsl:call-template>
 
246
<xsl:text>"</xsl:text>&lf;
 
247
<xsl:apply-templates />
 
248
</xsl:template>
 
249
<!-- /summary -->
 
250
 
 
251
 
 
252
<!-- ==================================================================== -->
 
253
<!-- <var>, <em>                                                          -->
 
254
<!-- show it somewhat special (italic)                                    -->
 
255
<!-- ==================================================================== -->
 
256
<xsl:template match="var|em">
 
257
<xsl:text>\fI</xsl:text>
 
258
    <xsl:apply-templates />
 
259
<xsl:text>\fR</xsl:text>
 
260
</xsl:template>
 
261
 
 
262
 
 
263
<!-- ==================================================================== -->
 
264
<!-- <strong>                                                             -->
 
265
<!-- show it somewhat special (bold)                                      -->
 
266
<!-- ==================================================================== -->
 
267
<xsl:template match="strong">
 
268
<xsl:text>\fB</xsl:text>
 
269
    <xsl:apply-templates />
 
270
<xsl:text>\fR</xsl:text>
 
271
</xsl:template>
 
272
 
 
273
 
 
274
<!-- ==================================================================== -->
 
275
<!-- <directive>                                                          -->
 
276
<!-- ==================================================================== -->
 
277
<xsl:template match="directive">
 
278
<xsl:if test="@type = 'section'">&lt;</xsl:if>
 
279
<xsl:apply-templates />
 
280
<xsl:if test="@type = 'section'">&gt;</xsl:if>
 
281
</xsl:template>
 
282
 
 
283
 
 
284
<!-- ==================================================================== -->
 
285
<!-- <dl>                                                                 -->
 
286
<!-- ==================================================================== -->
 
287
<xsl:template match="dl">
 
288
&lf;
 
289
<xsl:apply-templates />&lf;
 
290
</xsl:template>
 
291
 
 
292
 
 
293
<!-- ==================================================================== -->
 
294
<!-- <dt>                                                                 -->
 
295
<!-- ==================================================================== -->
 
296
<xsl:template match="dt">
 
297
&lf;
 
298
<xsl:text>.TP</xsl:text>&lf;
 
299
 
 
300
<xsl:variable name="dt-content">
 
301
    <xsl:apply-templates />
 
302
</xsl:variable>
 
303
<xsl:value-of select="normalize-space($dt-content)" />&lf;
 
304
 
 
305
<xsl:variable name="dd-content">
 
306
    <xsl:apply-templates
 
307
        select="following-sibling::dd[position() = 1]/node()" />
 
308
</xsl:variable>
 
309
<xsl:value-of select="normalize-space($dd-content)" />
 
310
</xsl:template>
 
311
<!-- /dt -->
 
312
 
 
313
 
 
314
<!-- ==================================================================== -->
 
315
<!-- <example>                                                            -->
 
316
<!-- ==================================================================== -->
 
317
<xsl:template match="example[ancestor::dd]">
 
318
  <xsl:apply-templates/>
 
319
</xsl:template>
 
320
 
 
321
<xsl:template match="example[not(ancestor::dd)]">
 
322
&lf;
 
323
<xsl:text>.nf</xsl:text>&lf;
 
324
<xsl:apply-templates />&lf;
 
325
<xsl:text>.fi</xsl:text>&lf;
 
326
</xsl:template>
 
327
<!-- /example -->
 
328
 
 
329
 
 
330
<!-- ==================================================================== -->
 
331
<!-- simple table support ... (exactly 2 columns)                         -->
 
332
<!-- ==================================================================== -->
 
333
<xsl:template match="table/tr">
 
334
<xsl:if test="count(./*) &gt; 2">
 
335
    <xsl:message terminate="yes">
 
336
FATAL: only tables with two (2) columns are supported.
 
337
    </xsl:message>
 
338
</xsl:if>
 
339
 
 
340
&lf;
 
341
<xsl:text>.Ip "\(bu \s-1</xsl:text>
 
342
<xsl:variable name="first-content">
 
343
   <xsl:apply-templates select="./*[1]/node()" />
 
344
</xsl:variable>
 
345
<xsl:value-of select="normalize-space($first-content)" />
 
346
 
 
347
<xsl:text>\s0 \- </xsl:text>
 
348
<xsl:variable name="second-content">
 
349
   <xsl:apply-templates select="./*[2]/node()" />
 
350
</xsl:variable>
 
351
<xsl:value-of select="normalize-space($second-content)" />&lf;
 
352
</xsl:template>
 
353
<!-- /table/tr -->
 
354
 
 
355
 
 
356
<!-- ==================================================================== -->
 
357
<!-- text filter                                                          -->
 
358
<!-- ==================================================================== -->
 
359
<xsl:template match="text()">
 
360
<xsl:choose>
 
361
<xsl:when test="normalize-space(.) != ''">
 
362
<xsl:call-template name="filter.escape">
 
363
    <xsl:with-param name="text" select="." />
 
364
</xsl:call-template>
 
365
</xsl:when>
 
366
<xsl:otherwise>
 
367
    <xsl:text> </xsl:text>
 
368
</xsl:otherwise>
 
369
</xsl:choose>
 
370
</xsl:template>
 
371
 
 
372
 
 
373
<!-- ==================================================================== -->
 
374
<!-- pass through content                                                 -->
 
375
<!-- ==================================================================== -->
 
376
<xsl:template match="a|code|module|table|program">
 
377
<xsl:apply-templates />
 
378
</xsl:template>
 
379
 
 
380
 
 
381
<!-- ==================================================================== -->
 
382
<!-- remove some stuff from the output                                    -->
 
383
<!-- ==================================================================== -->
 
384
<xsl:template match="parentdocument|seealso|dd|td|example/br" />
 
385
 
 
386
 
 
387
<!-- ==================================================================== -->
 
388
<!-- the rest will be rejected                                            -->
 
389
<!-- ==================================================================== -->
 
390
<xsl:template match="*">
 
391
<xsl:message terminate="yes">
 
392
FATAL: the behaviour of the &lt;<xsl:value-of select="local-name()" />&gt;
 
393
element was not tested. You need to modify
 
394
the XSLT stylesheet in order to get it work.
 
395
</xsl:message>
 
396
</xsl:template>
 
397
 
 
398
 
 
399
<!-- ==================================================================== -->
 
400
<!-- filter.escape                                                        -->
 
401
<!-- escape special characters                                            -->
 
402
<!-- ==================================================================== -->
 
403
<xsl:template name="filter.escape">
 
404
<xsl:param name="text" />
 
405
 
 
406
<xsl:choose>
 
407
<xsl:when test="contains($text, '\')">
 
408
    <xsl:call-template name="filter.escape.period">
 
409
        <xsl:with-param name="text" select="substring-before($text, '\')" />
 
410
    </xsl:call-template>
 
411
    <xsl:text>\\</xsl:text>
 
412
    <xsl:call-template name="filter.escape">
 
413
        <xsl:with-param name="text" select="substring-after($text, '\\')" />
 
414
    </xsl:call-template>
 
415
</xsl:when>
 
416
<xsl:otherwise>
 
417
    <xsl:call-template name="filter.escape.period">
 
418
        <xsl:with-param name="text" select="$text" />
 
419
    </xsl:call-template>
 
420
</xsl:otherwise>
 
421
</xsl:choose>
 
422
</xsl:template>
 
423
<!-- /filter.escape -->
 
424
 
 
425
 
 
426
<!-- ==================================================================== -->
 
427
<!-- filter.period                                                        -->
 
428
<!-- accompanying template to filter.escape                               -->
 
429
<!-- ==================================================================== -->
 
430
<xsl:template name="filter.escape.period">
 
431
<xsl:param name="text" />
 
432
 
 
433
<xsl:choose>
 
434
<xsl:when test="contains($text, '.')"><!-- period replaced by \&. -->
 
435
    <xsl:value-of select="substring-before($text, '.')" />
 
436
    <xsl:text>\&amp;.</xsl:text>
 
437
    <xsl:call-template name="filter.escape.period">
 
438
        <xsl:with-param name="text" select="substring-after($text, '.')" />
 
439
    </xsl:call-template>
 
440
</xsl:when>
 
441
<xsl:otherwise>
 
442
    <xsl:value-of select="$text" />
 
443
</xsl:otherwise>
 
444
</xsl:choose>
 
445
</xsl:template>
 
446
<!-- /filter.escape.period -->
 
447
 
 
448
</xsl:stylesheet>