Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/tools/boostbook/xsl/navbar.xsl @ 29

Last change on this file since 29 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 16.3 KB
Line 
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<xsl:import href="relative-href.xsl"/>
13
14   <!--
15      how to render the Home | Libraries | ... | More contents
16         none       - do not display ("standalone" mode)
17        *horizontal - display in old-Boost style format
18         vertical   - like the new Getting Started layout
19   -->
20   <xsl:param name = "nav.layout" select = "'horizontal'"/>
21
22   <!--
23      header border layout
24         Boost - place the old-Boost border around the header
25        *none  - do not place a border around the header
26   -->
27   <xsl:param name = "nav.border" select = "'none'" />
28
29   <!--
30      nav.flow:
31         none    - do not display navigation at the header
32         DocBook - display the navigation after the header
33        *Spirit  - display "mini" navigation on the right
34   -->
35   <xsl:param name = "nav.flow" select = "'Spirit'"/>
36
37   <!-- location of the various Boost elements -->
38
39   <xsl:param name = "boost.root"      select = "'../..'"/>
40   <xsl:param name = "boost.image.src" 
41              select = "concat($boost.root, '/boost.png')"/>
42   <xsl:param name = "boost.image.alt" select = "'Boost C++ Libraries'"/>
43   <xsl:param name = "boost.image.w"   select = "277"/>
44   <xsl:param name = "boost.image.h"   select = "86"/>
45   <xsl:param name = "boost.libraries" select = "'libraries.html'"/>
46
47   <!-- header -->
48
49   <xsl:template name = "header.navigation">
50      <xsl:param name = "prev" select = "/foo"/>
51      <xsl:param name = "next" select = "/foo"/>
52      <xsl:param name = "nav.context"/>
53
54      <xsl:variable name = "home" select = "/*[1]"/>
55      <xsl:variable name = "up"   select = "parent::*"/>
56
57      <table cellpadding = "2" width = "100%">
58         <xsl:if test = "$nav.border = 'Boost'">
59            <xsl:attribute name = "class">boost-head</xsl:attribute>
60         </xsl:if>
61
62         <td valign = "top">
63            <xsl:if test = "$nav.border = 'Boost'">
64               <xsl:attribute name = "style">background-color: white; width: 50%;</xsl:attribute>
65            </xsl:if>
66            <img alt="{$boost.image.alt}" width="{$boost.image.w}" height="{$boost.image.h}">
67                <xsl:attribute name="src">
68                    <xsl:call-template name="href.target.relative">
69                        <xsl:with-param name="target" select="$boost.image.src"/>
70                    </xsl:call-template>
71                </xsl:attribute>
72            </img>
73         </td><xsl:choose>
74            <xsl:when test = "$nav.layout = 'horizontal'">
75               <xsl:call-template name = "header.navdata-horiz"/>
76            </xsl:when><xsl:when test = "$nav.layout = 'vertical'">
77               <xsl:call-template name = "header.navdata-vert"/>
78            </xsl:when>
79         </xsl:choose>
80      </table>
81      <hr/>
82      <xsl:choose>
83         <xsl:when test = "$nav.flow = 'DocBook'">
84            <table width = "100%" class = "navheader">
85               <xsl:call-template name = "navbar.docbook-homeinfo">
86                  <xsl:with-param name = "prev" select = "$prev"/>
87                  <xsl:with-param name = "next" select = "$next"/>
88                  <xsl:with-param name = "nav.context" select = "$nav.context"/>
89               </xsl:call-template>
90               <xsl:call-template name = "navbar.docbook-prevnext">
91                  <xsl:with-param name = "prev" select = "$prev"/>
92                  <xsl:with-param name = "next" select = "$next"/>
93                  <xsl:with-param name = "nav.context" select = "$nav.context"/>
94               </xsl:call-template>
95            </table>
96         </xsl:when><xsl:when test = "$nav.flow = 'Spirit'">
97            <xsl:call-template name = "navbar.spirit">
98               <xsl:with-param name = "prev" select = "$prev"/>
99               <xsl:with-param name = "next" select = "$next"/>
100               <xsl:with-param name = "nav.context" select = "$nav.context"/>
101            </xsl:call-template>
102         </xsl:when>
103      </xsl:choose>
104   </xsl:template>
105
106   <xsl:template name = "header.navdata-horiz">
107      <xsl:variable name="home_link">
108         <xsl:call-template name="href.target.relative">
109            <xsl:with-param name="target" select="concat( $boost.root, '/index.htm' )"/>
110         </xsl:call-template>
111      </xsl:variable>
112      <xsl:variable name="libraries_link">
113         <xsl:call-template name="href.target.relative">
114            <xsl:with-param name="target" select="$boost.libraries"/>
115         </xsl:call-template>
116      </xsl:variable>
117      <xsl:variable name="people_link">
118         <xsl:call-template name="href.target.relative">
119            <xsl:with-param name="target" select="concat( $boost.root, '/people/people.htm' )"/>
120         </xsl:call-template>
121      </xsl:variable>
122      <xsl:variable name="faq_link">
123         <xsl:call-template name="href.target.relative">
124            <xsl:with-param name="target" select="concat( $boost.root, '/more/faq.htm' )"/>
125         </xsl:call-template>
126      </xsl:variable>
127      <xsl:variable name="more_link">
128         <xsl:call-template name="href.target.relative">
129            <xsl:with-param name="target" select="concat( $boost.root, '/more/index.htm' )"/>
130         </xsl:call-template>
131      </xsl:variable>
132     
133      <xsl:choose>
134         <xsl:when test = "$nav.border = 'Boost'">
135            <td align = "center" class = "boost-headtd"><a href = "{$home_link}" class = "boost-headelem">Home</a></td>
136            <td align = "center" class = "boost-headtd"><a href = "{$libraries_link}" class = "boost-headelem">Libraries</a></td>
137            <td align = "center" class = "boost-headtd"><a href = "{$people_link}" class = "boost-headelem">People</a></td>
138            <td align = "center" class = "boost-headtd"><a href = "{$faq_link}" class = "boost-headelem">FAQ</a></td>
139            <td align = "center" class = "boost-headtd"><a href = "{$more_link}" class = "boost-headelem">More</a></td>
140         </xsl:when><xsl:otherwise>
141            <td align = "center"><a href = "{$home_link}">Home</a></td>
142            <td align = "center"><a href = "{$libraries_link}">Libraries</a></td>
143            <td align = "center"><a href = "{$people_link}">People</a></td>
144            <td align = "center"><a href = "{$faq_link}">FAQ</a></td>
145            <td align = "center"><a href = "{$more_link}">More</a></td>
146         </xsl:otherwise>
147      </xsl:choose>
148   </xsl:template>
149
150   <xsl:template name = "header.navdata-vert">
151      <xsl:variable name="home_link">
152         <xsl:call-template name="href.target.relative">
153            <xsl:with-param name="target" select="concat( $boost.root, '/index.htm' )"/>
154         </xsl:call-template>
155      </xsl:variable>
156      <xsl:variable name="libraries_link">
157         <xsl:call-template name="href.target.relative">
158            <xsl:with-param name="target" select="$boost.libraries"/>
159         </xsl:call-template>
160      </xsl:variable>
161      <xsl:variable name="people_link">
162         <xsl:call-template name="href.target.relative">
163            <xsl:with-param name="target" select="concat( $boost.root, '/people/people.htm' )"/>
164         </xsl:call-template>
165      </xsl:variable>
166      <xsl:variable name="faq_link">
167         <xsl:call-template name="href.target.relative">
168            <xsl:with-param name="target" select="concat( $boost.root, '/more/faq.htm' )"/>
169         </xsl:call-template>
170      </xsl:variable>
171      <xsl:variable name="more_link">
172         <xsl:call-template name="href.target.relative">
173            <xsl:with-param name="target" select="concat( $boost.root, '/more/index.htm' )"/>
174         </xsl:call-template>
175      </xsl:variable>
176
177      <td><div>
178         <xsl:if test = "$nav.border != 'Boost'">
179            <xsl:attribute name = "class">boost-toc</xsl:attribute>
180         </xsl:if>
181         <div><a href = "{$home_link}">Home</a></div>
182         <div><a href = "{$libraries_link}">Libraries</a></div>
183         <div><a href = "{$people_link}">People</a></div>
184         <div><a href = "{$faq_link}">FAQ</a></div>
185         <div><a href = "{$more_link}">More</a></div>
186      </div></td>
187   </xsl:template>
188
189
190   <!-- footer -->
191
192   <xsl:template name = "footer.navigation">
193      <xsl:param name = "prev" select = "/foo"/>
194      <xsl:param name = "next" select = "/foo"/>
195      <xsl:param name = "nav.context"/>
196
197      <hr/>
198      <xsl:choose>
199         <xsl:when test = "$nav.flow = 'DocBook'">
200            <table width = "100%" class = "navheader">
201               <xsl:call-template name = "navbar.docbook-prevnext">
202                  <xsl:with-param name = "prev" select = "$prev"/>
203                  <xsl:with-param name = "next" select = "$next"/>
204                  <xsl:with-param name = "nav.context" select = "$nav.context"/>
205               </xsl:call-template>
206               <xsl:call-template name = "navbar.docbook-homeinfo">
207                  <xsl:with-param name = "prev" select = "$prev"/>
208                  <xsl:with-param name = "next" select = "$next"/>
209                  <xsl:with-param name = "nav.context" select = "$nav.context"/>
210               </xsl:call-template>
211            </table>
212         </xsl:when><xsl:when test = "$nav.flow = 'Spirit'">
213            <xsl:call-template name = "navbar.spirit">
214               <xsl:with-param name = "prev" select = "$prev"/>
215               <xsl:with-param name = "next" select = "$next"/>
216               <xsl:with-param name = "nav.context" select = "$nav.context"/>
217            </xsl:call-template>
218         </xsl:when>
219      </xsl:choose>
220   </xsl:template>
221
222   <!-- navbar -->
223
224   <xsl:template name = "navbar.docbook-homeinfo">
225      <xsl:param name = "prev" select = "/foo"/>
226      <xsl:param name = "next" select = "/foo"/>
227      <xsl:param name = "nav.context"/>
228
229      <xsl:variable name = "home" select = "/*[1]"/>
230      <tr>
231         <td align = "left" width = "40%">
232            <xsl:if test = "$navig.showtitles != 0"> <!-- prev:name -->
233               <xsl:apply-templates select = "$prev" mode = "object.title.markup"/>
234            </xsl:if>
235         </td><td align = "center" width = "20%">
236            <!-- home -->
237            <xsl:if test = "$home != . or $nav.context = 'toc'">
238               <a accesskey = "h">
239                  <xsl:attribute name = "href"><xsl:call-template name = "href.target">
240                     <xsl:with-param name = "object" select = "$home"/>
241                  </xsl:call-template></xsl:attribute>
242                  <xsl:call-template name = "navig.content">
243                     <xsl:with-param name = "direction" select = "'home'"/>
244                  </xsl:call-template>
245               </a>
246               <xsl:if test = "$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
247                  <xsl:text>|</xsl:text>
248               </xsl:if>
249            </xsl:if>
250            <xsl:if test = "$chunk.tocs.and.lots != 0 and $nav.context != 'toc'"><a accesskey = "t">
251               <xsl:attribute name = "href">
252                  <xsl:apply-templates select = "/*[1]" mode = "recursive-chunk-filename"/>
253                  <xsl:text>-toc</xsl:text>
254                  <xsl:value-of select = "$html.ext"/>
255               </xsl:attribute>
256               <xsl:call-template name = "gentext">
257                  <xsl:with-param name = "key" select = "'nav-toc'"/>
258               </xsl:call-template>
259            </a></xsl:if>
260         </td><td align = "right" width = "40%">
261            <xsl:if test = "$navig.showtitles != 0"> <!-- next:name -->
262               <xsl:apply-templates select = "$next" mode = "object.title.markup"/>
263            </xsl:if>
264         </td>
265      </tr>
266   </xsl:template>
267
268   <xsl:template name = "navbar.docbook-prevnext">
269      <xsl:param name = "prev" select = "/foo"/>
270      <xsl:param name = "next" select = "/foo"/>
271      <xsl:param name = "nav.context"/>
272
273      <xsl:variable name = "up" select = "parent::*"/>
274      <tr>
275         <td align = "left" width = "40%">
276            <xsl:if test = "count($prev)>0"><a accesskey = "p"> <!-- prev -->
277               <xsl:attribute name = "href"><xsl:call-template name = "href.target">
278                   <xsl:with-param name = "object" select = "$prev"/>
279               </xsl:call-template></xsl:attribute>
280               <xsl:call-template name = "navig.content">
281                  <xsl:with-param name = "direction" select = "'prev'"/>
282               </xsl:call-template>
283            </a></xsl:if>
284         </td><td align = "center" width = "20%">
285            <xsl:if test = "count($up)>0"><a accesskey = "u"> <!-- up -->
286               <xsl:attribute name = "href"><xsl:call-template name = "href.target">
287                  <xsl:with-param name = "object" select = "$up"/>
288               </xsl:call-template></xsl:attribute>
289               <xsl:call-template name = "navig.content">
290                  <xsl:with-param name = "direction" select = "'up'"/>
291               </xsl:call-template>
292            </a></xsl:if>
293         </td><td align = "right" width = "40%">
294            <xsl:if test = "count($next)>0"><a accesskey = "n"> <!-- next -->
295               <xsl:attribute name = "href"><xsl:call-template name = "href.target">
296                  <xsl:with-param name = "object" select = "$next"/>
297               </xsl:call-template></xsl:attribute>
298               <xsl:call-template name = "navig.content">
299                  <xsl:with-param name = "direction" select = "'next'"/>
300               </xsl:call-template>
301            </a></xsl:if>
302         </td>
303      </tr>
304   </xsl:template>
305
306   <xsl:template name = "navbar.spirit">
307      <xsl:param name = "prev" select = "/foo"/>
308      <xsl:param name = "next" select = "/foo"/>
309      <xsl:param name = "nav.context"/>
310
311      <xsl:variable name = "home" select = "/*[1]"/>
312      <xsl:variable name = "up"   select = "parent::*"/>
313
314      <div class = "spirit-nav">
315         <!-- prev -->
316         <xsl:if test = "count($prev)>0"><a accesskey = "p">
317            <xsl:attribute name = "href"><xsl:call-template name = "href.target">
318               <xsl:with-param name = "object" select = "$prev"/>
319            </xsl:call-template></xsl:attribute>
320            <xsl:call-template name = "navig.content">
321               <xsl:with-param name = "direction" select = "'prev'"/>
322            </xsl:call-template>
323         </a></xsl:if>
324         <!-- up -->
325         <xsl:if test = "count($up)>0"><a accesskey = "u">
326            <xsl:attribute name = "href"><xsl:call-template name = "href.target">
327               <xsl:with-param name = "object" select = "$up"/>
328            </xsl:call-template></xsl:attribute>
329            <xsl:call-template name = "navig.content">
330               <xsl:with-param name = "direction" select = "'up'"/>
331            </xsl:call-template>
332         </a></xsl:if>
333         <!-- home -->
334         <xsl:if test = "$home != . or $nav.context = 'toc'">
335            <a accesskey = "h">
336               <xsl:attribute name = "href"><xsl:call-template name = "href.target">
337                  <xsl:with-param name = "object" select = "$home"/>
338               </xsl:call-template></xsl:attribute>
339               <xsl:call-template name = "navig.content">
340                  <xsl:with-param name = "direction" select = "'home'"/>
341               </xsl:call-template>
342            </a>
343            <xsl:if test = "$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
344               <xsl:text>|</xsl:text>
345            </xsl:if>
346         </xsl:if>
347         <xsl:if test = "$chunk.tocs.and.lots != 0 and $nav.context != 'toc'"><a accesskey = "t">
348            <xsl:attribute name = "href">
349               <xsl:apply-templates select = "/*[1]" mode = "recursive-chunk-filename"/>
350               <xsl:text>-toc</xsl:text>
351               <xsl:value-of select = "$html.ext"/>
352            </xsl:attribute>
353            <xsl:call-template name = "gentext">
354               <xsl:with-param name = "key" select = "'nav-toc'"/>
355            </xsl:call-template>
356         </a></xsl:if>
357         <!-- next -->
358         <xsl:if test = "count($next)>0"><a accesskey = "n">
359            <xsl:attribute name = "href"><xsl:call-template name = "href.target">
360               <xsl:with-param name = "object" select = "$next"/>
361            </xsl:call-template></xsl:attribute>
362            <xsl:call-template name = "navig.content">
363               <xsl:with-param name = "direction" select = "'next'"/>
364            </xsl:call-template>
365         </a></xsl:if>
366      </div>
367   </xsl:template>
368</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.