]> granicus.if.org Git - apache/blob - docs/manual/style/xsl/synopsis.xsl
f7b74f0ba1a8cd811023d6fac3027b57dfcfaa77
[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 ]>
23 <xsl:stylesheet version="1.0"
24               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
25                   xmlns="http://www.w3.org/1999/xhtml">
26
27 <!-- ==================================================================== -->
28 <!-- <modulesynopsis>                                                     -->
29 <!-- Process an entire document into an HTML page                         -->
30 <!-- ==================================================================== -->
31 <xsl:template match="modulesynopsis">
32 <html xml:lang="{$doclang}" lang="{$doclang}">
33     <xsl:call-template name="head" />&lf;
34
35     <body>&lf;
36         <xsl:call-template name="top" />&lf;
37
38         <div id="page-content">&lf;
39             <div id="preamble">
40                 <h1>
41                     <xsl:choose>
42                     <xsl:when test="status='Core'">
43                         <xsl:value-of select="$message
44                                               [@id='apachecore']" />
45                     </xsl:when>
46                     <xsl:when test="name='mpm_common'">
47                         <xsl:value-of select="$message
48                                               [@id='apachempmcommon']" />
49                     </xsl:when>
50                     <xsl:when test="status='MPM'">
51                         <xsl:value-of select="$message
52                                               [@id='apachempm']" />
53                         <xsl:text> </xsl:text>
54                         <xsl:call-template name="module-translatename">
55                             <xsl:with-param name="name" select="name" />
56                         </xsl:call-template>
57                     </xsl:when>
58                     <xsl:otherwise>
59                         <xsl:value-of select="$message
60                                               [@id='apachemodule']" />
61                         <xsl:text> </xsl:text>
62                         <xsl:value-of select="name" />
63                     </xsl:otherwise>
64                     </xsl:choose>
65                 </h1>&lf;
66
67                 <xsl:call-template name="langavail" />&lf;
68
69                 <!-- Description and module-headers -->
70                 <table class="module">
71                 <tr>
72                     <th>
73                         <a href="module-dict.html#Description">
74                             <xsl:value-of select="$message
75                                                   [@id='description']" />
76                             <xsl:text>:</xsl:text>
77                         </a>
78                     </th>
79                     <td>
80                         <xsl:apply-templates select="description" />
81                     </td>
82                 </tr>&lf;
83                 <tr>
84                     <th>
85                         <a href="module-dict.html#Status">
86                             <xsl:value-of select="$message
87                                                   [@id='status']" />
88                             <xsl:text>:</xsl:text>
89                         </a>
90                     </th>
91                     <td>
92                         <xsl:variable name="status" select="translate(
93                             status, $uppercase, $lowercase)"/>
94                         <xsl:choose>
95                         <xsl:when test="status = 'External' and status/@href">
96                             <a href="{status/@href}">
97                                 <xsl:value-of select="$message[@id=$status]"/>
98                             </a>
99                         </xsl:when>
100                         <xsl:otherwise>
101                             <xsl:value-of
102                                 select="$message[@id=$status]"/>
103                         </xsl:otherwise>
104                         </xsl:choose>
105                     </td>
106                 </tr>
107
108                 <xsl:if test="identifier">&lf;
109                 <tr>
110                     <th>
111                         <a href="module-dict.html#ModuleIdentifier">
112                             <xsl:value-of select="$message
113                                                   [@id='moduleidentifier']" />
114                             <xsl:text>:</xsl:text>
115                         </a>
116                     </th>
117                     <td>
118                         <xsl:value-of select="identifier" />
119                     </td>
120                 </tr>
121                 </xsl:if>
122
123                 <xsl:if test="sourcefile">&lf;
124                 <tr>
125                     <th>
126                         <a href="module-dict.html#SourceFile">
127                             <xsl:value-of select="$message
128                                                   [@id='sourcefile']" />
129                             <xsl:text>:</xsl:text>
130                         </a>
131                     </th>
132                     <td>
133                         <xsl:value-of select="sourcefile" />
134                     </td>
135                 </tr>
136                 </xsl:if>
137
138                 <xsl:if test="compatibility">&lf;
139                 <tr>
140                     <th>
141                         <a href="module-dict.html#Compatibility">
142                             <xsl:value-of select="$message
143                                                   [@id='compatibility']" />
144                             <xsl:text>:</xsl:text>
145                         </a>
146                     </th>
147                     <td>
148                         <xsl:apply-templates select="compatibility" />
149                     </td>
150                 </tr>
151                 </xsl:if>
152                 </table>&lf;
153
154                 <!-- Summary of module features/usage (1 to 3 paragraphs, -->
155                 <!-- optional)                                            -->
156                 <xsl:if test="summary">
157                     <h3>
158                         <xsl:value-of select="$message
159                                               [@id='summary']" />
160                     </h3>&lf;
161
162                     <xsl:apply-templates select="summary" />
163                 </xsl:if>
164             </div>&lf; <!-- /#preamble -->
165
166             <xsl:if test="not($is-chm) or seealso">
167                 <div id="quickview">
168                     <xsl:if test="not($is-chm)">
169                         <h3 class="directives">
170                             <xsl:value-of select="$message
171                                                   [@id='directives']" />
172                         </h3>&lf;
173
174                         <xsl:choose>
175                         <xsl:when test="document($metafile/@reference)
176                                         /modulesynopsis/directivesynopsis">
177                             <ul id="toc">&lf;
178                             <xsl:for-each
179                             select="document($metafile/@reference)
180                                     /modulesynopsis/directivesynopsis">
181                             <xsl:sort select="name" />
182                                 <xsl:variable name="lowername"
183                                     select="translate(name, $uppercase,
184                                                       $lowercase)" />
185
186                                 <xsl:choose>
187                                 <xsl:when test="not(@location)">
188                                     <li>
189                                         <img src="{$path}/images/down.gif"
190                                             alt="" />
191                                         <xsl:text> </xsl:text>
192                                         <a href="#{$lowername}">
193                                             <xsl:if test="@type='section'"
194                                                 >&lt;</xsl:if>
195                                             <xsl:value-of select="name" />
196                                             <xsl:if test="@type='section'"
197                                                 >&gt;</xsl:if>
198                                         </a>
199                                     </li>&lf;
200                                 </xsl:when>
201                                 <xsl:otherwise>
202                                     <xsl:variable name="lowerlocation"
203                                         select="translate(@location, $uppercase,
204                                                           $lowercase)" />
205                                     <li>
206                                         <img src="{$path}/images/right.gif"
207                                             alt="" />
208                                         <xsl:text> </xsl:text>
209                                         <a href="{$lowerlocation}.html#{
210                                                                    $lowername}">
211                                             <xsl:if test="@type='section'"
212                                                 >&lt;</xsl:if>
213                                             <xsl:value-of select="name" />
214                                             <xsl:if test="@type='section'"
215                                                 >&gt;</xsl:if>
216                                         </a>
217                                     </li>&lf;
218                                 </xsl:otherwise>
219                                 </xsl:choose>
220                             </xsl:for-each>
221                             </ul>&lf; <!-- /toc -->
222                         </xsl:when> <!-- have directives -->
223
224                         <xsl:otherwise>
225                             <p>
226                                 <xsl:value-of select="$message
227                                                       [@id='nodirectives']" />
228                             </p>&lf;
229                         </xsl:otherwise>
230                         </xsl:choose>
231
232                         <xsl:if test="section">
233                             <h3>
234                                 <xsl:value-of select="$message
235                                                       [@id='topics']" />
236                             </h3>&lf;
237
238                             <ul id="topics">&lf;
239                             <xsl:apply-templates
240                                 select="section" mode="index" />
241                             </ul>
242                         </xsl:if>
243                     </xsl:if> <!-- /!is-chm -->
244
245                     <xsl:if test="seealso">
246                             <h3>
247                             <xsl:value-of select="$message
248                                                   [@id='seealso']" />
249                         </h3>&lf;
250
251                         <ul class="seealso">&lf;
252                         <xsl:for-each select="seealso">
253                             <li>
254                                 <xsl:apply-templates />
255                             </li>&lf;
256                         </xsl:for-each>
257                         </ul>
258                     </xsl:if>
259                 </div> <!-- /#quickview -->
260             </xsl:if>&lf; <!-- have sidebar -->
261
262             <!-- Sections of documentation about the module as a whole -->
263             <xsl:apply-templates select="section" />&lf;
264
265             <xsl:variable name="this" select="directivesynopsis" />
266
267             <!-- Directive documentation -->
268             <xsl:for-each select="document($metafile/@reference)
269                                   /modulesynopsis/directivesynopsis">
270             <xsl:sort select="name" />
271                 <xsl:choose>
272                 <xsl:when test="$this[name=current()/name]">
273                     <xsl:apply-templates select="$this[name=current()/name]" />
274                 </xsl:when>
275                 <xsl:otherwise>
276                     <xsl:apply-templates select=".">
277                         <xsl:with-param name="translated" select="'no'" />
278                     </xsl:apply-templates>
279                 </xsl:otherwise>
280                 </xsl:choose>
281             </xsl:for-each>
282         </div>&lf; <!-- /#page-content -->
283
284         <xsl:call-template name="bottom" />&lf;
285     </body>
286 </html>
287 </xsl:template>
288 <!-- /modulesynopsis -->
289
290
291 <!-- ==================================================================== -->
292 <!-- Directivesynopsis                                                    -->
293 <!-- ==================================================================== -->
294 <xsl:template match="directivesynopsis">
295 <xsl:param name="translated" select="'yes'" />
296
297 <xsl:if test="not(@location)">
298     <xsl:call-template name="toplink" />&lf;
299
300     <div class="directive-section">
301         <xsl:variable name="lowername"
302             select="translate(name, $uppercase, $lowercase)" />
303
304         <!-- Directive heading gets both mixed case and lowercase      -->
305         <!-- anchors, and includes lt/gt only for "section" directives -->
306         <h2>
307             <a id="{name}" name="{name}">
308                 <xsl:if test="@type='section'">&lt;</xsl:if>
309                 <xsl:value-of select="name" />
310                 <xsl:if test="@type='section'">&gt;</xsl:if>
311             </a>
312
313             <xsl:choose>
314             <xsl:when test="$message
315                             [@id='directive']/@replace-space-with">
316                 <xsl:value-of select="$message
317                                       [@id='directive']/@replace-space-with"/>
318             </xsl:when>
319             <xsl:otherwise>
320                 <xsl:text> </xsl:text>
321             </xsl:otherwise>
322             </xsl:choose>
323
324             <a id="{$lowername}" name="{$lowername}">
325                 <xsl:value-of select="$message[@id='directive']" />
326             </a>
327         </h2>&lf;
328
329         <!-- Directive header -->
330         <table class="directive">&lf;
331         <tr>
332             <th>
333                 <a href="directive-dict.html#Description">
334                     <xsl:value-of select="$message
335                                           [@id='description']" />
336                     <xsl:text>:</xsl:text>
337                 </a>
338             </th>
339             <td>
340                 <xsl:apply-templates select="description" />
341             </td>
342         </tr>&lf;
343
344         <tr>
345             <th>
346                 <a href="directive-dict.html#Syntax">
347                     <xsl:value-of select="$message[@id='syntax']" />
348                     <xsl:text>:</xsl:text>
349                 </a>
350             </th>
351             <td>
352                 <code>
353                     <xsl:apply-templates select="syntax" />
354                 </code>
355             </td>
356         </tr>
357
358         <xsl:if test="default">&lf;
359         <tr>
360             <th>
361                 <a href="directive-dict.html#Default">
362                     <xsl:value-of select="$message[@id='default']" />
363                     <xsl:text>:</xsl:text>
364                 </a>
365             </th>
366             <td>
367                 <code>
368                     <xsl:apply-templates select="default" />
369                 </code>
370             </td>
371         </tr>
372         </xsl:if>&lf;
373
374         <tr>
375             <th>
376                 <a href="directive-dict.html#Context">
377                     <xsl:value-of select="$message[@id='context']" />
378                     <xsl:text>:</xsl:text>
379                 </a>
380             </th>
381             <td>
382                 <xsl:apply-templates select="contextlist" />
383             </td>
384         </tr>
385
386         <xsl:if test="override">&lf;
387         <tr>
388             <th>
389                 <a href="directive-dict.html#Override">
390                     <xsl:value-of select="$message[@id='override']"/>
391                     <xsl:text>:</xsl:text>
392                 </a>
393             </th>
394             <td>
395                 <xsl:value-of select="override" />
396             </td>
397         </tr>
398         </xsl:if>&lf;
399
400         <tr>
401             <th>
402                 <a href="directive-dict.html#Status">
403                     <xsl:value-of select="$message[@id='status']" />
404                     <xsl:text>:</xsl:text>
405                 </a>
406             </th>
407             <td>
408                 <xsl:variable name="status" select="translate(
409                     ../status, $uppercase, $lowercase)"/>
410                 <xsl:value-of select="$message[@id=$status]"/>
411             </td>
412         </tr>&lf;
413
414         <tr>
415             <th>
416                 <a href="directive-dict.html#Module">
417                     <xsl:value-of select="$message[@id='module']" />
418                     <xsl:text>:</xsl:text>
419                 </a>
420             </th>
421             <td>
422                 <xsl:choose>
423                 <xsl:when test="modulelist">
424                     <xsl:apply-templates select="modulelist" />
425                 </xsl:when>
426                 <xsl:otherwise>
427                     <xsl:value-of select="../name" />
428                 </xsl:otherwise>
429                 </xsl:choose>
430             </td>
431         </tr>
432
433         <xsl:if test="compatibility">&lf;
434         <tr>
435             <th>
436                 <a href="directive-dict.html#Compatibility">
437                     <xsl:value-of select="$message
438                                           [@id='compatibility']" />
439                     <xsl:text>:</xsl:text>
440                 </a>
441             </th>
442             <td>
443                 <xsl:apply-templates select="compatibility" />
444             </td>
445         </tr>
446         </xsl:if>&lf;
447         </table>
448
449         <xsl:choose>
450         <xsl:when test="$translated = 'yes'">
451             <xsl:apply-templates select="usage" />&lf;
452         </xsl:when>
453         <xsl:otherwise>
454             <p>The documentation of this directive was not translated yet.
455             Please refer to the English version.</p>
456         </xsl:otherwise>
457         </xsl:choose>
458
459         <xsl:if test="seealso">
460             <h3>
461                 <xsl:value-of select="$message[@id='seealso']" />
462             </h3>&lf;
463
464             <ul>&lf;
465             <xsl:for-each select="seealso">
466                 <li>
467                     <xsl:apply-templates />
468                 </li>&lf;
469             </xsl:for-each>
470             </ul>&lf;
471         </xsl:if>
472     </div>&lf; <!-- /.directive-section -->
473 </xsl:if>
474 </xsl:template>
475 <!-- /directivesynopsis -->
476
477
478 <!-- ==================================================================== -->
479 <!-- <contextlist>                                                        -->
480 <!-- ==================================================================== -->
481 <xsl:template match="contextlist">
482 <xsl:apply-templates select="context" />
483 </xsl:template>
484 <!-- /contextlist -->
485
486
487 <!-- ==================================================================== -->
488 <!-- <context>                                                            -->
489 <!-- Each entry is separeted with a comma                                 -->
490 <!-- ==================================================================== -->
491 <xsl:template match="context">
492 <xsl:choose>
493 <xsl:when test="normalize-space(.) = 'server config'">
494     <xsl:value-of select="$message[@id='serverconfig']" />
495 </xsl:when>
496 <xsl:when test="normalize-space(.) = 'virtual host'">
497     <xsl:value-of select="$message[@id='virtualhost']" />
498 </xsl:when>
499 <xsl:when test="normalize-space(.) = 'directory'">
500     <xsl:value-of select="$message[@id='directory']" />
501 </xsl:when>
502 <xsl:when test="normalize-space(.) = '.htaccess'">
503     <xsl:value-of select="$message[@id='htaccess']" />
504 </xsl:when>
505 <xsl:otherwise> <!-- error -->
506     <xsl:message terminate="yes">
507         unknown context: <xsl:value-of select="." />
508     </xsl:message>
509 </xsl:otherwise>
510 </xsl:choose>
511
512 <xsl:if test="position() != last()">
513     <xsl:text>, </xsl:text>
514 </xsl:if>
515 </xsl:template>
516 <!-- /context -->
517
518
519 <!-- ==================================================================== -->
520 <!-- <modulelist>                                                         -->
521 <!-- ==================================================================== -->
522 <xsl:template match="modulelist">
523 <xsl:for-each select="module">
524     <xsl:call-template name="module" />
525     <xsl:if test="position() != last()">
526         <xsl:text>, </xsl:text>
527     </xsl:if>
528 </xsl:for-each>
529 </xsl:template>
530 <!-- /modulelist -->
531
532
533 <!-- ==================================================================== -->
534 <!-- modulesynopsis/compatibility                                         -->
535 <!-- ==================================================================== -->
536 <xsl:template match="modulesynopsis/compatibility">
537 <xsl:apply-templates />
538 </xsl:template>
539
540
541 <!-- ==================================================================== -->
542 <!-- directivesynopsis/compatibility                                      -->
543 <!-- ==================================================================== -->
544 <xsl:template match="directivesynopsis/compatibility">
545 <xsl:apply-templates />
546 </xsl:template>
547
548 </xsl:stylesheet>