]> granicus.if.org Git - apache/blob - docs/manual/style/xsl/overrideindex.xsl
Help doc writer to spot places where:
[apache] / docs / manual / style / xsl / overrideindex.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
24 <xsl:stylesheet version="1.0"
25                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
26                 xmlns:exslt="http://exslt.org/common"
27                 xmlns:func="http://exslt.org/functions"
28                 xmlns:httpd="http://httpd.apache.org/xsl/manual"
29                 xmlns:set="http://exslt.org/sets"
30                 xmlns:str="http://exslt.org/strings"
31                 xmlns="http://www.w3.org/1999/xhtml"
32                 exclude-result-prefixes="exslt func httpd set str">
33
34 <!-- ======================================================================= -->
35 <!-- <overrideindex>                                                         -->
36 <!-- Builds the .htaccess overridable directive index                        -->
37 <!-- ======================================================================= -->
38 <xsl:template match="overrideindex">
39 <html xml:lang="{$doclang}" lang="{$doclang}">
40     <xsl:call-template name="head"/>&lf;
41
42     <xsl:variable name="directives"
43                   select="document(
44                             document($allmodules)/modulefilelist/modulefile
45                           )/modulesynopsis[status!='Obsolete']
46                            /directivesynopsis[not(@location)]" />
47
48     <body id="override-index">&lf;
49         <xsl:call-template name="top"/>&lf;&lf;
50
51         <div id="page-content">
52             <xsl:call-template name="retired" />
53
54             <div id="preamble">
55                 <h1>
56                     <xsl:value-of select="title" />
57                 </h1>&lf;
58
59                 <xsl:call-template name="langavail" />&lf;
60
61                 <xsl:apply-templates select="summary" />
62             </div>&lf; <!-- /#preamble -->
63
64             <!-- Quickview Sidebar -->
65             <xsl:if test="not($is-chm) or seealso">
66                 <div id="quickview">
67                     <xsl:if test="not($is-chm)">
68                         <xsl:if test="overridesummary">
69                             <h3>
70                                 <xsl:value-of select="$message[@id='topics']" />
71                             </h3>&lf;
72
73                             <ul id="topics">&lf;
74                             <xsl:apply-templates select="overridesummary"
75                                                  mode="index" />
76                             </ul>
77                         </xsl:if>
78                     </xsl:if> <!-- /!is-chm -->
79
80                     <!-- The seealso section shows links to related documents
81                          explicitly set in .xml docs or simply the comments. -->
82                     <xsl:if test="seealso or not($is-chm or $is-zip)">
83                         <h3>
84                             <xsl:value-of select="$message[@id='seealso']" />
85                         </h3>&lf;
86
87                         <ul class="seealso">&lf;
88                         <xsl:for-each select="seealso">
89                             <li>
90                                 <xsl:apply-templates />
91                             </li>&lf;
92                         </xsl:for-each>
93                         <xsl:if test="not($is-chm or $is-zip or $metafile/basename = 'index')">
94                             <li><a href="#comments_section"><xsl:value-of
95                                     select="$message[@id='comments']" /></a>
96                             </li>
97                         </xsl:if>
98                         </ul>
99                     </xsl:if>
100                 </div> <!-- /#quickview -->
101             </xsl:if>&lf; <!-- have sidebar -->
102
103             <div id="override-list">
104                 <xsl:variable name="root" select="." />
105
106                 <xsl:for-each select="httpd:override-classes($directives)">
107                     <xsl:sort select="." />
108
109                     <xsl:call-template name="override-section">
110                         <xsl:with-param name="name" select="." />
111                         <xsl:with-param name="directives" select="$directives" />
112                         <xsl:with-param name="root" select="$root" />
113                     </xsl:call-template>
114
115                 </xsl:for-each>
116             </div> <!-- /#override-list -->
117         </div> <!-- /#page-content -->
118
119         <xsl:call-template name="bottom" />&lf;
120     </body>
121 </html>
122 </xsl:template>
123 <!-- /overrideindex -->
124
125 <!-- ======================================================================= -->
126 <!-- <overridesummary>                                                       -->
127 <!-- Pass-through template for the overridesummary contents.                 -->
128 <!-- ======================================================================= -->
129 <xsl:template match="overridesummary">
130     <xsl:apply-templates />
131 </xsl:template>
132
133 <!-- Generates an overridesummary index, used in the quickview. -->
134 <xsl:template match="overridesummary" mode="index">
135 <xsl:if test="@class">
136     <li>
137         <img src="{$path}/images/down.gif" alt="" />
138         <xsl:text> </xsl:text>
139         <a href="#override-{translate(@class, $uppercase, $lowercase)}">
140             <xsl:apply-templates select="@class" mode="print" />
141         </a>
142     </li>&lf;
143 </xsl:if>
144 </xsl:template>
145
146 <!--
147     Generates a section for an Override class, including the section header,
148     the class description, and the table of directives belonging to that class.
149 -->
150 <xsl:template name="override-section">
151     <xsl:param name="name" />       <!-- the name of the Override class -->
152     <xsl:param name="directives" /> <!-- the directive nodes -->
153     <xsl:param name="root" />       <!-- the root of the overrideindex element -->
154
155     <!-- The "up" arrow link. -->
156     <div class="top">
157         <a href="#page-header">
158             <img alt="top" src="{$path}/images/up.gif" />
159         </a>
160     </div>
161
162     <div class="section">
163         <!-- Section header -->
164         <h2>
165             <a name="override-{translate($name, $uppercase, $lowercase)}">
166                 <xsl:value-of select="$name" />
167             </a>
168         </h2>
169
170         <!--
171             Search the input document for the overridesummary element
172             corresponding to this Override class, and put its description into
173             the document here. If there isn't one, use the fallback element
174             (which should alert users/committers to a problem).
175         -->
176         <xsl:apply-templates select="($root//overridesummary[@class=$name]
177                                       | $root//overridesummary[@fallback])[1]" />
178
179         <!-- Directive table -->
180         <table class="qref">
181         <xsl:for-each select="$directives[contains(override, $name)]">
182             <xsl:sort select="name" />
183
184             <!--
185                 Partially duplicated from quickreference.xsl. Generate a row
186                 containing the directive name, its description, and its parent
187                 module. Zebra-stripe every second row.
188             -->
189             <tr>
190                 <xsl:if test="position() mod 2 = 0">
191                     <xsl:attribute name="class">odd</xsl:attribute>
192                 </xsl:if>
193
194                 <td>
195                 <a href="{../name}.html#{translate(name, $uppercase, $lowercase)}">
196                     <xsl:if test="@type = 'section'">&lt;</xsl:if>
197                     <xsl:value-of select="name" />
198                     <xsl:if test="@type = 'section'">&gt;</xsl:if>
199                 </a>
200                 </td>
201
202                 <td class="module">
203                 <a href="{../name}.html">
204                     <xsl:value-of select="../name" />
205                 </a>
206                 </td>
207             </tr>&lf;
208
209             <tr>
210                 <xsl:if test="position() mod 2 = 0">
211                     <xsl:attribute name="class">odd</xsl:attribute>
212                 </xsl:if>
213
214                 <td class="descr" colspan="2">
215                     <xsl:choose>
216                     <xsl:when test="string-length(normalize-space(description)) > 0">
217                         <xsl:apply-templates select="description" />
218                     </xsl:when>
219                     <xsl:otherwise>
220                         <xsl:text>-</xsl:text>
221                     </xsl:otherwise>
222                     </xsl:choose>
223                 </td>
224             </tr>&lf;
225         </xsl:for-each>
226         </table>
227     </div>
228 </xsl:template>
229 <!-- /override-section -->
230
231 <!--
232     Returns the set of distinct Override classes reported by the passed set of
233     directives.
234 -->
235 <func:function name="httpd:override-classes">
236     <xsl:param name="directives" />
237
238     <xsl:variable name="overrideValues">
239         <xsl:for-each select="$directives/override">
240             <xsl:for-each select="str:split(., ',')">
241                 <value><xsl:value-of select="normalize-space(.)" /></value>
242             </xsl:for-each>
243         </xsl:for-each>
244     </xsl:variable>
245
246     <func:result select="set:distinct(exslt:node-set($overrideValues)/*)" />
247 </func:function>
248
249 </xsl:stylesheet>