]> granicus.if.org Git - apache/blob - docs/manual/style/xsl/synopsis.xsl
Help doc writer to spot places where:
[apache] / docs / manual / style / xsl / synopsis.xsl
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 <!DOCTYPE xsl:stylesheet [
21     <!ENTITY lf SYSTEM "util/lf.xml">
22     <!ENTITY para SYSTEM "util/para.xml">
23 ]>
24 <xsl:stylesheet version="1.0"
25               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
26                   xmlns="http://www.w3.org/1999/xhtml">
27
28 <!-- ==================================================================== -->
29 <!-- <modulesynopsis>                                                     -->
30 <!-- Process an entire document into an HTML page                         -->
31 <!-- ==================================================================== -->
32 <xsl:template match="modulesynopsis">
33 <html xml:lang="{$doclang}" lang="{$doclang}">
34     <xsl:call-template name="head" />&lf;
35
36     <body>&lf;
37         <xsl:call-template name="top" />&lf;
38
39         <div id="page-content">&lf;
40             <xsl:call-template name="retired" />
41
42             <div id="preamble">
43                 <h1>
44                     <xsl:choose>
45                     <xsl:when test="status='Core'">
46                         <xsl:value-of select="$message
47                                               [@id='apachecore']" />
48                     </xsl:when>
49                     <xsl:when test="name='mpm_common'">
50                         <xsl:value-of select="$message
51                                               [@id='apachempmcommon']" />
52                     </xsl:when>
53                     <xsl:when test="status='MPM'">
54                         <xsl:value-of select="$message
55                                               [@id='apachempm']" />
56                         <xsl:text> </xsl:text>
57                         <xsl:call-template name="module-translatename">
58                             <xsl:with-param name="name" select="name" />
59                         </xsl:call-template>
60                     </xsl:when>
61                     <xsl:otherwise>
62                         <xsl:value-of select="$message
63                                               [@id='apachemodule']" />
64                         <xsl:text> </xsl:text>
65                         <xsl:value-of select="name" />
66                     </xsl:otherwise>
67                     </xsl:choose>
68                 </h1>&lf;
69
70                 <xsl:call-template name="langavail" />&lf;
71
72                 <!-- Description and module-headers -->
73                 <table class="module">
74                 <tr>
75                     <th>
76                         <a href="module-dict.html#Description">
77                             <xsl:value-of select="$message
78                                                   [@id='description']" />
79                             <xsl:text>:</xsl:text>
80                         </a>
81                     </th>
82                     <td>
83                         <xsl:apply-templates select="description" />
84                     </td>
85                 </tr>&lf;
86                 <tr>
87                     <th>
88                         <a href="module-dict.html#Status">
89                             <xsl:value-of select="$message
90                                                   [@id='status']" />
91                             <xsl:text>:</xsl:text>
92                         </a>
93                     </th>
94                     <td>
95                         <xsl:variable name="status" select="translate(
96                             status, $uppercase, $lowercase)"/>
97                         <xsl:choose>
98                         <xsl:when test="status = 'External' and status/@href">
99                             <a href="{status/@href}">
100                                 <xsl:value-of select="$message[@id=$status]"/>
101                             </a>
102                         </xsl:when>
103                         <xsl:otherwise>
104                             <xsl:value-of
105                                 select="$message[@id=$status]"/>
106                         </xsl:otherwise>
107                         </xsl:choose>
108                     </td>
109                 </tr>
110
111                 <xsl:if test="identifier">&lf;
112                 <tr>
113                     <th>
114                         <a href="module-dict.html#ModuleIdentifier">
115                             <xsl:value-of select="$message
116                                                   [@id='moduleidentifier']" />
117                             <xsl:text>:</xsl:text>
118                         </a>
119                     </th>
120                     <td>
121                         <xsl:value-of select="identifier" />
122                     </td>
123                 </tr>
124                 </xsl:if>
125
126                 <xsl:if test="sourcefile">&lf;
127                 <tr>
128                     <th>
129                         <a href="module-dict.html#SourceFile">
130                             <xsl:value-of select="$message
131                                                   [@id='sourcefile']" />
132                             <xsl:text>:</xsl:text>
133                         </a>
134                     </th>
135                     <td>
136                         <xsl:value-of select="sourcefile" />
137                     </td>
138                 </tr>
139                 </xsl:if>
140
141                 <xsl:if test="compatibility">&lf;
142                 <tr>
143                     <th>
144                         <a href="module-dict.html#Compatibility">
145                             <xsl:value-of select="$message
146                                                   [@id='compatibility']" />
147                             <xsl:text>:</xsl:text>
148                         </a>
149                     </th>
150                     <td>
151                         <xsl:apply-templates select="compatibility" />
152                     </td>
153                 </tr>
154                 </xsl:if>
155                 </table>&lf;
156
157                 <!-- Summary of module features/usage (1 to 3 paragraphs, -->
158                 <!-- optional)                                            -->
159                 <xsl:if test="summary">
160                     <h3>
161                         <xsl:value-of select="$message
162                                               [@id='summary']" />
163                     </h3>&lf;
164
165                     <xsl:apply-templates select="summary" />
166                 </xsl:if>
167             </div>&lf; <!-- /#preamble -->
168
169             <xsl:if test="not($is-chm) or seealso">
170                 <div id="quickview">
171                     <xsl:if test="not($is-chm)">
172                         <xsl:if test="section">
173                             <h3>
174                                 <xsl:value-of select="$message
175                                                       [@id='topics']" />
176                             </h3>&lf;
177
178                             <ul id="topics">&lf;
179                             <xsl:apply-templates
180                                 select="section" mode="index" />
181                             </ul>
182                         </xsl:if>
183
184                         <h3 class="directives">
185                             <xsl:value-of select="$message
186                                                   [@id='directives']" />
187                         </h3>&lf;
188
189                         <xsl:choose>
190                         <xsl:when test="document($metafile/@reference)
191                                         /modulesynopsis/directivesynopsis">
192                             <ul id="toc">&lf;
193                             <xsl:for-each
194                             select="document($metafile/@reference)
195                                     /modulesynopsis/directivesynopsis">
196                             <xsl:sort select="name" />
197                                 <xsl:variable name="lowername"
198                                     select="concat(translate(name, $uppercase,
199                                                    $lowercase),@idtype)" />
200
201                                 <xsl:choose>
202                                 <xsl:when test="not(@location)">
203                                     <li>
204                                         <img src="{$path}/images/down.gif"
205                                             alt="" />
206                                         <xsl:text> </xsl:text>
207                                         <a href="#{$lowername}">
208                                             <xsl:if test="@type='section'"
209                                                 >&lt;</xsl:if>
210                                             <xsl:value-of select="name" />
211                                             <xsl:if test="@type='section'"
212                                                 >&gt;</xsl:if>
213                                         </a>
214                                     </li>&lf;
215                                 </xsl:when>
216                                 <xsl:otherwise>
217                                     <xsl:variable name="lowerlocation"
218                                         select="translate(@location, $uppercase,
219                                                           $lowercase)" />
220                                     <li>
221                                         <img src="{$path}/images/right.gif"
222                                             alt="" />
223                                         <xsl:text> </xsl:text>
224                                         <a href="{$lowerlocation}.html#{
225                                                                    $lowername}">
226                                             <xsl:if test="@type='section'"
227                                                 >&lt;</xsl:if>
228                                             <xsl:value-of select="name" />
229                                             <xsl:if test="@type='section'"
230                                                 >&gt;</xsl:if>
231                                         </a>
232                                     </li>&lf;
233                                 </xsl:otherwise>
234                                 </xsl:choose>
235                             </xsl:for-each>
236                             </ul>&lf; <!-- /toc -->
237                         </xsl:when> <!-- have directives -->
238
239                         <xsl:otherwise>
240                             <p>
241                                 <xsl:value-of select="$message
242                                                       [@id='nodirectives']" />
243                             </p>&lf;
244                         </xsl:otherwise>
245                         </xsl:choose>
246                     </xsl:if> <!-- /!is-chm -->
247
248                     <h3>
249                        <xsl:value-of select="$message[@id='foundabug']" />
250                     </h3>
251                     <ul class="seealso">
252                         <!-- Bugzilla mpm components are prefixed with
253                             'mpm_', meanwhile the page name in the docs do
254                             not contain it. For example, Bugzilla has
255                             the 'mpm_event' component and the doc has the
256                             'event' page. This creates an inconsistency
257                             in the URL generation, fixed by the following
258                             check. -->
259                         <xsl:variable name="bugzilla_prefix">
260                             <xsl:choose>
261                                 <xsl:when test="name='worker' or name='event'
262                                                 or name='prefork'">
263                                     <xsl:value-of select="string('mpm_')"/>
264                                 </xsl:when>
265                             </xsl:choose>
266                         </xsl:variable>
267                         <li>
268                             <!-- The link below is not dynamic and points only
269                                  to the 2.4 release since it makes sense to keep
270                                  it as reference even for trunk. -->
271                             <a href="https://www.apache.org/dist/httpd/CHANGES_2.4">
272                                 <xsl:value-of
273                                     select="$message[@id='httpdchangelog']" />
274                             </a>
275                         </li>
276                         <li>
277                             <!-- The line below is not splitted in multiple
278                                  lines to avoid rendering a broken URL. -->
279                             <a href="https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&amp;list_id=144532&amp;product=Apache%20httpd-2&amp;query_format=specific&amp;order=changeddate%20DESC%2Cpriority%2Cbug_severity&amp;component={$bugzilla_prefix}{name}">
280                                 <xsl:value-of
281                                     select="$message[@id='httpdknownissues']" />
282                             </a>
283                         </li>
284                         <li>
285                             <!-- The line below is not splitted in multiple
286                                  lines to avoid rendering a broken URL. -->
287                             <a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2&amp;component={$bugzilla_prefix}{name}">
288                                 <xsl:value-of
289                                     select="$message[@id='httpdreportabug']" />
290                             </a>
291                         </li>
292                     </ul>
293                     <!-- The seealso section shows links to related documents
294                          explicitly set in .xml docs or simply the comments. -->
295                     <xsl:if test="seealso or not($is-chm or $is-zip or
296                                                 $metafile/basename = 'index')">
297                         <h3>
298                             <xsl:value-of select="$message
299                                                   [@id='seealso']" />
300                         </h3>&lf;
301
302                         <ul class="seealso">&lf;
303                         <xsl:for-each select="seealso">
304                             <li>
305                                 <xsl:apply-templates />
306                             </li>&lf;
307                         </xsl:for-each>
308                         <xsl:if test="not($is-chm or $is-zip or $metafile/basename = 'index')">
309                             <li><a href="#comments_section"><xsl:value-of
310                                     select="$message[@id='comments']" /></a>
311                             </li>
312                         </xsl:if>
313                         </ul>
314                     </xsl:if>
315                 </div> <!-- /#quickview -->
316             </xsl:if>&lf; <!-- have sidebar -->
317
318             <!-- Sections of documentation about the module as a whole -->
319             <xsl:apply-templates select="section" />&lf;
320
321             <xsl:variable name="this" select="directivesynopsis" />
322
323             <!-- Directive documentation -->
324             <xsl:for-each select="document($metafile/@reference)
325                                   /modulesynopsis/directivesynopsis">
326             <xsl:sort select="name" />
327                 <xsl:choose>
328                 <xsl:when test="$this[name=current()/name]">
329                     <!-- A directive name is allowed to be repeated if its type
330                          is different. There is currently only one allowed type
331                          to set, namely 'section', that represents
332                          directive/containers like <DirectiveName>.
333                          The following check is needed to avoid rendering
334                          multiple times the same content when a directive name
335                          is repeated.
336                      -->
337                     <xsl:choose>
338                         <xsl:when test="@type='section'">
339                             <xsl:apply-templates select="$this[name=current()/name and @type='section']" />
340                         </xsl:when>
341                         <xsl:otherwise>
342                             <xsl:apply-templates select="$this[name=current()/name and not(@type='section')]" />
343                         </xsl:otherwise>
344                     </xsl:choose>
345                 </xsl:when>
346                 <xsl:otherwise>
347                     <xsl:apply-templates select=".">
348                         <xsl:with-param name="translated" select="'no'" />
349                     </xsl:apply-templates>
350                 </xsl:otherwise>
351                 </xsl:choose>
352             </xsl:for-each>
353         </div>&lf; <!-- /#page-content -->
354
355         <xsl:call-template name="bottom" />&lf;
356     </body>
357 </html>
358 </xsl:template>
359 <!-- /modulesynopsis -->
360
361
362 <!-- ==================================================================== -->
363 <!-- Directivesynopsis                                                    -->
364 <!-- ==================================================================== -->
365 <xsl:template match="directivesynopsis">
366 <xsl:param name="translated" select="'yes'" />
367
368 <xsl:if test="not(@location)">
369     <xsl:call-template name="toplink" />&lf;
370
371     <div class="directive-section">
372         <!-- Concatenate the Directive name with its type to allow
373              a directive to be referenced multiple times
374              with different types -->
375         <xsl:variable name="lowername"
376             select="concat(translate(name, $uppercase, $lowercase),@idtype)" />
377         <xsl:variable name="directivename" select="concat(name,@idtype)" />
378         <!-- Directive heading gets both mixed case and lowercase      -->
379         <!-- anchors, and includes lt/gt only for "section" directives -->
380         <h2>
381             <xsl:choose>
382             <xsl:when test="$message
383                             [@id='directive']/@before-name = 'yes'">
384                 <a id="{$lowername}" name="{$lowername}">
385                     <xsl:value-of select="$message[@id='directive']" />
386                 </a>
387
388                 <xsl:choose>
389                 <xsl:when test="$message
390                                 [@id='directive']/@replace-space-with">
391                     <xsl:value-of select="$message
392                                          [@id='directive']/@replace-space-with"/>
393                 </xsl:when>
394                 <xsl:otherwise>
395                     <xsl:text> </xsl:text>
396                 </xsl:otherwise>
397                 </xsl:choose>
398
399                 <a id="{$directivename}" name="{$directivename}">
400                     <xsl:if test="@type='section'">&lt;</xsl:if>
401                     <xsl:value-of select="name" />
402                     <xsl:if test="@type='section'">&gt;</xsl:if>
403                 </a>
404             </xsl:when>
405
406             <xsl:otherwise>
407                 <a id="{$directivename}" name="{$directivename}">
408                     <xsl:if test="@type='section'">&lt;</xsl:if>
409                     <xsl:value-of select="name" />
410                     <xsl:if test="@type='section'">&gt;</xsl:if>
411                 </a>
412
413                 <xsl:choose>
414                 <xsl:when test="$message
415                                 [@id='directive']/@replace-space-with">
416                     <xsl:value-of select="$message
417                                          [@id='directive']/@replace-space-with"/>
418                 </xsl:when>
419                 <xsl:otherwise>
420                     <xsl:text> </xsl:text>
421                 </xsl:otherwise>
422                 </xsl:choose>
423
424                 <a id="{$lowername}" name="{$lowername}">
425                     <xsl:value-of select="$message[@id='directive']" />
426                 </a>
427             </xsl:otherwise>
428             </xsl:choose>
429         <xsl:text> </xsl:text>
430         <a class="permalink" href="#{$lowername}" title="{$message[@id='permalink']}">&para;</a>
431         </h2>&lf;
432
433         <!-- Directive header -->
434         <table class="directive">&lf;
435         <tr>
436             <th>
437                 <a href="directive-dict.html#Description">
438                     <xsl:value-of select="$message
439                                           [@id='description']" />
440                     <xsl:text>:</xsl:text>
441                 </a>
442             </th>
443             <td>
444                 <xsl:apply-templates select="description" />
445             </td>
446         </tr>&lf;
447
448         <tr>
449             <th>
450                 <a href="directive-dict.html#Syntax">
451                     <xsl:value-of select="$message[@id='syntax']" />
452                     <xsl:text>:</xsl:text>
453                 </a>
454             </th>
455             <td>
456                 <code>
457                     <xsl:apply-templates select="syntax" />
458                 </code>
459             </td>
460         </tr>
461
462         <xsl:if test="default">&lf;
463         <tr>
464             <th>
465                 <a href="directive-dict.html#Default">
466                     <xsl:value-of select="$message[@id='default']" />
467                     <xsl:text>:</xsl:text>
468                 </a>
469             </th>
470             <td>
471                 <code>
472                     <xsl:apply-templates select="default" />
473                 </code>
474             </td>
475         </tr>
476         </xsl:if>&lf;
477
478         <tr>
479             <th>
480                 <a href="directive-dict.html#Context">
481                     <xsl:value-of select="$message[@id='context']" />
482                     <xsl:text>:</xsl:text>
483                 </a>
484             </th>
485             <td>
486                 <xsl:apply-templates select="contextlist" />
487             </td>
488         </tr>
489
490         <xsl:if test="override">&lf;
491         <tr>
492             <th>
493                 <a href="directive-dict.html#Override">
494                     <xsl:value-of select="$message[@id='override']"/>
495                     <xsl:text>:</xsl:text>
496                 </a>
497             </th>
498             <td>
499                 <xsl:value-of select="override" />
500             </td>
501         </tr>
502         </xsl:if>&lf;
503
504         <tr>
505             <th>
506                 <a href="directive-dict.html#Status">
507                     <xsl:value-of select="$message[@id='status']" />
508                     <xsl:text>:</xsl:text>
509                 </a>
510             </th>
511             <td>
512                 <xsl:variable name="status" select="translate(
513                     ../status, $uppercase, $lowercase)"/>
514                 <xsl:value-of select="$message[@id=$status]"/>
515             </td>
516         </tr>&lf;
517
518         <tr>
519             <th>
520                 <a href="directive-dict.html#Module">
521                     <xsl:value-of select="$message[@id='module']" />
522                     <xsl:text>:</xsl:text>
523                 </a>
524             </th>
525             <td>
526                 <xsl:choose>
527                 <xsl:when test="modulelist">
528                     <xsl:apply-templates select="modulelist" />
529                 </xsl:when>
530                 <xsl:otherwise>
531                     <xsl:value-of select="../name" />
532                 </xsl:otherwise>
533                 </xsl:choose>
534             </td>
535         </tr>
536
537         <xsl:if test="compatibility">&lf;
538         <tr>
539             <th>
540                 <a href="directive-dict.html#Compatibility">
541                     <xsl:value-of select="$message
542                                           [@id='compatibility']" />
543                     <xsl:text>:</xsl:text>
544                 </a>
545             </th>
546             <td>
547                 <xsl:apply-templates select="compatibility" />
548             </td>
549         </tr>
550         </xsl:if>&lf;
551         </table>
552
553         <xsl:choose>
554         <xsl:when test="$translated = 'yes'">
555             <xsl:apply-templates select="usage" />&lf;
556         </xsl:when>
557         <xsl:otherwise>
558             <p><xsl:value-of select="$message[@id='nottranslated']" /></p>
559         </xsl:otherwise>
560         </xsl:choose>
561
562         <xsl:if test="seealso">
563             <h3>
564                 <xsl:value-of select="$message[@id='seealso']" />
565             </h3>&lf;
566
567             <ul>&lf;
568             <xsl:for-each select="seealso">
569                 <li>
570                     <xsl:apply-templates />
571                 </li>&lf;
572             </xsl:for-each>
573             </ul>&lf;
574         </xsl:if>
575     </div>&lf; <!-- /.directive-section -->
576 </xsl:if>
577 </xsl:template>
578 <!-- /directivesynopsis -->
579
580
581 <!-- ==================================================================== -->
582 <!-- <contextlist>                                                        -->
583 <!-- ==================================================================== -->
584 <xsl:template match="contextlist">
585 <xsl:apply-templates select="context" />
586 </xsl:template>
587 <!-- /contextlist -->
588
589
590 <!-- ==================================================================== -->
591 <!-- <context>                                                            -->
592 <!-- Each entry is separeted with a comma                                 -->
593 <!-- ==================================================================== -->
594 <xsl:template match="context">
595 <xsl:choose>
596 <xsl:when test="normalize-space(.) = 'server config'">
597     <xsl:value-of select="$message[@id='serverconfig']" />
598 </xsl:when>
599 <xsl:when test="normalize-space(.) = 'virtual host'">
600     <xsl:value-of select="$message[@id='virtualhost']" />
601 </xsl:when>
602 <xsl:when test="normalize-space(.) = 'directory'">
603     <xsl:value-of select="$message[@id='directory']" />
604 </xsl:when>
605 <xsl:when test="normalize-space(.) = '.htaccess'">
606     <xsl:value-of select="$message[@id='htaccess']" />
607 </xsl:when>
608 <xsl:when test="normalize-space(.) = 'proxy section'">
609     <xsl:value-of select="$message[@id='proxy']" />
610 </xsl:when>
611 <xsl:otherwise> <!-- error -->
612     <xsl:message terminate="yes">
613         unknown context: <xsl:value-of select="." />
614     </xsl:message>
615 </xsl:otherwise>
616 </xsl:choose>
617
618 <xsl:if test="position() != last()">
619     <xsl:text>, </xsl:text>
620 </xsl:if>
621 </xsl:template>
622 <!-- /context -->
623
624
625 <!-- ==================================================================== -->
626 <!-- <modulelist>                                                         -->
627 <!-- ==================================================================== -->
628 <xsl:template match="modulelist">
629 <xsl:for-each select="module">
630     <xsl:call-template name="module" />
631     <xsl:if test="position() != last()">
632         <xsl:text>, </xsl:text>
633     </xsl:if>
634 </xsl:for-each>
635 </xsl:template>
636 <!-- /modulelist -->
637
638
639 <!-- ==================================================================== -->
640 <!-- modulesynopsis/compatibility                                         -->
641 <!-- ==================================================================== -->
642 <xsl:template match="modulesynopsis/compatibility">
643 <xsl:apply-templates />
644 </xsl:template>
645
646
647 <!-- ==================================================================== -->
648 <!-- directivesynopsis/compatibility                                      -->
649 <!-- ==================================================================== -->
650 <xsl:template match="directivesynopsis/compatibility">
651 <xsl:apply-templates />
652 </xsl:template>
653
654 </xsl:stylesheet>