]> granicus.if.org Git - apache/blob - docs/manual/style/xsl/hhc.xsl
ignore external references in the sitemap
[apache] / docs / manual / style / xsl / hhc.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 "../xsl/util/lf.xml">
22     <!ENTITY tab SYSTEM "../xsl/util/tab.xml">
23
24     <!ENTITY ul.start SYSTEM "../xsl/util/ul-start.xml">
25     <!ENTITY ul.end SYSTEM   "../xsl/util/ul-end.xml"  >
26     <!ENTITY li.start SYSTEM "../xsl/util/li-start.xml">
27     <!ENTITY li.end SYSTEM   "../xsl/util/li-end.xml"  >
28 ]>
29 <xsl:stylesheet version="1.0"
30               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
31                   xmlns="">
32
33 <!--                                                                      -->
34 <!-- WARNING! Do not touch anything, especially the whitespaces [1]       -->
35 <!-- unless you know, what you're doing. The HTML help compiler parses    -->
36 <!-- the TOC file not really as html instead of line by line and takes    -->
37 <!-- care of whitespace indentations etc.                                 -->
38 <!--                                                                      -->
39 <!--   [1] Covered by the &lf; and &tab; entities.                        -->
40 <!--                                                                      -->
41 <!-- You have been warned.                                                -->
42 <!--                                                                      -->
43
44 <!-- create nodeset for referencing later                                 -->
45 <xsl:variable name="not-exists" select="document('')/xsl:stylesheet/xsl:template
46                                         [@name='data']/not-exists/file" />
47
48 <xsl:template name="data">
49 <!-- documents not converted (yet?). -->
50 <not-exists>
51 <!--  example: <file>developer/API.xml</file> -->
52 </not-exists>
53 </xsl:template>
54
55 <!-- Constants used for case translation -->
56 <xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
57 <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
58
59 <!-- document() works relative to the xsl (!) file -->
60 <xsl:variable name="basedir" select="'../../'"/>
61
62 <!-- icons -->
63 <xsl:variable name="icon.document" select="'11'" />
64 <xsl:variable name="icon.document.not-translated" select="'12'" />
65 <xsl:variable name="icon.section" select="'35'" />
66 <xsl:variable name="icon.directive" select="'41'" />
67 <xsl:variable name="icon.commondirective" select="'19'" />
68 <!-- this should not happen. this icon is only displayed within the
69      toc view of the help workshop (it's a question mark): -->
70 <xsl:variable name="icon.no-anchor" select="'9'" />
71
72 <!-- for module-translatename -->
73 <xsl:include href="../xsl/util/modtrans.xsl"/>
74
75 <!-- ==================================================================== -->
76 <!-- <sitemap>                                                            -->
77 <!-- Create CHM contents file (toc) from sitemap                          -->
78 <!-- The file is an html style text file (see warning on top)             -->
79 <!-- ==================================================================== -->
80 <xsl:template match="/sitemap">
81
82 <!-- html head -->
83 <xsl:text>&lt;html&gt;&lt;head&gt;</xsl:text>
84 <xsl:text>&lt;title&gt;Apache HTTP Server Documentation&lt;/title&gt;</xsl:text>
85 <xsl:text>&lt;/head&gt;</xsl:text>&lf;
86
87 <xsl:text>&lt;body&gt;</xsl:text>&lf;
88
89 <!-- toc properties first -->
90 <xsl:text>&lt;object type="text/site properties"&gt;</xsl:text>&lf;&tab;
91 <!-- XXX: that magic value is still obfuscated. Research needed ... -->
92 <xsl:text>&lt;param name="Window Styles" value="0x800027"&gt;</xsl:text>&lf;&tab;
93 <xsl:text>&lt;param name="Font" value="</xsl:text>
94     <xsl:value-of select="$toc-font" />
95 <xsl:text>"&gt;</xsl:text>&lf;
96 <xsl:text>&lt;/object&gt;</xsl:text>&lf;
97
98 &ul.start; &lf;
99
100     <!-- index page on top. -->
101     &li.start;
102     <xsl:call-template name="object">
103         <xsl:with-param name="name"
104             select="normalize-space($message[@id='apachehttpserver'])" />
105         <xsl:with-param name="href" select="'index.html'" />
106         <xsl:with-param name="indent" select="'&#9;&#9;'" />
107     </xsl:call-template>
108     &li.end; &lf;
109
110     <!-- iterate over the categories in document order -->
111     <xsl:for-each select="category">
112         &li.start;
113         <xsl:call-template name="folder">
114             <xsl:with-param name="name" select="normalize-space(title)" />
115         </xsl:call-template>&lf;&tab;
116
117         &ul.start; &lf;&tab;
118             <xsl:apply-templates select="page" />
119             <xsl:if test="@id = 'modules'">
120                 <xsl:apply-templates select="document($allmodules)/modulefilelist" />
121             </xsl:if>
122         &ul.end; &lf;
123         &li.end; &lf;&tab;
124     </xsl:for-each>&lf;
125
126 &ul.end; &lf;
127
128 <xsl:text>&lt;/body&gt;&lt;/html&gt;</xsl:text>&lf;
129 </xsl:template>
130 <!-- /sitemap -->
131
132
133 <!-- ==================================================================== -->
134 <!-- category/page                                                        -->
135 <!-- ==================================================================== -->
136 <xsl:template match="category/page">
137 <xsl:if test="not(starts-with(@href,'http:') or starts-with(@href, 'https:'))">
138 &li.start;
139
140 <!-- document entry, if not href attribute, assume it means "sitemap" -->
141 <xsl:call-template name="object">
142     <xsl:with-param name="name">
143         <xsl:choose>
144         <xsl:when test="@href">
145             <xsl:value-of select="normalize-space(.)" />
146         </xsl:when>
147         <xsl:otherwise>
148             <xsl:value-of select="normalize-space($message[@id='sitemap'])" />
149         </xsl:otherwise>
150         </xsl:choose>
151     </xsl:with-param>
152     <xsl:with-param name="href">
153         <xsl:choose>
154         <xsl:when test="not(@href)">
155             <xsl:text>sitemap.html</xsl:text>
156         </xsl:when>
157         <xsl:when test="contains(@href, '#')">
158             <xsl:value-of select="substring-before(@href, '#')" />
159         </xsl:when>
160         <xsl:otherwise>
161             <xsl:value-of select="@href"/>
162         </xsl:otherwise>
163         </xsl:choose>
164     </xsl:with-param>
165     <xsl:with-param name="indent" select="'&#9;&#9;'" />
166 </xsl:call-template>
167
168 <!-- now try to index the sections of the document -->
169 <xsl:apply-templates select="self::page" mode="index" />
170
171 &li.end; &lf;&tab;
172 </xsl:if>
173 </xsl:template>
174 <!-- /category/page -->
175
176
177 <!-- ==================================================================== -->
178 <!-- category/page, mode="index"                                          -->
179 <!-- display all section headings of one page                             -->
180 <!-- ==================================================================== -->
181 <xsl:template match="category/page" mode="index">
182 <xsl:variable name="href.offline">
183     <xsl:choose>
184     <xsl:when test="string-length(@href) = 0">
185         <xsl:text>sitemap.html</xsl:text>
186     </xsl:when>
187     <xsl:otherwise>
188         <xsl:call-template name="helper.href.offline">
189             <xsl:with-param name="href" select="@href" />
190         </xsl:call-template>
191     </xsl:otherwise>
192     </xsl:choose>
193 </xsl:variable>
194 <xsl:variable name="xml"
195     select="concat(substring-before($href.offline, '.html'), '.xml')" />
196
197 <xsl:if test="not($xml = $not-exists)">
198     <xsl:variable name="xmlfile">
199         <xsl:variable name="metafile"
200             select="document(document(concat($basedir, $xml))/*/@metafile)
201                     /metafile" />
202         <xsl:choose>
203         <xsl:when test="$metafile/variants/variant[.=$doclang] and not
204                         ($metafile/variants/variant[.=$doclang]
205                          /@htmlonly = 'yes')">
206                 <xsl:value-of select="concat($basedir,
207                                    substring-before($xml, '.xml'), $xml-ext)" />
208         </xsl:when>
209         <xsl:otherwise>
210             <xsl:value-of select="concat($basedir, $xml)" />
211         </xsl:otherwise>
212         </xsl:choose>
213     </xsl:variable>
214
215     <xsl:variable name="current" select="document($xmlfile)" />
216
217     <xsl:if test="count($current/*/*[local-name()='section' or
218                                      local-name()='category']) &gt; 1">
219         &lf;&tab;&tab;&tab;
220         &ul.start; &lf;&tab;&tab;&tab;
221
222         <xsl:for-each select="$current/*/*[local-name()='section' or
223                                            local-name()='category']">
224             &li.start;
225
226             <xsl:call-template name="object">
227                 <xsl:with-param name="name" select="normalize-space(title)" />
228                 <xsl:with-param name="href">
229                     <xsl:if test="@id">
230                         <xsl:value-of
231                             select="concat(substring-before($xml, '.xml'),
232                                            '.html#', @id)" />
233                     </xsl:if>
234                 </xsl:with-param>
235                 <xsl:with-param name="indent" select="'&#9;&#9;&#9;&#9;'" />
236             </xsl:call-template>
237
238             &li.end; &lf;&tab;&tab;
239         </xsl:for-each>
240
241         &ul.end; &lf;&tab;
242     </xsl:if> <!-- count() > 1 -->
243 </xsl:if> <!-- xml exists -->
244 </xsl:template>
245 <!-- /category/page, "index" -->
246
247
248 <!-- ==================================================================== -->
249 <!-- category/modulefilelist                                              -->
250 <!-- process all listed module files                                      -->
251 <!-- ==================================================================== -->
252 <xsl:template match="modulefilelist">
253 <!-- create a module name translation list for sorting -->
254 <xsl:variable name="translist">
255     <xsl:text>-</xsl:text>
256
257     <xsl:for-each select="modulefile">
258         <xsl:variable name="current"
259             select="document(concat($basedir,'mod/',.))/modulesynopsis" />
260    
261         <xsl:text> </xsl:text>
262         <xsl:value-of select="$current/name"/>
263         <xsl:text> </xsl:text>
264         <xsl:call-template name="module-translatename">
265             <xsl:with-param name="name" select="$current/name"/>
266         </xsl:call-template>
267         <xsl:text> -</xsl:text>
268     </xsl:for-each>
269 </xsl:variable>
270
271 <!-- put core and mpm_common on top -->
272 <xsl:call-template name="toc-entry.mpm">
273     <xsl:with-param name="current"
274         select="document(concat($basedir, 'mod/', modulefile[starts-with(.,
275                          'core.xml')]/text()))/modulesynopsis" />
276     <xsl:with-param name="name" select="'core'" />
277 </xsl:call-template>
278
279 <xsl:call-template name="toc-entry.mpm">
280     <xsl:with-param name="current"
281         select="document(concat($basedir, 'mod/', modulefile[starts-with(.,
282                          'mpm_common.xml')]/text()))/modulesynopsis" />
283     <xsl:with-param name="name" select="'common'" />
284 </xsl:call-template>
285
286 <!-- remaining MPMs -->
287 <xsl:for-each select="modulefile">
288 <xsl:sort select="substring-before(substring-after($translist, concat('- ',
289     document(concat($basedir, 'mod/', .))/modulesynopsis/name, ' ')), ' -')" />
290
291     <xsl:variable name="current"
292         select="document(concat($basedir, 'mod/', .))/modulesynopsis" />
293
294     <xsl:if test="$current/status='MPM' and not($current/name='mpm_common')">
295         <xsl:call-template name="toc-entry.mpm">
296             <xsl:with-param name="current" select="$current" />
297             <xsl:with-param name="name" select="substring-before(
298                 substring-after($translist, concat('- ', $current/name, ' ')),
299                 ' -')" />
300         </xsl:call-template>
301     </xsl:if>
302 </xsl:for-each>
303
304 <!-- normal modules -->
305 <xsl:for-each select="modulefile">
306 <xsl:sort select="substring-before(substring-after($translist, concat('- ',
307     document(concat($basedir, 'mod/', .))/modulesynopsis/name, ' ')), ' -')" />
308
309     <xsl:variable name="current"
310         select="document(concat($basedir, 'mod/', .))/modulesynopsis" />
311
312     <xsl:if test="not($current/status='MPM') and not($current/status='Core')">
313         <xsl:call-template name="toc-entry.module">
314             <xsl:with-param name="current" select="$current"/>
315         </xsl:call-template>
316     </xsl:if>
317 </xsl:for-each>
318 </xsl:template>
319 <!-- /category/modulefilelist -->
320
321
322 <!-- ==================================================================== -->
323 <!-- toc-entry.mpm                                                        -->
324 <!-- create entry (and initiate subsection entries) of an mpm             -->
325 <!-- ==================================================================== -->
326 <xsl:template name="toc-entry.mpm">
327 <xsl:param name="current" />
328 <xsl:param name="name" />
329
330 &li.start;
331
332 <xsl:call-template name="object">
333     <xsl:with-param name="name">
334         <xsl:choose>
335         <xsl:when test="$name='core'">
336             <xsl:value-of select="normalize-space($message[@id='apachecore'])" />
337         </xsl:when>
338         <xsl:when test="$name='common'">
339             <xsl:value-of select="normalize-space($message[@id='apachempmcommon'])" />
340         </xsl:when>
341         <xsl:otherwise>
342             <xsl:value-of select="normalize-space($message[@id='apachempm'])" />
343             <xsl:text> </xsl:text>
344             <xsl:value-of select="$name" />
345         </xsl:otherwise>
346         </xsl:choose>
347     </xsl:with-param>
348     <xsl:with-param name="href"
349         select="concat('mod/', $current/name, '.html')" />
350     <xsl:with-param name="indent" select="'&#9;&#9;&#9;'" />
351 </xsl:call-template>
352     
353 <xsl:call-template name="sections-and-directives">
354     <xsl:with-param name="current" select="$current" />
355 </xsl:call-template>
356
357 &li.end; &lf;&tab;
358 </xsl:template>
359 <!-- /toc-entry.mpm -->
360   
361
362 <!-- ==================================================================== -->
363 <!-- toc-entry.module                                                     -->
364 <!-- create entry (and initiate subsection entries) of a module           -->
365 <!-- ==================================================================== -->
366 <xsl:template name="toc-entry.module">
367 <xsl:param name="current"/>
368
369 &li.start;
370
371 <xsl:call-template name="object">
372     <xsl:with-param name="name">
373         <xsl:value-of select="normalize-space($message[@id='apachemodule'])" />
374         <xsl:text> </xsl:text>
375         <xsl:value-of select="$current/name" />
376     </xsl:with-param>
377     <xsl:with-param name="href"
378         select="concat('mod/', $current/name, '.html')" />
379     <xsl:with-param name="indent" select="'&#9;&#9;&#9;'" />
380 </xsl:call-template>
381     
382 <xsl:call-template name="sections-and-directives">
383     <xsl:with-param name="current" select="$current" />
384 </xsl:call-template>
385
386 &li.end; &lf;&tab;
387 </xsl:template>
388 <!-- /toc-entry.module -->
389
390
391 <!-- ==================================================================== -->
392 <!-- sections-and-directives                                              -->
393 <!-- process sections and directives of a module file                     -->
394 <!-- ==================================================================== -->
395 <xsl:template name="sections-and-directives">
396 <xsl:param name="current" />
397
398 <xsl:if test="count($current/section) &gt; 0 or
399               count($current/directivesynopsis) &gt; 0">
400     &lf;&tab;&tab;
401
402     &ul.start; &lf;&tab;&tab;
403
404     <!-- sections -->
405     <xsl:for-each select="$current/section">
406         &li.start;
407
408         <xsl:call-template name="object">
409             <xsl:with-param name="name" select="normalize-space(title)" />
410             <xsl:with-param name="href">
411                 <xsl:if test="@id">
412                     <xsl:value-of
413                         select="concat('mod/', $current/name, '.html#', @id)" />
414                 </xsl:if>
415             </xsl:with-param>
416             <xsl:with-param name="indent" select="'&#9;&#9;&#9;&#9;'" />
417         </xsl:call-template>
418
419         &li.end; &lf;&tab;&tab;
420     </xsl:for-each>
421
422     <!-- directives within the current document -->
423     <xsl:for-each select="$current/directivesynopsis[not(@location)]">
424     <xsl:sort select="name" />
425         &li.start;
426
427         <xsl:call-template name="object">
428             <xsl:with-param name="name">
429                 <xsl:if test="@type='section'">&lt;</xsl:if>
430                 <xsl:value-of select="name"/>
431                 <xsl:if test="@type='section'">&gt;</xsl:if>
432                 <xsl:choose>
433                 <xsl:when test="$message[@id='directive']
434                                 /@replace-space-with">
435                     <xsl:value-of select="$message[@id='directive']
436                                           /@replace-space-with" />
437                 </xsl:when>
438                 <xsl:otherwise>
439                     <xsl:text> </xsl:text>
440                 </xsl:otherwise>
441                 </xsl:choose>
442                 <xsl:value-of select="normalize-space($message[@id='directive'])" />
443             </xsl:with-param>
444             <xsl:with-param name="href"
445                 select="concat('mod/', $current/name, '.html#',
446                                translate(name, $uppercase, $lowercase))" />
447             <xsl:with-param name="indent" select="'&#9;&#9;&#9;&#9;'" />
448             <xsl:with-param name="icon" select="$icon.directive" />
449         </xsl:call-template>
450
451         &li.end; &lf;&tab;&tab;
452     </xsl:for-each>
453
454     <!-- directives described elsewhere -->
455     <xsl:for-each select="$current/directivesynopsis[@location]">
456     <xsl:sort select="name" />
457         &li.start;
458
459         <xsl:call-template name="object">
460             <xsl:with-param name="name">
461                 <xsl:if test="@type='section'">&lt;</xsl:if>
462                 <xsl:value-of select="name"/>
463                 <xsl:if test="@type='section'">&gt;</xsl:if>
464                 <xsl:choose>
465                 <xsl:when test="$message[@id='directive']
466                                 /@replace-space-with">
467                     <xsl:value-of select="$message[@id='directive']
468                                           /@replace-space-with" />
469                 </xsl:when>
470                 <xsl:otherwise>
471                     <xsl:text> </xsl:text>
472                 </xsl:otherwise>
473                 </xsl:choose>
474                 <xsl:value-of select="normalize-space($message[@id='directive'])" />
475             </xsl:with-param>
476             <xsl:with-param name="href"
477                 select="concat('mod/', @location, '.html#',
478                                translate(name, $uppercase, $lowercase))" />
479             <xsl:with-param name="indent" select="'&#9;&#9;&#9;&#9;'" />
480             <xsl:with-param name="icon" select="$icon.commondirective" />
481         </xsl:call-template>
482
483         &li.end; &lf;&tab;&tab;
484     </xsl:for-each>
485
486     &ul.end; &lf;&tab;
487 </xsl:if> <!-- sections or directives present -->
488 </xsl:template>
489 <!-- /sections-and-directives -->
490
491
492 <!-- ==================================================================== -->
493 <!-- object                                                               -->
494 <!-- display an <object> and do some magic to select the right content    -->
495 <!-- ==================================================================== -->
496 <xsl:template name="object">
497 <xsl:param name="name" select="'? unknown ?'" />
498 <xsl:param name="href" />
499 <xsl:param name="icon" select="$icon.section" />
500 <xsl:param name="indent" />
501
502 <xsl:variable name="href.offline">
503     <xsl:call-template name="helper.href.offline">
504         <xsl:with-param name="href" select="$href" />
505     </xsl:call-template>
506 </xsl:variable>
507
508 <!-- xml file is expected to have the same basename -->
509 <xsl:variable name="xml"
510     select="concat(substring-before($href.offline, '.html'), '.xml')" />
511
512 <xsl:text>&lt;object type="text/sitemap"&gt;</xsl:text>&lf;
513 <xsl:value-of select="$indent" />
514
515 <xsl:text>&lt;param name="Name" value="</xsl:text>
516     <xsl:call-template name="filter.attval">
517         <xsl:with-param name="text" select="$name" />
518     </xsl:call-template>
519 <xsl:text>"&gt;</xsl:text>&lf;
520 <xsl:value-of select="$indent" />
521
522 <xsl:if test="string-length($href.offline) &gt; 0">
523     <xsl:text>&lt;param name="Local" value="</xsl:text>
524         <xsl:call-template name="filter.attval">
525             <xsl:with-param name="text" select="$href.offline" />
526         </xsl:call-template>
527     <xsl:text>"&gt;</xsl:text>&lf;
528     <xsl:value-of select="$indent" />
529 </xsl:if>
530
531 <xsl:text>&lt;param name="ImageNumber" value="</xsl:text>
532     <xsl:choose>
533     <xsl:when test="string-length($href.offline) &gt; 0">
534         <xsl:choose>
535         <xsl:when test="contains($href, '#')">
536             <xsl:value-of select="$icon" />
537         </xsl:when>
538         <xsl:when test="$doclang='en' or
539                         (not($xml = $not-exists) and
540                          (document(document(concat($basedir, $xml))
541                                    /*/@metafile)
542                           /metafile/variants/variant
543                           [.=$doclang and not(@htmlonly='yes')]))">
544             <xsl:value-of select="$icon.document" />
545         </xsl:when>
546         <xsl:otherwise>
547             <xsl:value-of select="$icon.document.not-translated" />
548         </xsl:otherwise>
549         </xsl:choose>
550     </xsl:when>
551     <xsl:otherwise>
552         <xsl:value-of select="$icon.no-anchor" />
553     </xsl:otherwise>
554     </xsl:choose>
555 <xsl:text>"&gt;</xsl:text>&lf;
556 <xsl:value-of select="substring($indent, 2)" />
557
558 <xsl:text>&lt;/object&gt;</xsl:text>
559 </xsl:template>
560 <!-- /object -->
561
562
563 <!-- ==================================================================== -->
564 <!-- folder                                                               -->
565 <!-- ==================================================================== -->
566 <xsl:template name="folder">
567 <xsl:param name="name" select="'? unknown ?'" />
568
569 <xsl:text>&lt;object type="text/sitemap"&gt;</xsl:text>&lf;&tab;&tab;
570 <xsl:text>&lt;param name="Name" value="</xsl:text>
571     <xsl:call-template name="filter.attval">
572         <xsl:with-param name="text" select="$name" />
573     </xsl:call-template>
574 <xsl:text>"&gt;</xsl:text>&lf;&tab;
575 <xsl:text>&lt;/object&gt;</xsl:text>
576 </xsl:template>
577 <!-- /folder -->
578
579
580 <!-- ==================================================================== -->
581 <!-- helper.href.offline                                                  -->
582 <!-- change uri reference to work offline (/ -> /index.html)              -->
583 <!-- ==================================================================== -->
584 <xsl:template name="helper.href.offline">
585 <xsl:param name="href" />
586
587 <xsl:choose>
588 <xsl:when test="string-length($href) = 0" />
589 <xsl:when test="contains($href, '#') and '/' = substring($href,
590                                string-length(substring-before($href, '#')), 1)">
591     <xsl:value-of select="substring-before($href, '#')" />
592     <xsl:text>index.html#</xsl:text>
593     <xsl:value-of select="substring-after($href, '#')" />
594 </xsl:when>
595 <xsl:when test="substring($href, string-length($href), 1) = '/'">
596     <xsl:value-of select="$href" />
597     <xsl:text>index.html</xsl:text>
598 </xsl:when>
599 <xsl:otherwise>
600     <xsl:value-of select="$href" />
601 </xsl:otherwise>
602 </xsl:choose>
603 </xsl:template>
604 <!-- /helper.href.offline -->
605
606
607 <!-- ==================================================================== -->
608 <!-- filter.attval                                                        -->
609 <!-- escape special characters for being valid within an attribute        -->
610 <!-- ==================================================================== -->
611 <xsl:template name="filter.attval">
612 <xsl:param name="text" />
613
614 <xsl:choose>
615 <xsl:when test="contains($text, '&amp;')">
616     <xsl:call-template name="filter.attval.special">
617         <xsl:with-param name="text" select="substring-before($text, '&amp;')" />
618     </xsl:call-template>
619     <xsl:text>&amp;amp;</xsl:text>
620     <xsl:call-template name="filter.attval">
621         <xsl:with-param name="text" select="substring-after($text, '&amp;')" />
622     </xsl:call-template>
623 </xsl:when>
624 <xsl:otherwise>
625     <xsl:call-template name="filter.attval.special">
626         <xsl:with-param name="text" select="$text" />
627     </xsl:call-template>
628 </xsl:otherwise>
629 </xsl:choose>
630 </xsl:template>
631 <!-- /filter.attval -->
632
633
634 <!-- ==================================================================== -->
635 <!-- filter.attval.special                                                -->
636 <!-- accompanying template of filter.attval                               -->
637 <!-- ==================================================================== -->
638 <xsl:template name="filter.attval.special">
639 <xsl:param name="text" />
640
641 <xsl:choose>
642 <xsl:when test="contains($text, '&lt;')">
643     <xsl:value-of select="substring-before($text, '&lt;')" />
644     <xsl:text>&amp;lt;</xsl:text>
645     <xsl:call-template name="filter.attval.special">
646         <xsl:with-param name="text" select="substring-after($text, '&lt;')" />
647     </xsl:call-template>
648 </xsl:when>
649 <xsl:when test="contains($text, '&gt;')">
650     <xsl:value-of select="substring-before($text, '&gt;')" />
651     <xsl:text>&amp;gt;</xsl:text>
652     <xsl:call-template name="filter.attval.special">
653         <xsl:with-param name="text" select="substring-after($text, '&gt;')" />
654     </xsl:call-template>
655 </xsl:when>
656 <xsl:when test="contains($text, '&quot;')">
657     <xsl:value-of select="substring-before($text, '&quot;')" />
658     <xsl:text>&amp;quot;</xsl:text>
659     <xsl:call-template name="filter.attval.special">
660         <xsl:with-param name="text" select="substring-after($text, '&quot;')" />
661     </xsl:call-template>
662 </xsl:when>
663 <xsl:otherwise>
664     <xsl:value-of select="$text" />
665 </xsl:otherwise>
666 </xsl:choose>
667 </xsl:template>
668 <!-- /filter.attval.special -->
669
670 </xsl:stylesheet>