]> git.stg.codes - stg.git/blob - doc/xslt/webhelp/xsl/webhelp.xsl
Correcting case insensitive search
[stg.git] / doc / xslt / webhelp / xsl / webhelp.xsl
1 <xsl:stylesheet
2         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3         xmlns:exsl="http://exslt.org/common"
4         xmlns:ng="http://docbook.org/docbook-ng" 
5         xmlns:db="http://docbook.org/ns/docbook"
6         version="1.0" xmlns="http://www.w3.org/1999/xhtml">
7
8     <xsl:import href="../../xhtml/chunk.xsl"/>
9
10     <xsl:output
11             method="html"
12             encoding="utf-8"
13             cdata-section-elements=""/>
14
15     <!-- webhelp-specific params! -->
16     <!-- To be added to normal params file someday -->
17     <xsl:param name="webhelp.include.search.tab">true</xsl:param>
18     <xsl:param name="webhelp.start.filename">index.html</xsl:param>
19     <xsl:param name="webhelp.base.dir">docs</xsl:param>
20     <xsl:param name="webhelp.tree.cookie.id" select="concat( 'treeview-', count(//node()) )"/>
21     <xsl:param name="webhelp.indexer.language">en</xsl:param>
22     <xsl:param name="webhelp.default.topic"/>
23     <xsl:param name="webhelp.autolabel">0</xsl:param>
24     <!-- webhelp-specific params! -->
25
26     <!-- Set some reasonable defaults for webhelp output -->
27     <xsl:param name="chunker.output.indent">no</xsl:param>
28     <xsl:param name="navig.showtitles">0</xsl:param>
29     <xsl:param name="manifest.in.base.dir" select="0"/>
30     <xsl:param name="base.dir" select="concat($webhelp.base.dir,'/content/')"/>
31     <xsl:param name="suppress.navigation">0</xsl:param>
32     <xsl:param name="generate.index" select="1"/>
33     <xsl:param name="inherit.keywords" select="'0'"/>
34     <xsl:param name="local.l10n.xml" select="document('')"/>
35     <xsl:param name="para.propagates.style" select="1"/>
36     <xsl:param name="phrase.propagates.style" select="1"/>
37     <xsl:param name="chunk.first.sections" select="1"/>
38     <xsl:param name="chapter.autolabel" select="1"/>
39     <xsl:param name="section.autolabel" select="0"/>
40     <!--xsl:param name="generate.toc">book toc</xsl:param-->
41
42     <i18n xmlns="http://docbook.sourceforge.net/xmlns/l10n/1.0">
43         <l10n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" language="en">
44             <l:gentext key="Search" text="Search"/>
45             <l:gentext key="Enter_a_term_and_click" text="Enter a term and click "/>
46             <l:gentext key="Go" text="Go"/>
47             <l:gentext key="to_perform_a_search" text=" to perform a search."/>
48             <l:gentext key="txt_filesfound" text="Results"/>
49             <l:gentext key="txt_enter_at_least_1_char" text="You must enter at least one character."/>
50             <l:gentext key="txt_browser_not_supported"
51                        text="Your browser is not supported. Use of Mozilla Firefox is recommended."/>
52             <l:gentext key="txt_please_wait" text="Please wait. Search in progress..."/>
53             <l:gentext key="txt_results_for" text="Results for: "/>
54             <l:gentext key="TableofContents" text="Contents"/>
55                 <l:gentext key="HighlightButton" text="Toggle search result highlighting"/>
56         </l10n>
57         <!-- The fallback mechansim doesn't seem to work for local l10n stuff -->
58         <l10n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" language="ja">
59             <l:gentext key="Search" text="Search"/>
60             <l:gentext key="Enter_a_term_and_click" text="Enter a term and click "/>
61             <l:gentext key="Go" text="Go"/>
62             <l:gentext key="to_perform_a_search" text=" to perform a search."/>
63             <l:gentext key="txt_filesfound" text="Results"/>
64             <l:gentext key="txt_enter_at_least_1_char" text="You must enter at least one character."/>
65             <l:gentext key="txt_browser_not_supported"
66                        text="Your browser is not supported. Use of Mozilla Firefox is recommended."/>
67             <l:gentext key="txt_please_wait" text="Please wait. Search in progress..."/>
68             <l:gentext key="txt_results_for" text="Results for: "/>
69                 <l:gentext key="HighlightButton" text="Toggle search result highlighting"/>
70         </l10n>
71         <l10n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" language="de">
72             <l:gentext key="Search" text="Search"/>
73             <l:gentext key="Enter_a_term_and_click" text="Enter a term and click "/>
74             <l:gentext key="Go" text="Go"/>
75             <l:gentext key="to_perform_a_search" text=" to perform a search."/>
76             <l:gentext key="txt_filesfound" text="Results"/>
77             <l:gentext key="txt_enter_at_least_1_char" text="You must enter at least one character."/>
78             <l:gentext key="txt_browser_not_supported"
79                        text="Your browser is not supported. Use of Mozilla Firefox is recommended."/>
80             <l:gentext key="txt_please_wait" text="Please wait. Search in progress..."/>
81             <l:gentext key="txt_results_for" text="Results for: "/>
82                 <l:gentext key="HighlightButton" text="Toggle search result highlighting"/>
83         </l10n>
84         <l10n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" language="fr">
85             <l:gentext key="Search" text="Search"/>
86             <l:gentext key="Enter_a_term_and_click" text="Enter a term and click "/>
87             <l:gentext key="Go" text="Go"/>
88             <l:gentext key="to_perform_a_search" text=" to perform a search."/>
89             <l:gentext key="txt_filesfound" text="Results"/>
90             <l:gentext key="txt_enter_at_least_1_char" text="You must enter at least one character."/>
91             <l:gentext key="txt_browser_not_supported"
92                        text="Your browser is not supported. Use of Mozilla Firefox is recommended."/>
93             <l:gentext key="txt_please_wait" text="Please wait. Search in progress..."/>
94             <l:gentext key="txt_results_for" text="Results for: "/>
95                 <l:gentext key="HighlightButton" text="Toggle search result highlighting"/>
96         </l10n>
97         <l10n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" language="zh">
98             <l:gentext key="Search" text="Search"/>
99             <l:gentext key="Enter_a_term_and_click" text="Enter a term and click "/>
100             <l:gentext key="Go" text="Go"/>
101             <l:gentext key="to_perform_a_search" text=" to perform a search."/>
102             <l:gentext key="txt_filesfound" text="Results"/>
103             <l:gentext key="txt_enter_at_least_1_char" text="You must enter at least one character."/>
104             <l:gentext key="txt_browser_not_supported"
105                        text="Your browser is not supported. Use of Mozilla Firefox is recommended."/>
106             <l:gentext key="txt_please_wait" text="Please wait. Search in progress..."/>
107             <l:gentext key="txt_results_for" text="Results for: "/>
108                 <l:gentext key="HighlightButton" text="Toggle search result highlighting"/>
109         </l10n>
110
111     </i18n>
112
113   <xsl:template name="system.head.content">
114   <xsl:param name="node" select="."/>
115 <xsl:text>
116 </xsl:text>
117 <!-- 
118 This avoids two problems in IE 8. We should someday figure out why this is happening and tweak the JavaScript so this <meta/> tag is not necessary:
119 1. When you perform a search and click the Toggle Highlight button, IE 8 adds a line break before the highlighted word.
120 2. If you click the show/hide toc button, the tab crashes.
121 These problems go away when you add this IE=7 mode meta tag.
122  -->
123         <meta http-equiv="X-UA-Compatible" content="IE=7" />
124 <xsl:text>
125 </xsl:text>
126   </xsl:template>
127
128
129     <xsl:template name="user.head.content">
130             <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
131         <!--  <xsl:message>
132             webhelp.tree.cookie.id = <xsl:value-of select="$webhelp.tree.cookie.id"/> +++ <xsl:value-of select="count(//node())"/>
133             $webhelp.indexer.language = <xsl:value-of select="$webhelp.indexer.language"/> +++ <xsl:value-of select="count(//node())"/>
134         </xsl:message>-->
135         <script type="text/javascript">
136             //The id for tree cookie
137             var treeCookieId = "<xsl:value-of select="$webhelp.tree.cookie.id"/>";
138             var language = "<xsl:value-of select="$webhelp.indexer.language"/>";
139             var w = new Object();
140             //Localization
141             txt_filesfound = '<xsl:call-template name="gentext">
142                 <xsl:with-param name="key" select="'txt_filesfound'"/>
143                 </xsl:call-template>';
144             txt_enter_at_least_1_char = "<xsl:call-template name="gentext">
145                 <xsl:with-param name="key" select="'txt_enter_at_least_1_char'"/>
146                 </xsl:call-template>";
147             txt_browser_not_supported = "<xsl:call-template name="gentext">
148                 <xsl:with-param name="key" select="'txt_browser_not_supported'"/>
149                 </xsl:call-template>";
150             txt_please_wait = "<xsl:call-template name="gentext">
151                 <xsl:with-param name="key" select="'txt_please_wait'"/>
152                 </xsl:call-template>";
153             txt_results_for = "<xsl:call-template name="gentext">
154                 <xsl:with-param name="key" select="'txt_results_for'"/>
155                 </xsl:call-template>";
156         </script>
157         <style type="text/css">
158             input {
159             margin-bottom: 5px;
160             margin-top: 2px;
161             }
162
163             .folder {
164             display: block;
165             height: 22px;
166             padding-left: 20px;
167             background: transparent url(../common/jquery/treeview/images/folder.gif) 0 0px no-repeat;
168             }
169             <!--[if IE]>
170             input {
171                 margin-bottom: 5px;
172                 margin-top: 2px;
173             }
174             <![endif]-->
175         </style>
176         <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"/>
177         <link rel="stylesheet" type="text/css" href="../common/css/positioning.css"/>
178         <link rel="stylesheet" type="text/css" href="../common/jquery/theme-redmond/jquery-ui-1.8.2.custom.css"/>
179         <link rel="stylesheet" type="text/css" href="../common/jquery/treeview/jquery.treeview.css"/>
180
181         <script type="text/javascript" src="../common/jquery/jquery-1.4.2.min.js">
182             <xsl:comment> </xsl:comment>
183         </script>
184         <script type="text/javascript" src="../common/jquery/jquery-ui-1.8.2.custom.min.js">
185             <xsl:comment> </xsl:comment>
186         </script>
187         <script type="text/javascript" src="../common/jquery/jquery.cookie.js">
188             <xsl:comment> </xsl:comment>
189         </script>
190         <script type="text/javascript" src="../common/jquery/treeview/jquery.treeview.min.js">
191             <xsl:comment> </xsl:comment>
192         </script>
193         <!--Scripts/css stylesheets for Search-->
194         <script type="text/javascript" src="search/htmlFileList.js">
195             <xsl:comment> </xsl:comment>
196         </script>
197         <script type="text/javascript" src="search/htmlFileInfoList.js">
198             <xsl:comment> </xsl:comment>
199         </script>
200         <script type="text/javascript" src="search/nwSearchFnt.js">
201             <xsl:comment> </xsl:comment>
202         </script>
203         
204         <!--script type="text/javascript" src="search/addition.js">
205             <xsl:comment></xsl:comment>
206         </script>
207         <script type="text/javascript" src="search/indexLoader.js">
208             <xsl:comment></xsl:comment>
209         </script-->
210
211
212         <!--
213            NOTE: Stemmer javascript files should be in format <language>_stemmer.js.
214            For example, for English(en), source should be: "search/stemmers/en_stemmer.js"
215            For country codes, see: http://www.uspto.gov/patft/help/helpctry.htm
216         -->
217         <!--<xsl:message><xsl:value-of select="concat('search/stemmers/',$webhelp.indexer.language,'_stemmer.js')"/></xsl:message>-->
218         <script type="text/javascript" src="{concat('search/stemmers/',$webhelp.indexer.language,'_stemmer.js')}">
219             <xsl:comment>//make this scalable to other languages as well.</xsl:comment>
220         </script>
221
222         <!--Index Files:
223             Index is broken in to three equal sized(number of index items) files. This is to help parallel downloading
224             of files to make it faster.-->
225         <script type="text/javascript" src="search/index-1.js">
226             <xsl:comment> </xsl:comment>
227         </script>
228         <script type="text/javascript" src="search/index-2.js">
229             <xsl:comment> </xsl:comment>
230         </script>
231         <script type="text/javascript" src="search/index-3.js">
232             <xsl:comment> </xsl:comment>
233         </script>
234         <!--End of index files -->
235     </xsl:template>
236
237     <xsl:template name="user.header.navigation">
238         <xsl:param name="prev"/>
239         <xsl:param name="next"/>
240         <xsl:param name="nav.context"/>
241         <xsl:call-template name="webhelpheader">
242             <xsl:with-param name="prev" select="$prev"/>
243             <xsl:with-param name="next" select="$next"/>
244             <xsl:with-param name="nav.context" select="$nav.context"/>
245         </xsl:call-template>
246         <!--xsl:call-template name="webhelptoc"/-->
247
248         <!--testing toc in the content page>
249         <xsl:call-template name="webhelptoctoc"/>
250         <xsl:if test="$webhelp.include.search.tab != 'false'">
251             <xsl:call-template name="search"/>
252         </xsl:if-->
253     </xsl:template>
254
255     <xsl:template name="user.header.content">
256         <xsl:comment> <!-- KEEP this code. --> </xsl:comment>
257     </xsl:template>
258
259     <xsl:template name="user.footer.navigation">
260         <xsl:call-template name="webhelptoc">
261                   <xsl:with-param name="currentid" select="generate-id(.)"/>
262              </xsl:call-template>
263     </xsl:template>
264
265   <xsl:template match="/">
266         <xsl:message>language: <xsl:value-of select="$webhelp.indexer.language"/> </xsl:message>
267         <!-- * Get a title for current doc so that we let the user -->
268         <!-- * know what document we are processing at this point. -->
269         <xsl:variable name="doc.title">
270           <xsl:call-template name="get.doc.title"/>
271         </xsl:variable>
272         <xsl:choose>
273           <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
274           toss the namespace and continue.  Use the docbook5 namespaced
275           stylesheets for DocBook5 if you don't want to use this feature.-->
276           <!-- include extra test for Xalan quirk -->
277           <xsl:when test="$exsl.node.set.available != 0                     and (*/self::ng:* or */self::db:*)">
278                 <xsl:call-template name="log.message">
279                   <xsl:with-param name="level">Note</xsl:with-param>
280                   <xsl:with-param name="source" select="$doc.title"/>
281                   <xsl:with-param name="context-desc">
282                         <xsl:text>namesp. cut</xsl:text>
283                   </xsl:with-param>
284                   <xsl:with-param name="message">
285                         <xsl:text>stripped namespace before processing</xsl:text>
286                   </xsl:with-param>
287                 </xsl:call-template>
288                 <xsl:variable name="nons">
289         <xsl:apply-templates mode="stripNS"/>
290       </xsl:variable>
291                 <!--
292                 <xsl:message>Saving stripped document.</xsl:message>
293                 <xsl:call-template name="write.chunk">
294         <xsl:with-param name="filename" select="'/tmp/stripped.xml'"/>
295         <xsl:with-param name="method" select="'xml'"/>
296         <xsl:with-param name="content">
297                 <xsl:copy-of select="exsl:node-set($nons)"/>
298           </xsl:with-param>
299       </xsl:call-template>
300                 -->
301                 <xsl:call-template name="log.message">
302                   <xsl:with-param name="level">Note</xsl:with-param>
303                   <xsl:with-param name="source" select="$doc.title"/>
304                   <xsl:with-param name="context-desc">
305                         <xsl:text>namesp. cut</xsl:text>
306                   </xsl:with-param>
307                   <xsl:with-param name="message">
308                         <xsl:text>processing stripped document</xsl:text>
309                   </xsl:with-param>
310                 </xsl:call-template>
311                 <xsl:apply-templates select="exsl:node-set($nons)"/>
312           </xsl:when>
313           <!-- Can't process unless namespace removed -->
314           <xsl:when test="*/self::ng:* or */self::db:*">
315                 <xsl:message terminate="yes">
316                   <xsl:text>Unable to strip the namespace from DB5 document,</xsl:text>
317                   <xsl:text> cannot proceed.</xsl:text>
318                 </xsl:message>
319           </xsl:when>
320           <xsl:otherwise>
321                 <xsl:choose>
322                   <xsl:when test="$rootid != ''">
323                         <xsl:choose>
324                           <xsl:when test="count(key('id',$rootid)) = 0">
325                                 <xsl:message terminate="yes">
326                                   <xsl:text>ID '</xsl:text>
327                                   <xsl:value-of select="$rootid"/>
328                                   <xsl:text>' not found in document.</xsl:text>
329                                 </xsl:message>
330                           </xsl:when>
331                           <xsl:otherwise>
332                                 <xsl:if test="$collect.xref.targets = 'yes' or                             $collect.xref.targets = 'only'">
333                                   <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
334                                 </xsl:if>
335                                 <xsl:if test="$collect.xref.targets != 'only'">
336                                   <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
337                                   <xsl:if test="$tex.math.in.alt != ''">
338                                         <xsl:apply-templates select="key('id',$rootid)" mode="collect.tex.math"/>
339                 </xsl:if>
340                                 </xsl:if>
341                           </xsl:otherwise>
342                         </xsl:choose>
343                   </xsl:when>
344                   <xsl:otherwise>
345                         <xsl:if test="$collect.xref.targets = 'yes' or                         $collect.xref.targets = 'only'">
346                           <xsl:apply-templates select="/" mode="collect.targets"/>
347                         </xsl:if>
348                         <xsl:if test="$collect.xref.targets != 'only'">
349                           <xsl:apply-templates select="/" mode="process.root"/>
350                           <xsl:if test="$tex.math.in.alt != ''">
351               <xsl:apply-templates select="/" mode="collect.tex.math"/>
352             </xsl:if>
353           </xsl:if>
354                   </xsl:otherwise>
355                 </xsl:choose>
356           </xsl:otherwise>
357         </xsl:choose>
358         
359         <xsl:call-template name="index.html"/>
360
361     </xsl:template>
362
363     <xsl:template name="chunk-element-content">
364         <xsl:param name="prev"/>
365         <xsl:param name="next"/>
366         <xsl:param name="nav.context"/>
367         <xsl:param name="content">
368             <xsl:apply-imports/>
369         </xsl:param>
370
371         <xsl:call-template name="user.preroot"/>
372
373         <html>
374             <xsl:call-template name="html.head">
375                 <xsl:with-param name="prev" select="$prev"/>
376                 <xsl:with-param name="next" select="$next"/>
377             </xsl:call-template>
378
379             <body>
380                 <xsl:call-template name="body.attributes"/>
381
382                 <xsl:call-template name="user.header.navigation">
383                     <xsl:with-param name="prev" select="$prev"/>
384                     <xsl:with-param name="next" select="$next"/>
385                     <xsl:with-param name="nav.context" select="$nav.context"/>
386                 </xsl:call-template>
387
388
389                 <div id="content">
390
391                     <xsl:call-template name="user.header.content"/>
392
393                     <xsl:copy-of select="$content"/>
394
395                     <xsl:call-template name="user.footer.content"/>
396
397                     <xsl:call-template name="footer.navigation">
398                         <xsl:with-param name="prev" select="$prev"/>
399                         <xsl:with-param name="next" select="$next"/>
400                         <xsl:with-param name="nav.context" select="$nav.context"/>
401                     </xsl:call-template>
402                 </div>
403
404                 <xsl:call-template name="user.footer.navigation"/>
405             </body>
406         </html>
407         <xsl:value-of select="$chunk.append"/>
408     </xsl:template>
409
410     <!-- The Header with the company logo -->
411     <xsl:template name="webhelpheader">
412         <xsl:param name="prev"/>
413         <xsl:param name="next"/>
414         <xsl:param name="nav.context"/>
415
416         <xsl:variable name="home" select="/*[1]"/>
417         <xsl:variable name="up" select="parent::*"/>
418
419         <div id="header">
420             <img style='margin-right: 2px; height: 59px; padding-right: 25px; padding-top: 8px' align="right"
421                  src='../common/images/logo.png' alt="Company Logo"/>
422
423             <!-- Display the page title and the main heading(parent) of it-->
424             <h1 align="center">
425                 <xsl:apply-templates select="." mode="object.title.markup"/>
426                 <br/>
427                 <xsl:choose>
428                     <xsl:when
429                             test="count($up) &gt; 0 and generate-id($up) != generate-id($home)">
430                         <xsl:apply-templates select="$up" mode="object.title.markup"/>
431                     </xsl:when>
432                     <xsl:otherwise>&#160;</xsl:otherwise>
433                 </xsl:choose>
434             </h1>
435
436             <!-- Prev and Next links generation-->
437             <div id="navheader" align="right">
438                 <xsl:comment>
439                     <!-- KEEP this code. In case of neither prev nor next links are available, this will help to
440                     keep the integrity of the DOM tree-->
441                 </xsl:comment>
442                 <!--xsl:with-param name="prev" select="$prev"/>
443                 <xsl:with-param name="next" select="$next"/>
444                 <xsl:with-param name="nav.context" select="$nav.context"/-->
445                 <table>
446                     <tr>
447                         <td style="height: 28px; width: 16px;">
448                             <a id="showHideButton" onclick="showHideToc();"
449                                class="pointLeft" title="Hide TOC tree">.
450                             </a>
451                         </td>
452                         <td>
453                             <img src="../common/images/highlight-blue.gif" alt="H" height="25px"
454                                  onclick="toggleHighlight()" id="showHideHighlight" style="cursor:pointer">
455                                 <xsl:attribute name="title">
456                                   <xsl:call-template name="gentext">
457                                         <xsl:with-param name="key" select="'HighlightButton'"/>
458                                   </xsl:call-template>                            
459                                 </xsl:attribute>
460                           </img>
461                         </td>
462                         <xsl:if test="count($prev) &gt; 0
463                                         or (count($up) &gt; 0
464                                         and generate-id($up) != generate-id($home)
465                                         and $navig.showtitles != 0)
466                                         or count($next) &gt; 0">
467                             <td>
468                                 <xsl:if test="count($prev)>0">
469                                     <a accesskey="p">
470                                         <xsl:attribute name="href">
471                                             <xsl:call-template name="href.target">
472                                                 <xsl:with-param name="object" select="$prev"/>
473                                             </xsl:call-template>
474                                         </xsl:attribute>
475                                         <xsl:call-template name="navig.content">
476                                             <xsl:with-param name="direction" select="'prev'"/>
477                                         </xsl:call-template>
478                                     </a>
479                                 </xsl:if>
480
481                                 <!-- "Up" link-->
482                                 <xsl:choose>
483                                     <xsl:when test="count($up)&gt;0
484                                               and generate-id($up) != generate-id($home)">
485                                         |
486                                         <a accesskey="u">
487                                             <xsl:attribute name="href">
488                                                 <xsl:call-template name="href.target">
489                                                     <xsl:with-param name="object" select="$up"/>
490                                                 </xsl:call-template>
491                                             </xsl:attribute>
492                                             <xsl:call-template name="navig.content">
493                                                 <xsl:with-param name="direction" select="'up'"/>
494                                             </xsl:call-template>
495                                         </a>
496                                     </xsl:when>
497                                     <xsl:otherwise>&#160;</xsl:otherwise>
498                                 </xsl:choose>
499                                 
500                                 <xsl:if test="count($next)>0">
501                                     |
502                                     <a accesskey="n">
503                                         <xsl:attribute name="href">
504                                             <xsl:call-template name="href.target">
505                                                 <xsl:with-param name="object" select="$next"/>
506                                             </xsl:call-template>
507                                         </xsl:attribute>
508                                         <xsl:call-template name="navig.content">
509                                             <xsl:with-param name="direction" select="'next'"/>
510                                         </xsl:call-template>
511                                     </a>
512                                 </xsl:if>
513                             </td>
514                         </xsl:if>
515
516                     </tr>
517                 </table>
518
519
520
521             </div>
522
523         </div>
524     </xsl:template>
525
526     <xsl:template name="webhelptoc">
527         <xsl:param name="currentid"/>
528         <xsl:choose>
529             <xsl:when test="$rootid != ''">
530                 <xsl:variable name="title">
531                     <xsl:if test="$webhelp.autolabel=1">
532                         <xsl:variable name="label.markup">
533                             <xsl:apply-templates select="key('id',$rootid)" mode="label.markup"/>
534                         </xsl:variable>
535                         <xsl:if test="normalize-space($label.markup)">
536                             <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
537                         </xsl:if>
538                     </xsl:if>
539                     <xsl:apply-templates select="key('id',$rootid)" mode="title.markup"/>
540                 </xsl:variable>
541                 <xsl:variable name="href">
542                     <xsl:choose>
543                         <xsl:when test="$manifest.in.base.dir != 0">
544                             <xsl:call-template name="href.target">
545                                 <xsl:with-param name="object" select="key('id',$rootid)"/>
546                             </xsl:call-template>
547                         </xsl:when>
548                         <xsl:otherwise>
549                             <xsl:call-template name="href.target.with.base.dir">
550                                 <xsl:with-param name="object" select="key('id',$rootid)"/>
551                             </xsl:call-template>
552                         </xsl:otherwise>
553                     </xsl:choose>
554                 </xsl:variable>
555             </xsl:when>
556
557             <xsl:otherwise>
558                 <xsl:variable name="title">
559                     <xsl:if test="$webhelp.autolabel=1">
560                         <xsl:variable name="label.markup">
561                             <xsl:apply-templates select="/*" mode="label.markup"/>
562                         </xsl:variable>
563                         <xsl:if test="normalize-space($label.markup)">
564                             <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
565                         </xsl:if>
566                     </xsl:if>
567                     <xsl:apply-templates select="/*" mode="title.markup"/>
568                 </xsl:variable>
569                 <xsl:variable name="href">
570                     <xsl:choose>
571                         <xsl:when test="$manifest.in.base.dir != 0">
572                             <xsl:call-template name="href.target">
573                                 <xsl:with-param name="object" select="/"/>
574                             </xsl:call-template>
575                         </xsl:when>
576                         <xsl:otherwise>
577                             <xsl:call-template name="href.target.with.base.dir">
578                                 <xsl:with-param name="object" select="/"/>
579                             </xsl:call-template>
580                         </xsl:otherwise>
581                     </xsl:choose>
582                 </xsl:variable>
583
584                 <div>
585                     <div id="leftnavigation" style="padding-top:3px; background-color:white;">
586                         <div id="tabs">
587                             <ul>
588                                 <li>
589                                     <a href="#treeDiv">
590                                         <em>
591                                             <xsl:call-template name="gentext">
592                                                 <xsl:with-param name="key" select="'TableofContents'"/>
593                                             </xsl:call-template>
594                                         </em>
595                                     </a>
596                                 </li>
597                                 <xsl:if test="$webhelp.include.search.tab != 'false'">
598                                     <li>
599                                         <a href="#searchDiv">
600                                             <em>
601                                                 <xsl:call-template name="gentext">
602                                                     <xsl:with-param name="key" select="'Search'"/>
603                                                 </xsl:call-template>
604                                             </em>
605                                         </a>
606                                     </li>
607                                 </xsl:if>
608                             </ul>
609                             <div id="treeDiv">
610                                 <img src="../common/images/loading.gif" alt="loading table of contents..."
611                                      id="tocLoading" style="display:block;"/>
612                                 <div id="ulTreeDiv" style="display:none">
613                                     <ul id="tree" class="filetree">
614                                         <xsl:apply-templates select="/*/*" mode="webhelptoc">
615                                             <xsl:with-param name="currentid" select="$currentid"/>
616                                         </xsl:apply-templates>
617                                     </ul>
618                                 </div>
619
620                             </div>
621                             <xsl:if test="$webhelp.include.search.tab != 'false'">
622                                 <div id="searchDiv">
623                                     <div id="search">
624                                         <form onsubmit="Verifie(ditaSearch_Form);return false"
625                                               name="ditaSearch_Form"
626                                               class="searchForm">
627                                             <fieldset class="searchFieldSet">
628                                                 <legend>
629                                                     <xsl:call-template name="gentext">
630                                                         <xsl:with-param name="key" select="'Search'"/>
631                                                     </xsl:call-template>
632                                                 </legend>
633                                                 <center>
634                                                     <input id="textToSearch" name="textToSearch" type="text"
635                                                            class="searchText"/>
636                                                     <xsl:text disable-output-escaping="yes"> <![CDATA[&nbsp;]]> </xsl:text>
637                                                     <input onclick="Verifie(ditaSearch_Form)" type="button"
638                                                            class="searchButton"
639                                                            value="Go" id="doSearch"/>
640                                                 </center>
641                                             </fieldset>
642                                         </form>
643                                     </div>
644                                     <div id="searchResults">
645                                            <center> </center>
646                                     </div>
647                                 </div>
648                             </xsl:if>
649
650                         </div>
651                     </div>
652                 </div>
653             </xsl:otherwise>
654         </xsl:choose>
655     </xsl:template>
656
657     <xsl:template
658             match="book|part|reference|preface|chapter|bibliography|appendix|article|glossary|section|simplesect|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index"
659             mode="webhelptoc">
660         <xsl:param name="currentid"/>
661         <xsl:variable name="title">
662             <xsl:if test="$webhelp.autolabel=1">
663                 <xsl:variable name="label.markup">
664                     <xsl:apply-templates select="." mode="label.markup"/>
665                 </xsl:variable>
666                 <xsl:if test="normalize-space($label.markup)">
667                     <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
668                 </xsl:if>
669             </xsl:if>
670             <xsl:apply-templates select="." mode="title.markup"/>
671         </xsl:variable>
672
673         <xsl:variable name="href">
674             <xsl:choose>
675                 <xsl:when test="$manifest.in.base.dir != 0">
676                     <xsl:call-template name="href.target"/>
677                 </xsl:when>
678                 <xsl:otherwise>
679                     <xsl:call-template name="href.target.with.base.dir"/>
680                 </xsl:otherwise>
681             </xsl:choose>
682         </xsl:variable>
683
684         <xsl:variable name="id" select="generate-id(.)"/>
685         <!--xsl:message>
686             <xsl: select="name(ancestor-or-self::*) "/>
687         </xsl:message-->
688
689         <xsl:if test="not(self::index) or (self::index and not($generate.index = 0))">
690             <!--li style="white-space: pre; line-height: 0em;"-->
691             <li>
692                 <xsl:if test="$id = $currentid">
693                     <xsl:attribute name="id">webhelp-currentid</xsl:attribute>
694                 </xsl:if>
695                 <span class="file">
696                     <a href="{substring-after($href,concat($webhelp.base.dir,'/content/'))}">
697                         <xsl:value-of select="$title"/>
698                     </a>
699                 </span>
700                 <xsl:if test="part|reference|preface|chapter|bibliography|appendix|article|glossary|section|simplesect|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv">
701                     <ul>
702                         <xsl:apply-templates
703                                 select="part|reference|preface|chapter|bibliography|appendix|article|glossary|section|simplesect|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv"
704                                 mode="webhelptoc">
705                             <xsl:with-param name="currentid" select="$currentid"/>
706                         </xsl:apply-templates>
707                     </ul>
708                 </xsl:if>
709             </li>
710         </xsl:if>
711     </xsl:template>
712
713     <xsl:template match="text()" mode="webhelptoc"/>
714
715     <xsl:template name="user.footer.content">
716         <script type="text/javascript" src="../common/main.js">
717             <xsl:comment></xsl:comment>
718         </script>
719     </xsl:template>
720
721     <xsl:template name="index.html">
722         <xsl:variable name="default.topic">
723             <xsl:choose>
724                 <xsl:when test="$webhelp.default.topic != ''">
725                     <xsl:value-of select="$htmlhelp.default.topic"/>
726                 </xsl:when>
727                 <xsl:when test="$htmlhelp.default.topic != ''">
728                     <xsl:value-of select="$htmlhelp.default.topic"/>
729                 </xsl:when>
730                 <xsl:otherwise>
731                     <xsl:call-template name="make-relative-filename">
732                         <xsl:with-param name="base.dir"/>
733                         <xsl:with-param name="base.name">
734                             <xsl:choose>
735                                 <xsl:when test="$rootid != ''">
736                                     <xsl:apply-templates select="key('id',$rootid)" mode="chunk-filename"/>
737                                 </xsl:when>
738                                 <xsl:otherwise>
739                                     <xsl:apply-templates
740                                             select="*/*[self::preface|self::chapter|self::appendix|self::part][1]"
741                                             mode="chunk-filename"/>
742                                 </xsl:otherwise>
743                             </xsl:choose>
744                         </xsl:with-param>
745                     </xsl:call-template>
746                 </xsl:otherwise>
747             </xsl:choose>
748         </xsl:variable>
749         <xsl:call-template name="write.chunk">
750             <xsl:with-param name="filename">
751                 <!--       <xsl:if test="$manifest.in.base.dir != 0"> -->
752                 <!--         <xsl:value-of select="$base.dir"/> -->
753                 <!--       </xsl:if> -->
754                 <xsl:choose>
755                     <xsl:when test="$webhelp.start.filename">
756                         <xsl:value-of select="concat($webhelp.base.dir,'/',$webhelp.start.filename)"/>
757                     </xsl:when>
758                     <xsl:otherwise>
759                         <xsl:value-of select="'index.html'"/>
760                     </xsl:otherwise>
761                 </xsl:choose>
762             </xsl:with-param>
763             <xsl:with-param name="method" select="'xml'"/>
764             <xsl:with-param name="encoding" select="'utf-8'"/>
765             <xsl:with-param name="indent" select="'yes'"/>
766             <xsl:with-param name="content">
767                 <html>
768                     <head>
769                                     <link rel="shortcut icon" href="favicon.ico"/>
770                         <meta http-equiv="Refresh" content="1; URL=content/{$default.topic}"/>
771                         <title><xsl:value-of select="//title[1]"/>&#160;
772                         </title>
773                     </head>
774                     <body>
775                         If not automatically redirected, click here: <a href="content/ch01.html">content/ch01.html</a>
776                     </body>
777                 </html>
778             </xsl:with-param>
779         </xsl:call-template>
780     </xsl:template>
781
782 </xsl:stylesheet>