• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
4
5   Distributed under the Boost Software License, Version 1.0.
6   (See accompanying file LICENSE_1_0.txt or copy at
7   http://www.boost.org/LICENSE_1_0.txt)
8  -->
9<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10                version="1.0">
11
12<!-- Already included in the main style sheet -->
13<!-- <xsl:import href="relative-href.xsl"/> -->
14
15   <!--
16      boost.defaults:
17        *none    - only use explicitly set parameters
18         Boost   - use standard boost settings, can be overridden
19   -->
20   <xsl:param name = "boost.defaults" select = "'none'"/>
21
22   <!--
23      how to render the Home | Libraries | ... | More contents
24        *none       - do not display ("standalone" mode)
25         horizontal - display in old-Boost style format (default for Boost)
26         vertical   - like the new Getting Started layout
27   -->
28   <xsl:param name = "nav.layout">
29      <xsl:choose>
30         <xsl:when test = "$boost.defaults='Boost'">horizontal</xsl:when>
31         <xsl:otherwise>none</xsl:otherwise>
32      </xsl:choose>
33   </xsl:param>
34   <!--
35      header border layout
36         Boost     - place the old-Boost border around the header
37         Fullbleed - Simple CSS based full bleed header image
38        *none      - do not place a border around the header
39   -->
40   <xsl:param name = "nav.border" select = "'none'" />
41
42   <!--
43      nav.flow:
44         none    - do not display navigation at the header
45         DocBook - display the navigation after the header
46        *Spirit  - display "mini" navigation on the right
47   -->
48   <xsl:param name = "nav.flow" select = "'Spirit'"/>
49
50   <!-- location of the various Boost elements -->
51
52   <xsl:param name = "boost.root"      select = "'../..'"/>
53   <xsl:param name = "boost.website"   select = "'http://www.boost.org'"/>
54   <!-- Logo image location, leave empty for no logo -->
55   <xsl:param name = "boost.image.src">
56      <xsl:if test = "$boost.defaults = 'Boost'">
57         <xsl:value-of select = "concat($boost.root, '/boost.png')"/>
58      </xsl:if>
59   </xsl:param>
60   <xsl:param name = "boost.image.alt">
61      <xsl:if test = "$boost.defaults = 'Boost'">
62         <xsl:value-of select = "'Boost C++ Libraries'"/>
63      </xsl:if>
64   </xsl:param>
65   <xsl:param name = "boost.image.w">
66      <xsl:if test = "$boost.defaults = 'Boost'">
67         <xsl:value-of select = "277"/>
68      </xsl:if>
69   </xsl:param>
70   <xsl:param name = "boost.image.h">
71      <xsl:if test = "$boost.defaults = 'Boost'">
72         <xsl:value-of select = "86"/>
73      </xsl:if>
74   </xsl:param>
75   <xsl:param name = "boost.libraries">
76      <xsl:if test = "$boost.defaults = 'Boost'">
77         <xsl:value-of select = "concat($boost.root, '/libs/libraries.htm')"/>
78      </xsl:if>
79   </xsl:param>
80
81   <!-- header -->
82
83   <xsl:template name = "header.navigation">
84      <xsl:param name = "prev" select = "/foo"/>
85      <xsl:param name = "next" select = "/foo"/>
86      <xsl:param name = "nav.context"/>
87
88      <xsl:variable name = "home" select = "/*[1]"/>
89      <xsl:variable name = "up"   select = "parent::*"/>
90
91      <xsl:choose>
92         <xsl:when test = "$nav.border = 'Fullbleed'">
93            <xsl:if test = "boolean(normalize-space($boost.image.src))">
94               <div class="header-fullbleed">
95                  <img alt="{$boost.image.alt}" width="{$boost.image.w}" height="{$boost.image.h}">
96                     <xsl:attribute name="src">
97                        <xsl:call-template name="href.target.relative">
98                           <xsl:with-param name="target" select="$boost.image.src"/>
99                        </xsl:call-template>
100                     </xsl:attribute>
101                  </img>
102               </div>
103            </xsl:if>
104         </xsl:when>
105         <xsl:when test = "boolean(normalize-space($boost.image.src)) or $nav.layout != 'none'">
106            <table cellpadding = "2" width = "100%"><tr>
107               <xsl:if test = "$nav.border = 'Boost'">
108                  <xsl:attribute name = "class">boost-head</xsl:attribute>
109               </xsl:if>
110
111               <td valign = "top">
112                  <xsl:if test = "$nav.border = 'Boost'">
113                     <xsl:attribute name = "style">background-color: white; width: 50%;</xsl:attribute>
114                  </xsl:if>
115                  <xsl:if test = "boolean(normalize-space($boost.image.src))">
116                     <img alt="{$boost.image.alt}" width="{$boost.image.w}" height="{$boost.image.h}">
117                         <xsl:attribute name="src">
118                             <xsl:call-template name="href.target.relative">
119                                 <xsl:with-param name="target" select="$boost.image.src"/>
120                             </xsl:call-template>
121                         </xsl:attribute>
122                     </img>
123                  </xsl:if>
124               </td><xsl:choose>
125                  <xsl:when test = "$nav.layout = 'horizontal'">
126                     <xsl:call-template name = "header.navdata-horiz"/>
127                  </xsl:when><xsl:when test = "$nav.layout = 'vertical'">
128                     <xsl:call-template name = "header.navdata-vert"/>
129                  </xsl:when>
130               </xsl:choose>
131            </tr></table>
132            <hr/>
133         </xsl:when>
134      </xsl:choose>
135      <xsl:choose>
136         <xsl:when test = "$nav.flow = 'DocBook'">
137            <table width = "100%" class = "navheader">
138               <xsl:call-template name = "navbar.docbook-homeinfo">
139                  <xsl:with-param name = "prev" select = "$prev"/>
140                  <xsl:with-param name = "next" select = "$next"/>
141                  <xsl:with-param name = "nav.context" select = "$nav.context"/>
142               </xsl:call-template>
143               <xsl:call-template name = "navbar.docbook-prevnext">
144                  <xsl:with-param name = "prev" select = "$prev"/>
145                  <xsl:with-param name = "next" select = "$next"/>
146                  <xsl:with-param name = "nav.context" select = "$nav.context"/>
147               </xsl:call-template>
148            </table>
149         </xsl:when><xsl:when test = "$nav.flow = 'Spirit'">
150            <xsl:call-template name = "navbar.spirit">
151               <xsl:with-param name = "prev" select = "$prev"/>
152               <xsl:with-param name = "next" select = "$next"/>
153               <xsl:with-param name = "nav.context" select = "$nav.context"/>
154            </xsl:call-template>
155         </xsl:when>
156      </xsl:choose>
157   </xsl:template>
158
159   <xsl:template name = "header.navdata-horiz">
160      <xsl:variable name="home_link">
161         <xsl:call-template name="href.target.relative">
162            <xsl:with-param name="target" select="concat( $boost.root, '/index.html' )"/>
163         </xsl:call-template>
164      </xsl:variable>
165      <xsl:variable name="libraries_link">
166         <xsl:if test = "boolean($boost.libraries)">
167            <xsl:call-template name="href.target.relative">
168               <xsl:with-param name="target" select="$boost.libraries"/>
169            </xsl:call-template>
170         </xsl:if>
171      </xsl:variable>
172      <xsl:variable name="people_link">
173         <xsl:call-template name="href.target.relative">
174            <xsl:with-param name="target" select="concat( $boost.website, '/users/people.html' )"/>
175         </xsl:call-template>
176      </xsl:variable>
177      <xsl:variable name="faq_link">
178         <xsl:call-template name="href.target.relative">
179            <xsl:with-param name="target" select="concat( $boost.website, '/users/faq.html' )"/>
180         </xsl:call-template>
181      </xsl:variable>
182      <xsl:variable name="more_link">
183         <xsl:call-template name="href.target.relative">
184            <xsl:with-param name="target" select="concat( $boost.root, '/more/index.htm' )"/>
185         </xsl:call-template>
186      </xsl:variable>
187
188      <xsl:choose>
189         <xsl:when test = "$nav.border = 'Boost'">
190            <td align = "center" class = "boost-headtd"><a href = "{$home_link}" class = "boost-headelem">Home</a></td>
191            <xsl:if test = "boolean($libraries_link)">
192              <td align = "center" class = "boost-headtd"><a href = "{$libraries_link}" class = "boost-headelem">Libraries</a></td>
193            </xsl:if>
194            <td align = "center" class = "boost-headtd"><a href = "{$people_link}" class = "boost-headelem">People</a></td>
195            <td align = "center" class = "boost-headtd"><a href = "{$faq_link}" class = "boost-headelem">FAQ</a></td>
196            <td align = "center" class = "boost-headtd"><a href = "{$more_link}" class = "boost-headelem">More</a></td>
197         </xsl:when><xsl:otherwise>
198            <td align = "center"><a href = "{$home_link}">Home</a></td>
199            <td align = "center"><a href = "{$libraries_link}">Libraries</a></td>
200            <td align = "center"><a href = "{$people_link}">People</a></td>
201            <td align = "center"><a href = "{$faq_link}">FAQ</a></td>
202            <td align = "center"><a href = "{$more_link}">More</a></td>
203         </xsl:otherwise>
204      </xsl:choose>
205   </xsl:template>
206
207   <xsl:template name = "header.navdata-vert">
208      <xsl:variable name="home_link">
209         <xsl:call-template name="href.target.relative">
210            <xsl:with-param name="target" select="concat( $boost.root, '/index.html' )"/>
211         </xsl:call-template>
212      </xsl:variable>
213      <xsl:variable name="libraries_link">
214         <xsl:call-template name="href.target.relative">
215            <xsl:with-param name="target" select="$boost.libraries"/>
216         </xsl:call-template>
217      </xsl:variable>
218      <xsl:variable name="people_link">
219         <xsl:call-template name="href.target.relative">
220            <xsl:with-param name="target" select="concat( $boost.website, '/users/people.html' )"/>
221         </xsl:call-template>
222      </xsl:variable>
223      <xsl:variable name="faq_link">
224         <xsl:call-template name="href.target.relative">
225            <xsl:with-param name="target" select="concat( $boost.website, '/users/faq.html' )"/>
226         </xsl:call-template>
227      </xsl:variable>
228      <xsl:variable name="more_link">
229         <xsl:call-template name="href.target.relative">
230            <xsl:with-param name="target" select="concat( $boost.root, '/more/index.htm' )"/>
231         </xsl:call-template>
232      </xsl:variable>
233
234      <td><div>
235         <xsl:if test = "$nav.border != 'Boost'">
236            <xsl:attribute name = "class">boost-toc</xsl:attribute>
237         </xsl:if>
238         <div><a href = "{$home_link}">Home</a></div>
239         <div><a href = "{$libraries_link}">Libraries</a></div>
240         <div><a href = "{$people_link}">People</a></div>
241         <div><a href = "{$faq_link}">FAQ</a></div>
242         <div><a href = "{$more_link}">More</a></div>
243      </div></td>
244   </xsl:template>
245
246
247   <!-- footer -->
248
249   <xsl:template name = "footer.navigation">
250      <xsl:param name = "prev" select = "/foo"/>
251      <xsl:param name = "next" select = "/foo"/>
252      <xsl:param name = "nav.context"/>
253
254      <hr/>
255      <xsl:choose>
256         <xsl:when test = "$nav.flow = 'DocBook'">
257            <table width = "100%" class = "navheader">
258               <xsl:call-template name = "navbar.docbook-prevnext">
259                  <xsl:with-param name = "prev" select = "$prev"/>
260                  <xsl:with-param name = "next" select = "$next"/>
261                  <xsl:with-param name = "nav.context" select = "$nav.context"/>
262               </xsl:call-template>
263               <xsl:call-template name = "navbar.docbook-homeinfo">
264                  <xsl:with-param name = "prev" select = "$prev"/>
265                  <xsl:with-param name = "next" select = "$next"/>
266                  <xsl:with-param name = "nav.context" select = "$nav.context"/>
267               </xsl:call-template>
268            </table>
269         </xsl:when><xsl:when test = "$nav.flow = 'Spirit'">
270            <xsl:call-template name = "navbar.spirit">
271               <xsl:with-param name = "prev" select = "$prev"/>
272               <xsl:with-param name = "next" select = "$next"/>
273               <xsl:with-param name = "nav.context" select = "$nav.context"/>
274            </xsl:call-template>
275         </xsl:when>
276      </xsl:choose>
277   </xsl:template>
278
279   <!-- navbar -->
280
281   <xsl:template name = "navbar.docbook-homeinfo">
282      <xsl:param name = "prev" select = "/foo"/>
283      <xsl:param name = "next" select = "/foo"/>
284      <xsl:param name = "nav.context"/>
285
286      <xsl:variable name = "home" select = "/*[1]"/>
287      <tr>
288         <td align = "left" width = "40%">
289            <xsl:if test = "$navig.showtitles != 0"> <!-- prev:name -->
290               <xsl:apply-templates select = "$prev" mode = "object.title.markup"/>
291            </xsl:if>
292         </td><td align = "center" width = "20%">
293            <!-- home -->
294            <xsl:if test = "$home != . or $nav.context = 'toc'">
295               <a accesskey = "h">
296                  <xsl:attribute name = "href"><xsl:call-template name = "href.target">
297                     <xsl:with-param name = "object" select = "$home"/>
298                  </xsl:call-template></xsl:attribute>
299                  <xsl:call-template name = "navig.content">
300                     <xsl:with-param name = "direction" select = "'home'"/>
301                  </xsl:call-template>
302               </a>
303               <xsl:if test = "$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
304                  <xsl:text>|</xsl:text>
305               </xsl:if>
306            </xsl:if>
307            <xsl:if test = "$chunk.tocs.and.lots != 0 and $nav.context != 'toc'"><a accesskey = "t">
308               <xsl:attribute name = "href">
309                  <xsl:apply-templates select = "/*[1]" mode = "recursive-chunk-filename"/>
310                  <xsl:text>-toc</xsl:text>
311                  <xsl:value-of select = "$html.ext"/>
312               </xsl:attribute>
313               <xsl:call-template name = "gentext">
314                  <xsl:with-param name = "key" select = "'nav-toc'"/>
315               </xsl:call-template>
316            </a></xsl:if>
317         </td><td align = "right" width = "40%">
318            <xsl:if test = "$navig.showtitles != 0"> <!-- next:name -->
319               <xsl:apply-templates select = "$next" mode = "object.title.markup"/>
320            </xsl:if>
321         </td>
322      </tr>
323   </xsl:template>
324
325   <xsl:template name = "navbar.docbook-prevnext">
326      <xsl:param name = "prev" select = "/foo"/>
327      <xsl:param name = "next" select = "/foo"/>
328      <xsl:param name = "nav.context"/>
329
330      <xsl:variable name = "up" select = "parent::*"/>
331      <tr>
332         <td align = "left" width = "40%">
333            <xsl:if test = "count($prev)>0"><a accesskey = "p"> <!-- prev -->
334               <xsl:attribute name = "href"><xsl:call-template name = "href.target">
335                   <xsl:with-param name = "object" select = "$prev"/>
336               </xsl:call-template></xsl:attribute>
337               <xsl:call-template name = "navig.content">
338                  <xsl:with-param name = "direction" select = "'prev'"/>
339               </xsl:call-template>
340            </a></xsl:if>
341         </td><td align = "center" width = "20%">
342            <xsl:if test = "count($up)>0"><a accesskey = "u"> <!-- up -->
343               <xsl:attribute name = "href"><xsl:call-template name = "href.target">
344                  <xsl:with-param name = "object" select = "$up"/>
345               </xsl:call-template></xsl:attribute>
346               <xsl:call-template name = "navig.content">
347                  <xsl:with-param name = "direction" select = "'up'"/>
348               </xsl:call-template>
349            </a></xsl:if>
350         </td><td align = "right" width = "40%">
351            <xsl:if test = "count($next)>0"><a accesskey = "n"> <!-- next -->
352               <xsl:attribute name = "href"><xsl:call-template name = "href.target">
353                  <xsl:with-param name = "object" select = "$next"/>
354               </xsl:call-template></xsl:attribute>
355               <xsl:call-template name = "navig.content">
356                  <xsl:with-param name = "direction" select = "'next'"/>
357               </xsl:call-template>
358            </a></xsl:if>
359         </td>
360      </tr>
361   </xsl:template>
362
363   <xsl:template name = "navbar.spirit">
364      <xsl:param name = "prev" select = "/foo"/>
365      <xsl:param name = "next" select = "/foo"/>
366      <xsl:param name = "nav.context"/>
367
368      <xsl:variable name = "home" select = "/*[1]"/>
369      <xsl:variable name = "up"   select = "parent::*"/>
370
371      <div class = "spirit-nav">
372         <!-- prev -->
373         <xsl:if test = "count($prev)>0"><a accesskey = "p">
374            <xsl:attribute name = "href"><xsl:call-template name = "href.target">
375               <xsl:with-param name = "object" select = "$prev"/>
376            </xsl:call-template></xsl:attribute>
377            <xsl:call-template name = "navig.content">
378               <xsl:with-param name = "direction" select = "'prev'"/>
379            </xsl:call-template>
380         </a></xsl:if>
381         <!-- up -->
382         <xsl:if test = "count($up)>0"><a accesskey = "u">
383            <xsl:attribute name = "href"><xsl:call-template name = "href.target">
384               <xsl:with-param name = "object" select = "$up"/>
385            </xsl:call-template></xsl:attribute>
386            <xsl:call-template name = "navig.content">
387               <xsl:with-param name = "direction" select = "'up'"/>
388            </xsl:call-template>
389         </a></xsl:if>
390         <!-- home -->
391         <xsl:if test = "generate-id($home) != generate-id(.) or $nav.context = 'toc'">
392            <a accesskey = "h">
393               <xsl:attribute name = "href"><xsl:call-template name = "href.target">
394                  <xsl:with-param name = "object" select = "$home"/>
395               </xsl:call-template></xsl:attribute>
396               <xsl:call-template name = "navig.content">
397                  <xsl:with-param name = "direction" select = "'home'"/>
398               </xsl:call-template>
399            </a>
400            <xsl:if test = "$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
401               <xsl:text>|</xsl:text>
402            </xsl:if>
403         </xsl:if>
404         <xsl:if test = "$chunk.tocs.and.lots != 0 and $nav.context != 'toc'"><a accesskey = "t">
405            <xsl:attribute name = "href">
406               <xsl:apply-templates select = "/*[1]" mode = "recursive-chunk-filename"/>
407               <xsl:text>-toc</xsl:text>
408               <xsl:value-of select = "$html.ext"/>
409            </xsl:attribute>
410            <xsl:call-template name = "gentext">
411               <xsl:with-param name = "key" select = "'nav-toc'"/>
412            </xsl:call-template>
413         </a></xsl:if>
414         <!-- next -->
415         <xsl:if test = "count($next)>0"><a accesskey = "n">
416            <xsl:attribute name = "href"><xsl:call-template name = "href.target">
417               <xsl:with-param name = "object" select = "$next"/>
418            </xsl:call-template></xsl:attribute>
419            <xsl:call-template name = "navig.content">
420               <xsl:with-param name = "direction" select = "'next'"/>
421            </xsl:call-template>
422         </a></xsl:if>
423      </div>
424   </xsl:template>
425</xsl:stylesheet>
426