Whamcloud - gitweb
LUDOC-120 presentation: build bits for webhelp.
[doc/manual.git] / webhelp / webhelp-common.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         exclude-result-prefixes="exsl ng db">
8
9     <!-- ********************************************************************
10      $Id$
11      ******************************************************************** 
12
13      This file is part customization layer on top of the XSL DocBook
14      Stylesheet distribution that generates webhelp output.
15
16      ******************************************************************** -->
17
18     <xsl:param name="chunker.output.method">
19         <xsl:choose>
20             <xsl:when test="contains(system-property('xsl:vendor'), 'SAXON 6')">saxon:xhtml</xsl:when>
21             <xsl:otherwise>html</xsl:otherwise>
22         </xsl:choose>
23     </xsl:param>
24
25     <xsl:param name="doc.title">
26       <xsl:call-template name="get.doc.title"/>
27     </xsl:param>
28
29     <!-- Set some reasonable defaults for webhelp output -->
30     <xsl:param name="webhelp.common.dir">common/</xsl:param>
31     <xsl:param name="chunker.output.indent">yes</xsl:param>
32     <xsl:param name="navig.showtitles">0</xsl:param>
33     <xsl:param name="manifest.in.base.dir" select="0"/>
34     <xsl:param name="base.dir" select="concat($webhelp.base.dir,'/')"/>
35     <xsl:param name="suppress.navigation">0</xsl:param>
36     <!-- Generate the end-of-the-book index -->
37     <xsl:param name="generate.index" select="1"/>
38     <xsl:param name="inherit.keywords" select="'0'"/>
39     <xsl:param name="para.propagates.style" select="1"/>
40     <xsl:param name="phrase.propagates.style" select="1"/>
41     <xsl:param name="chunk.first.sections" select="1"/>
42     <xsl:param name="chunk.section.depth" select="3"/>
43     <xsl:param name="use.id.as.filename" select="1"/>
44     <xsl:param name="branding">not set</xsl:param>
45     <xsl:param name="brandname"> </xsl:param>
46
47     <xsl:param name="section.autolabel" select="0"/>
48     <xsl:param name="chapter.autolabel" select="0"/>
49     <xsl:param name="appendix.autolabel" select="0"/>
50     <xsl:param name="qandadiv.autolabel" select="0"/>
51     <xsl:param name="reference.autolabel" select="0"/>
52     <xsl:param name="part.autolabel" select="0"/>    
53     <xsl:param name="section.label.includes.component.label" select="1"/>
54
55     <xsl:param name="generate.section.toc.level" select="5"/>
56     <xsl:param name="component.label.includes.part.label" select="1"/>
57     <xsl:param name="suppress.footer.navigation">0</xsl:param>
58     <xsl:param name="callout.graphics.path"><xsl:value-of select="$webhelp.common.dir"/>images/callouts/</xsl:param>
59     <xsl:param name="callouts.extension">1</xsl:param>
60     <xsl:param name="admon.graphics.path"><xsl:value-of select="$webhelp.common.dir"/>images/admon/</xsl:param>
61     <xsl:param name="admon.graphics" select="0"/>
62     <!--xsl:param name="generate.toc">book toc</xsl:param-->
63
64 <xsl:param name="generate.toc">
65 appendix  toc,title
66 article/appendix  nop
67 article   toc,title
68 book      title,figure,table,example,equation
69 chapter   toc,title
70 part      toc,title
71 preface   toc,title
72 qandadiv  toc
73 qandaset  toc
74 reference toc,title
75 sect1     toc
76 sect2     toc
77 sect3     toc
78 sect4     toc
79 sect5     toc
80 section   toc
81 set       toc,title
82 </xsl:param>
83
84     <!-- Localizations of webhelp specific words. Your contributions for other languages are appreciated.
85         Currently, only around 10 translations needed. -->
86     <!-- Moved to files under 'gentext/locale/', search for WebHelp -->
87     
88     <xsl:template name="user.head.title">
89       <xsl:param name="node" select="."/>
90       <xsl:param name="title">
91         <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
92       </xsl:param>
93       <xsl:param name="document-title">
94         <xsl:apply-templates select="/*" mode="object.title.markup.textonly"/>
95       </xsl:param>
96
97       <title>
98                 <xsl:copy-of select="$title"/> - <xsl:if test="parent::*"> - <xsl:copy-of select="$document-title"/></xsl:if>
99        </title>
100         
101     </xsl:template>
102
103   <xsl:template name="system.head.content">
104   <xsl:param name="node" select="."/>
105 <xsl:text>
106 </xsl:text>
107        <!-- 
108 The meta tag tells the IE rendering engine that it should use the latest, or edge, version of the IE rendering environment;It prevents IE from entring compatibility mode.
109  -->
110        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
111         <xsl:text>
112 </xsl:text>
113         <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
114         <xsl:text>
115 </xsl:text>
116     </xsl:template>
117
118     <!-- HTML <head> section customizations --> 
119     <xsl:template name="user.head.content">
120         <xsl:param name="title">
121                 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
122         </xsl:param>
123          <meta name="Section-title" content="{$title}"/>   
124
125         <!--  <xsl:message>
126             webhelp.tree.cookie.id = <xsl:value-of select="$webhelp.tree.cookie.id"/> +++ <xsl:value-of select="count(//node())"/>
127             $webhelp.indexer.language = <xsl:value-of select="$webhelp.indexer.language"/> +++ <xsl:value-of select="count(//node())"/>
128         </xsl:message>-->
129         <script type="text/javascript">
130             //The id for tree cookie
131             var treeCookieId = "<xsl:value-of select="$webhelp.tree.cookie.id"/>";
132             var language = "<xsl:value-of select="$webhelp.indexer.language"/>";
133             var w = new Object();
134             //Localization
135             txt_filesfound = '<xsl:call-template name="gentext.template">
136                 <xsl:with-param name="name" select="'txt_filesfound'"/>
137                 <xsl:with-param name="context" select="'webhelp'"/>
138                 </xsl:call-template>';
139             txt_enter_at_least_1_char = "<xsl:call-template name="gentext.template">
140                 <xsl:with-param name="name" select="'txt_enter_at_least_1_char'"/>
141                 <xsl:with-param name="context" select="'webhelp'"/>
142                 </xsl:call-template>";
143             txt_browser_not_supported = "<xsl:call-template name="gentext.template">
144                 <xsl:with-param name="name" select="'txt_browser_not_supported'"/>
145                 <xsl:with-param name="context" select="'webhelp'"/>
146                 </xsl:call-template>";
147             txt_please_wait = "<xsl:call-template name="gentext.template">
148                 <xsl:with-param name="name" select="'txt_please_wait'"/>
149                 <xsl:with-param name="context" select="'webhelp'"/>
150                 </xsl:call-template>";
151             txt_results_for = "<xsl:call-template name="gentext.template">
152                 <xsl:with-param name="name" select="'txt_results_for'"/>
153                 <xsl:with-param name="context" select="'webhelp'"/>
154                 </xsl:call-template>";
155         </script>
156
157 <!-- kasunbg: Order is important between the in-html-file css and the linked css files. Some css declarations in jquery-ui-1.8.2.custom.css are over-ridden. 
158      If that's a concern, just remove the additional css contents inside these default jquery css files. I thought of keeping them intact for easier maintenance! -->
159         <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
160         <link rel="stylesheet" type="text/css" href="{$webhelp.common.dir}css/positioning.css"/>
161         <link rel="stylesheet" type="text/css" href="{$webhelp.common.dir}jquery/theme-redmond/jquery-ui-1.8.2.custom.css"/>
162         <link rel="stylesheet" type="text/css" href="{$webhelp.common.dir}jquery/treeview/jquery.treeview.css"/>
163
164         <style type="text/css">
165
166 #noscript{
167     font-weight:bold;
168         background-color: #55AA55;
169     font-weight: bold;
170     height: 25spx;
171     z-index: 3000;
172         top:0px;
173         width:100%;
174         position: relative;
175         border-bottom: solid 5px black;
176         text-align:center;
177         color: white;
178 }
179
180 input {
181     margin-bottom: 5px;
182     margin-top: 2px;
183 }
184 .folder {
185     display: block;
186     height: 22px;
187     padding-left: 20px;
188     background: transparent url(<xsl:value-of select="$webhelp.common.dir"/>jquery/treeview/images/folder.gif) 0 0px no-repeat;
189 }
190 span.contentsTab {
191     padding-left: 20px;
192     background: url(<xsl:value-of select="$webhelp.common.dir"/>images/toc-icon.png) no-repeat 0 center;
193 }
194 span.searchTab {
195     padding-left: 20px;
196     background: url(<xsl:value-of select="$webhelp.common.dir"/>images/search-icon.png) no-repeat 0 center;
197 }
198
199 /* Overide jquery treeview's defaults for ul. */
200 .treeview ul {
201     background-color: transparent;
202     margin-top: 4px;
203 }               
204 #webhelp-currentid {
205     background-color: #D8D8D8 !important;
206 }
207 .treeview .hover { color: black; }
208 .filetree li span a { text-decoration: none; font-size: 12px; color: #517291; }
209
210 /* Override jquery-ui's default css customizations. These are supposed to take precedence over those.*/
211 .ui-widget-content {
212     border: 0px; 
213     background: none; 
214     color: none;     
215 }
216 .ui-widget-header {
217     color: #e9e8e9;
218     border-left: 1px solid #e5e5e5;
219     border-right: 1px solid #e5e5e5;
220     border-bottom: 1px solid #bbc4c5;
221     border-top: 4px solid #e5e5e5;
222     border: medium none;
223     background: #F4F4F4; /* old browsers */
224     background: -moz-linear-gradient(top, #F4F4F4 0%, #E6E4E5 100%); /* firefox */
225     background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#F4F4F4), color-stop(100%,#E6E4E5)); /* webkit */    
226     font-weight: none;
227 }
228 .ui-widget-header a { color: none; }
229 .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { 
230 border: none; background: none; font-weight: none; color: none; }
231 .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: black; text-decoration: none; }
232 .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: none; background: none; font-weight: none; color: none; }
233
234 .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: none; background: none; font-weight: none; color: none; }
235 .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { 
236     color: black; text-decoration: none;        
237     background: #C6C6C6; /* old browsers */
238     background: -moz-linear-gradient(top, #C6C6C6 0%, #D8D8D8 100%); /* firefox */
239     background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#C6C6C6), color-stop(100%,#D8D8D8)); /* webkit */
240     -webkit-border-radius:15px; -moz-border-radius:10px;
241     border: 1px solid #f1f1f1;
242 }    
243 .ui-corner-all { border-radius: 0 0 0 0; }
244
245 .ui-tabs { padding: .2em;}
246 .ui-tabs .ui-tabs-nav li { top: 0px; margin: -2px 0 1px; text-transform: uppercase; font-size: 10.5px;}
247 .ui-tabs .ui-tabs-nav li a { padding: .25em 2em .25em 1em; margin: .5em; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
248        /**
249          *      Basic Layout Theme
250          * 
251          *      This theme uses the default layout class-names for all classes
252          *      Add any 'custom class-names', from options: paneClass, resizerClass, togglerClass
253          */
254
255         .ui-layout-pane { /* all 'panes' */ 
256                 background: #FFF; 
257                 border: 1px solid #BBB; 
258                 padding: 05x; 
259                 overflow: auto;
260         } 
261         
262         .ui-layout-resizer { /* all 'resizer-bars' */ 
263                 background: #DDD; 
264                 top:100px
265         } 
266
267         .ui-layout-toggler { /* all 'toggler-buttons' */ 
268                 background: #AAA; 
269         } 
270     
271        </style>
272         <xsl:comment><xsl:text>[if IE]>
273         &lt;link rel="stylesheet" type="text/css" href="../common/css/ie.css"/>
274         &lt;![endif]</xsl:text></xsl:comment>
275
276         <!-- 
277              browserDetect is an Oxygen addition to warn the user if they're using chrome from the file system.
278              This breaks the Oxygen search highlighting.
279         -->
280         <script type="text/javascript" src="{$webhelp.common.dir}browserDetect.js">
281             <xsl:comment> </xsl:comment>
282         </script>
283         <script type="text/javascript" src="{$webhelp.common.dir}jquery/jquery-1.7.2.min.js">
284             <xsl:comment> </xsl:comment>
285         </script>
286         <script type="text/javascript" src="{$webhelp.common.dir}jquery/jquery.ui.all.js">
287             <xsl:comment> </xsl:comment>
288         </script>
289         <script type="text/javascript" src="{$webhelp.common.dir}jquery/jquery.cookie.js">
290             <xsl:comment> </xsl:comment>
291         </script>
292         <script type="text/javascript" src="{$webhelp.common.dir}jquery/treeview/jquery.treeview.min.js">
293             <xsl:comment> </xsl:comment>
294         </script>
295          <script type="text/javascript" src="{$webhelp.common.dir}jquery/layout/jquery.layout.js">
296             <xsl:comment> </xsl:comment>
297         </script>
298         <xsl:if test="$webhelp.include.search.tab != '0'">
299             <!--Scripts/css stylesheets for Search-->
300             <!-- TODO: Why THREE files? There's absolutely no need for having separate files. 
301                 These should have been identified at the optimization phase! -->
302             <script type="text/javascript" src="search/l10n.js">
303             <xsl:comment/>
304           </script>
305       <script type="text/javascript" src="search/htmlFileInfoList.js">
306               <xsl:comment> </xsl:comment>
307           </script>
308           <script type="text/javascript" src="search/nwSearchFnt.js">
309               <xsl:comment> </xsl:comment>
310           </script>
311
312           <!--
313              NOTE: Stemmer javascript files should be in format <language>_stemmer.js.
314              For example, for English(en), source should be: "search/stemmers/en_stemmer.js"
315              For country codes, see: http://www.uspto.gov/patft/help/helpctry.htm
316           -->
317           <!--<xsl:message><xsl:value-of select="concat('search/stemmers/',$webhelp.indexer.language,'_stemmer.js')"/></xsl:message>-->
318           <script type="text/javascript" src="{concat('search/stemmers/',$webhelp.indexer.language,'_stemmer.js')}">
319               <xsl:comment>//make this scalable to other languages as well.</xsl:comment>
320           </script>
321
322           <!--Index Files:
323               Index is broken in to three equal sized(number of index items) files. This is to help parallel downloading
324               of files to make it faster.
325                 TODO: Generate webhelp index for largest docbook document that can be find, and analyze the file sizes.
326                 IF the file size is still around ~50KB for a given file, we should consider merging these files together. again.        
327           -->
328           <script type="text/javascript" src="search/index-1.js">
329               <xsl:comment> </xsl:comment>
330           </script>
331           <script type="text/javascript" src="search/index-2.js">
332               <xsl:comment> </xsl:comment>
333           </script>
334           <script type="text/javascript" src="search/index-3.js">
335               <xsl:comment> </xsl:comment>
336           </script>
337           <!--End of index files -->
338         </xsl:if>
339         <xsl:call-template name="user.webhelp.head.content"/>
340     </xsl:template>
341
342     <!-- This is for the USERS. Users who want to customize webhelp may over-ride this template to add content to <head>. -->
343     <xsl:template name="user.webhelp.head.content"/>
344
345     <xsl:template name="user.header.navigation">
346         <xsl:param name="prev"/>
347         <xsl:param name="next"/>
348         <xsl:param name="nav.context"/>
349         <xsl:call-template name="webhelpheader">
350             <xsl:with-param name="prev" select="$prev"/>
351             <xsl:with-param name="next" select="$next"/>
352             <xsl:with-param name="nav.context" select="$nav.context"/>
353         </xsl:call-template>
354         <!--xsl:call-template name="webhelptoc"/-->
355
356         <!--testing toc in the content page>
357         <xsl:call-template name="webhelptoctoc"/>
358         <xsl:if test="$webhelp.include.search.tab != '0'">
359             <xsl:call-template name="search"/>
360         </xsl:if-->
361     </xsl:template>
362
363     <xsl:template name="user.header.content">
364         <xsl:comment> <!-- KEEP this code. --> </xsl:comment>
365     </xsl:template>
366
367     <xsl:template name="user.footer.navigation">
368         <xsl:call-template name="webhelptoc">
369                   <xsl:with-param name="currentid" select="generate-id(.)"/>
370              </xsl:call-template>
371     </xsl:template>
372
373   <xsl:template match="/">
374         <xsl:message>language: <xsl:value-of select="$webhelp.indexer.language"/> </xsl:message>
375         <!-- * Get a title for current doc so that we let the user -->
376         <!-- * know what document we are processing at this point. -->
377         <xsl:choose>
378           <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
379           toss the namespace and continue.  Use the docbook5 namespaced
380           stylesheets for DocBook5 if you don't want to use this feature.-->
381           <!-- include extra test for Xalan quirk -->
382           <xsl:when test="$exsl.node.set.available != 0 and 
383                   namespace-uri(/*) = 'http://docbook.org/ns/docbook'">
384                 <xsl:call-template name="log.message">
385                   <xsl:with-param name="level">Note</xsl:with-param>
386                   <xsl:with-param name="source" select="$doc.title"/>
387                   <xsl:with-param name="context-desc">
388                         <xsl:text>namesp. cut</xsl:text>
389                   </xsl:with-param>
390                   <xsl:with-param name="message">
391                         <xsl:text>stripped namespace before processing</xsl:text>
392                   </xsl:with-param>
393                 </xsl:call-template>
394                 <xsl:variable name="nons">
395         <xsl:apply-templates mode="stripNS"/>
396       </xsl:variable>
397                 <!--
398                 <xsl:message>Saving stripped document.</xsl:message>
399                 <xsl:call-template name="write.chunk">
400         <xsl:with-param name="filename" select="'/tmp/stripped.xml'"/>
401         <xsl:with-param name="method" select="'xml'"/>
402         <xsl:with-param name="content">
403                 <xsl:copy-of select="exsl:node-set($nons)"/>
404           </xsl:with-param>
405       </xsl:call-template>
406                 -->
407                 <xsl:apply-templates select="exsl:node-set($nons)"/>
408           </xsl:when>
409           <!-- Can't process unless namespace fixed with exsl node-set()-->
410           <xsl:when test="namespace-uri(/*) = 'http://docbook.org/ns/docbook'">
411             <xsl:message terminate="yes">
412               <xsl:text>Unable to strip the namespace from DB5 document,</xsl:text>
413               <xsl:text> cannot proceed.</xsl:text>
414             </xsl:message>
415           </xsl:when>
416           <xsl:otherwise>
417                 <xsl:choose>
418                   <xsl:when test="$rootid != ''">
419                         <xsl:choose>
420                           <xsl:when test="count(key('id',$rootid)) = 0">
421                                 <xsl:message terminate="yes">
422                                   <xsl:text>ID '</xsl:text>
423                                   <xsl:value-of select="$rootid"/>
424                                   <xsl:text>' not found in document.</xsl:text>
425                                 </xsl:message>
426                           </xsl:when>
427                           <xsl:otherwise>
428                                 <xsl:if test="$collect.xref.targets = 'yes' or                             $collect.xref.targets = 'only'">
429                                   <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
430                                 </xsl:if>
431                                 <xsl:if test="$collect.xref.targets != 'only'">
432                                   <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
433                                   <xsl:if test="$tex.math.in.alt != ''">
434                                         <xsl:apply-templates select="key('id',$rootid)" mode="collect.tex.math"/>
435                                   </xsl:if>
436                                 </xsl:if>
437                           </xsl:otherwise>
438                         </xsl:choose>
439                   </xsl:when>
440                   <xsl:otherwise>
441                         <xsl:if test="$collect.xref.targets = 'yes' or                         $collect.xref.targets = 'only'">
442                           <xsl:apply-templates select="/" mode="collect.targets"/>
443                         </xsl:if>
444                         <xsl:if test="$collect.xref.targets != 'only'">
445                           <xsl:apply-templates select="/" mode="process.root"/>
446                           <xsl:if test="$tex.math.in.alt != ''">
447               <xsl:apply-templates select="/" mode="collect.tex.math"/>
448             </xsl:if>
449           </xsl:if>
450                   </xsl:otherwise>
451                 </xsl:choose>
452           </xsl:otherwise>
453         </xsl:choose>
454         
455
456         <xsl:if test="$collect.xref.targets != 'only'">
457           <xsl:call-template name="l10n.js"/>
458         </xsl:if>
459     </xsl:template>
460
461
462     <!-- The WebHelp output structure. similar to main() method.
463         basic format:
464         <html>
465                 <head> calls-appropriate-template </head>
466                 <body> 
467                        some-generic-content
468                        <div id="content"> 
469                                 All your docbook document content goes here
470                                 ....
471                        </div>
472                        some-other-generic-content-at-footer             
473                 </body>
474         </html>
475     --> 
476     <xsl:template name="chunk-element-content">
477         <xsl:param name="prev"/>
478         <xsl:param name="next"/>
479         <xsl:param name="nav.context"/>
480         <xsl:param name="content">
481             <xsl:apply-imports/>
482         </xsl:param>
483
484         <xsl:call-template name="user.preroot"/>
485
486         <html>
487             <xsl:call-template name="html.head">
488                 <xsl:with-param name="prev" select="$prev"/>
489                 <xsl:with-param name="next" select="$next"/>
490             </xsl:call-template>
491
492             <body>
493                 <noscript>
494                     <div id="noscript">
495
496                         <xsl:call-template name="gentext.template">
497                             <xsl:with-param name="name" select="'txt_browser_not_supported'"/>
498                             <xsl:with-param name="context" select="'webhelp'"/>
499                         </xsl:call-template>
500
501                     </div>
502                 </noscript>
503
504                 <xsl:call-template name="body.attributes"/>
505
506                 <xsl:call-template name="user.header.navigation">
507                     <xsl:with-param name="prev" select="$prev"/>
508                     <xsl:with-param name="next" select="$next"/>
509                     <xsl:with-param name="nav.context" select="$nav.context"/>
510                 </xsl:call-template>
511
512                 <div id="content">
513
514                     <xsl:call-template name="user.header.content"/>
515
516                     <xsl:copy-of select="$content"/>
517
518                     <xsl:call-template name="user.footer.content"/>
519
520                                         <!-- Redundant since the upper navigation bar always visible -->
521                     <xsl:call-template name="footer.navigation">
522                         <xsl:with-param name="prev" select="$prev"/>
523                         <xsl:with-param name="next" select="$next"/>
524                         <xsl:with-param name="nav.context" select="$nav.context"/>
525                     </xsl:call-template>
526
527                     <xsl:call-template name="user.webhelp.content.footer"/>
528                 </div>
529
530                 <xsl:call-template name="user.footer.navigation"/>
531             </body>
532         </html>
533         <xsl:value-of select="$chunk.append"/>
534     </xsl:template>
535
536     <!-- This is for the USERS. Users who want to customize webhelp may over-ride this template to add content to the footer of the content DIV. 
537          i.e. within <div id="content"> ... </div> -->
538     <xsl:template name="user.webhelp.content.footer"/>
539
540     <!-- The Header with the company logo -->
541     <xsl:template name="webhelpheader">
542         <xsl:param name="prev"/>
543         <xsl:param name="next"/>
544         <xsl:param name="nav.context"/>
545
546         <xsl:variable name="home" select="/*[1]"/>
547         <xsl:variable name="up" select="parent::*"/>
548
549         <div id="header">
550             <xsl:call-template name="webhelpheader.logo"/>
551             <!-- Display the page title and the main heading(parent) of it-->
552             <h1>
553               <xsl:apply-templates select="/*[1]" mode="title.markup"/>
554               <br/>
555                 <xsl:choose>
556                     <xsl:when
557                         test="count($up) &gt; 0 and generate-id($up) != generate-id($home)">
558                       <xsl:apply-templates select="$up" mode="object.title.markup"/>
559                     </xsl:when>
560                     <xsl:when test="not(generate-id(.) = generate-id(/*))">
561                       <xsl:apply-templates select="." mode="object.title.markup"/>
562                     </xsl:when>
563                     <xsl:otherwise>&#160;</xsl:otherwise>
564                 </xsl:choose>
565             </h1>
566             <!-- Prev and Next links generation-->
567             <div id="navheader">
568               <xsl:call-template name="user.webhelp.navheader.content"/>
569                 <xsl:comment>
570                     <!-- KEEP this code. In case of neither prev nor next links are available, this will help to
571                         keep the integrity of the DOM tree-->
572                 </xsl:comment>
573                 <!--xsl:with-param name="prev" select="$prev"/>
574                 <xsl:with-param name="next" select="$next"/>
575                 <xsl:with-param name="nav.context" select="$nav.context"/-->
576                 <table class="navLinks">
577                     <tr>
578                         <td>
579                             <a id="showHideButton" href="#" onclick="myLayout.toggle('west')"
580                                 class="pointLeft" tabindex="5" title="Hide TOC tree">Sidebar
581                             </a>
582                         </td>
583                         <xsl:if test="count($prev) &gt; 0
584                             or (count($up) &gt; 0
585                             and generate-id($up) != generate-id($home)
586                             and $navig.showtitles != 0)
587                             or count($next) &gt; 0">
588                             <td>
589                                 <xsl:if test="count($prev)>0">
590                                     <a accesskey="p" class="navLinkPrevious" tabindex="5">
591                                         <xsl:attribute name="href">
592                                             <xsl:call-template name="href.target">
593                                                 <xsl:with-param name="object" select="$prev"/>
594                                             </xsl:call-template>
595                                         </xsl:attribute>
596                                         <xsl:call-template name="navig.content">
597                                             <xsl:with-param name="direction" select="'prev'"/>
598                                         </xsl:call-template>
599                                     </a>
600                                 </xsl:if>
601
602                                 <!-- "Up" link-->
603                                 <xsl:choose>
604                                     <xsl:when test="count($up)&gt;0
605                                               and generate-id($up) != generate-id($home)">
606                                         |
607                                         <a accesskey="u" class="navLinkUp" tabindex="5">
608                                             <xsl:attribute name="href">
609                                                 <xsl:call-template name="href.target">
610                                                     <xsl:with-param name="object" select="$up"/>
611                                                 </xsl:call-template>
612                                             </xsl:attribute>
613                                             <xsl:call-template name="navig.content">
614                                                 <xsl:with-param name="direction" select="'up'"/>
615                                             </xsl:call-template>
616                                         </a>
617                                     </xsl:when>
618                                     <xsl:otherwise>&#160;</xsl:otherwise>
619                                 </xsl:choose>
620                                 
621                                 <xsl:if test="count($next)>0">
622                                     |
623                                     <a accesskey="n" class="navLinkNext" tabindex="5">
624                                         <xsl:attribute name="href">
625                                             <xsl:call-template name="href.target">
626                                                 <xsl:with-param name="object" select="$next"/>
627                                             </xsl:call-template>
628                                         </xsl:attribute>
629                                         <xsl:call-template name="navig.content">
630                                             <xsl:with-param name="direction" select="'next'"/>
631                                         </xsl:call-template>
632                                     </a>
633                                 </xsl:if>
634                             </td>
635                         </xsl:if>
636                     </tr>
637                 </table>
638             </div>
639         </div>
640     </xsl:template>
641
642     <xsl:template name="webhelpheader.logo">
643         <a href="index.html">
644         <img style='margin-right: 2px; height: 59px; padding-right: 25px; padding-top: 8px' align="right"
645             src='{$webhelp.common.dir}images/logo.png' alt="{$brandname} Documentation"/>
646         </a>
647     </xsl:template>
648
649     <xsl:template name="user.webhelp.navheader.content"/>
650
651     <xsl:template name="webhelptoc">
652         <xsl:param name="currentid"/>
653         <xsl:choose>
654             <xsl:when test="$rootid != ''">
655                 <xsl:variable name="title">
656                     <xsl:if test="$webhelp.autolabel=1">
657                         <xsl:variable name="label.markup">
658                             <xsl:apply-templates select="key('id',$rootid)" mode="label.markup"/>
659                         </xsl:variable>
660                         <xsl:if test="normalize-space($label.markup)">
661                             <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
662                         </xsl:if>
663                     </xsl:if>
664                     <xsl:apply-templates select="key('id',$rootid)" mode="titleabbrev.markup"/>
665                 </xsl:variable>
666                 <xsl:variable name="href">
667                     <xsl:choose>
668                         <xsl:when test="$manifest.in.base.dir != 0">
669                             <xsl:call-template name="href.target">
670                                 <xsl:with-param name="object" select="key('id',$rootid)"/>
671                             </xsl:call-template>
672                         </xsl:when>
673                         <xsl:otherwise>
674                             <xsl:call-template name="href.target.with.base.dir">
675                                 <xsl:with-param name="object" select="key('id',$rootid)"/>
676                             </xsl:call-template>
677                         </xsl:otherwise>
678                     </xsl:choose>
679                 </xsl:variable>
680             </xsl:when>
681
682             <xsl:otherwise>
683                 <xsl:variable name="title">
684                     <xsl:if test="$webhelp.autolabel=1">
685                         <xsl:variable name="label.markup">
686                             <xsl:apply-templates select="/*" mode="label.markup"/>
687                         </xsl:variable>
688                         <xsl:if test="normalize-space($label.markup)">
689                             <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
690                         </xsl:if>
691                     </xsl:if>
692                     <xsl:apply-templates select="/*" mode="titleabbrev.markup"/>
693                 </xsl:variable>
694                 <xsl:variable name="href">
695                     <xsl:choose>
696                         <xsl:when test="$manifest.in.base.dir != 0">
697                             <xsl:call-template name="href.target">
698                                 <xsl:with-param name="object" select="/"/>
699                             </xsl:call-template>
700                         </xsl:when>
701                         <xsl:otherwise>
702                             <xsl:call-template name="href.target.with.base.dir">
703                                 <xsl:with-param name="object" select="/"/>
704                             </xsl:call-template>
705                         </xsl:otherwise>
706                     </xsl:choose>
707                 </xsl:variable>
708
709                 <div id="sidebar"> <!--#sidebar id is used for showing and hiding the side bar -->
710                     <div id="leftnavigation" style="padding-top:3px;">
711                         <div id="tabs">
712                             <ul>
713                                 <li>
714                                     <a href="#treeDiv" style="outline:0;" tabindex="1">
715                                         <span class="contentsTab">
716                                             <xsl:call-template name="gentext.template">
717                                                 <xsl:with-param name="name" select="'TableofContents'"/>
718                                                 <xsl:with-param name="context" select="'webhelp'"/>
719                                             </xsl:call-template>
720                                         </span>
721                                     </a>
722                                 </li>
723                                 <xsl:if test="$webhelp.include.search.tab != '0'">
724                                     <li>
725                                         <a href="#searchDiv" style="outline:0;" tabindex="1" onclick="doSearch()">
726                                             <span class="searchTab">
727                                                 <xsl:call-template name="gentext.template">
728                                                     <xsl:with-param name="name" select="'Search'"/>
729                                                     <xsl:with-param name="context" select="'webhelp'"/>
730                                                 </xsl:call-template>
731                                             </span>
732                                         </a>
733                                     </li>
734                                 </xsl:if>
735                                 <xsl:call-template name="user.webhelp.tabs.title"/>
736                             </ul>
737                             <div id="treeDiv">
738                                 <img src="{$webhelp.common.dir}images/loading.gif" alt="loading table of contents..."
739                                      id="tocLoading" style="display:block;"/>
740                                 <div id="ulTreeDiv" style="display:none">
741                                     <ul id="tree" class="filetree">
742                                         <xsl:apply-templates select="/*/*" mode="webhelptoc">
743                                             <xsl:with-param name="currentid" select="$currentid"/>
744                                         </xsl:apply-templates>
745                                     </ul>
746                                 </div>
747
748                             </div>
749                             <xsl:if test="$webhelp.include.search.tab != '0'">
750                                 <div id="searchDiv">
751                                     <div id="search">
752                                         <form onsubmit="Verifie(searchForm);return false"
753                                             name="searchForm" class="searchForm">
754                                             <div>
755                                                 
756 <!--                                                    <xsl:call-template name="gentext.template">
757                                                         <xsl:with-param name="name" select="'Search'"/>
758                                                         <xsl:with-param name="context" select="'webhelp'"/>
759                                                     </xsl:call-template>-->
760                                                 
761                                                 
762                                                     <input id="textToSearch" name="textToSearch" type="search" placeholder="Search"
763                                                            class="searchText" tabindex="1"/>
764                                                     <xsl:text disable-output-escaping="yes"> <![CDATA[&nbsp;]]> </xsl:text>
765                                                     <input onclick="Verifie(searchForm)" type="button"
766                                                            class="searchButton"
767                                                            value="Go" id="doSearch" tabindex="1"/>
768                                                 
769                                             </div>
770                                         </form>
771                                     </div>
772                                     <div id="searchResults">
773                                            <center> </center>
774                                     </div>
775                                     <p class="searchHighlight"><a href="#" onclick="toggleHighlight()">Search Highlighter (On/Off)</a></p>
776                                 </div>
777                             </xsl:if>
778                             <xsl:call-template name="user.webhelp.tabs.content"/>
779                         </div>
780                     </div>
781                 </div>
782             </xsl:otherwise>
783         </xsl:choose>
784     </xsl:template>
785
786     <!-- Hooks for adding customs tabs -->
787     <xsl:template name="user.webhelp.tabs.title"/>
788     <xsl:template name="user.webhelp.tabs.content"/>
789
790     <!-- Generates the webhelp table-of-contents (TOC). -->
791     <xsl:template
792             match="book|part|reference|preface|chapter|bibliography|appendix|article|topic|glossary|section|simplesect|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index|setindex"
793             mode="webhelptoc">
794         <xsl:param name="currentid"/>
795         <xsl:variable name="title">
796             <xsl:if test="$webhelp.autolabel=1">
797                 <xsl:variable name="label.markup">
798                     <xsl:apply-templates select="." mode="label.markup"/>
799                 </xsl:variable>
800                 <xsl:if test="normalize-space($label.markup)">
801                     <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
802                 </xsl:if>
803             </xsl:if>
804             <xsl:apply-templates select="." mode="titleabbrev.markup"/>
805         </xsl:variable>
806
807         <xsl:variable name="href">
808             <xsl:choose>
809                 <xsl:when test="$manifest.in.base.dir != 0">
810                     <xsl:call-template name="href.target"/>
811                 </xsl:when>
812                 <xsl:otherwise>
813                     <xsl:call-template name="href.target.with.base.dir"/>
814                 </xsl:otherwise>
815             </xsl:choose>
816         </xsl:variable>
817
818         <xsl:variable name="id" select="generate-id(.)"/>
819
820         <xsl:if test="not(self::index) or (self::index and not($generate.index = 0))">
821             <!--li style="white-space: pre; line-height: 0em;"-->
822             <li>
823                 <xsl:if test="$id = $currentid">
824                     <xsl:attribute name="id">webhelp-currentid</xsl:attribute>
825                 </xsl:if>
826                 <span class="file">
827                     <a href="{substring-after($href, $base.dir)}"  tabindex="1">
828                         <xsl:value-of select="$title"/>
829                     </a>
830                 </span>
831                 <xsl:if test="part|reference|preface|chapter|bibliography|appendix|article|topic|glossary|section|simplesect|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv">
832                     <ul>
833                         <xsl:apply-templates
834                                 select="part|reference|preface|chapter|bibliography|appendix|article|topic|glossary|section|simplesect|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv"
835                                 mode="webhelptoc">
836                             <xsl:with-param name="currentid" select="$currentid"/>
837                         </xsl:apply-templates>
838                     </ul>
839                 </xsl:if>
840             </li>
841         </xsl:if>
842     </xsl:template>
843
844     <xsl:template match="text()" mode="webhelptoc"/>
845
846     <xsl:template name="user.footer.content">
847         <script type="text/javascript" src="{$webhelp.common.dir}main.js">
848             <xsl:comment> </xsl:comment>
849         </script>
850         <script type="text/javascript" src="{$webhelp.common.dir}splitterInit.js">
851             <xsl:comment> </xsl:comment>
852         </script>
853     </xsl:template>
854  
855     <!-- Generates index.html file at docs/. This is simply a redirection to content/$default.topic --> 
856     <xsl:template name="index.html">
857         <xsl:variable name="default.topic">
858             <xsl:choose>
859                 <xsl:when test="$webhelp.default.topic != ''">
860                     <xsl:value-of select="$webhelp.default.topic"/>
861                 </xsl:when>
862                 <xsl:when test="$htmlhelp.default.topic != ''">
863                     <xsl:value-of select="$htmlhelp.default.topic"/>
864                 </xsl:when>
865                 <xsl:otherwise>
866                     <xsl:call-template name="make-relative-filename">
867                         <xsl:with-param name="base.dir"/>
868                         <xsl:with-param name="base.name">
869                             <xsl:choose>
870                                 <xsl:when test="$rootid != ''">
871                                     <xsl:apply-templates select="key('id',$rootid)" mode="chunk-filename"/>
872                                 </xsl:when>
873                                 <xsl:otherwise>
874                                     <xsl:apply-templates
875                                             select="*/*[self::preface|self::chapter|self::appendix|self::part][1]"
876                                             mode="chunk-filename"/>
877                                 </xsl:otherwise>
878                             </xsl:choose>
879                         </xsl:with-param>
880                     </xsl:call-template>
881                 </xsl:otherwise>
882             </xsl:choose>
883         </xsl:variable>
884         <xsl:call-template name="write.chunk">
885             <xsl:with-param name="filename">
886                 <!--       <xsl:if test="$manifest.in.base.dir != 0"> -->
887                 <!--         <xsl:value-of select="$base.dir"/> -->
888                 <!--       </xsl:if> -->
889                 <xsl:choose>
890                     <xsl:when test="$webhelp.start.filename">
891                         <xsl:value-of select="concat($webhelp.base.dir,'/',$webhelp.start.filename)"/>
892                     </xsl:when>
893                     <xsl:otherwise>
894                         <xsl:value-of select="'index.html'"/>
895                     </xsl:otherwise>
896                 </xsl:choose>
897             </xsl:with-param>
898             <xsl:with-param name="method" select="'xml'"/>
899             <xsl:with-param name="encoding" select="'utf-8'"/>
900             <xsl:with-param name="indent" select="'yes'"/>
901             <xsl:with-param name="content">
902                 <html>
903                     <head>
904                       <link rel="shortcut icon" href="favicon.ico"/>
905                       <meta http-equiv="Refresh" content="1; URL=content/{$default.topic}"/>
906                       <title><xsl:value-of select="//title[1]"/>&#160;</title>
907                     </head>
908                     <body>
909                       If not automatically redirected, click <a href="content/{$default.topic}">content/<xsl:value-of select="$default.topic"/></a>
910                     </body>
911                 </html>
912             </xsl:with-param>
913         </xsl:call-template>
914     </xsl:template>
915
916     <xsl:template name="l10n.js">
917         <xsl:call-template name="write.chunk">
918             <xsl:with-param name="filename">
919               <xsl:value-of select="concat($base.dir,'search/l10n.js')"/>
920             </xsl:with-param>
921             <xsl:with-param name="method" select="'text'"/>
922             <xsl:with-param name="encoding" select="'utf-8'"/>
923             <xsl:with-param name="indent" select="'no'"/>
924             <xsl:with-param name="content">
925               //Resource strings for localization
926               var localeresource = new Object;
927               localeresource["search_no_results"]="<xsl:call-template name="gentext.template">
928                 <xsl:with-param name="name" select="'Your_search_returned_no_results'"/>
929                 <xsl:with-param name="context" select="'webhelp'"/>
930                 </xsl:call-template>";
931             </xsl:with-param>
932         </xsl:call-template>    
933     </xsl:template>
934
935 </xsl:stylesheet> 
936