1 <?xml version="1.0" encoding="utf-8"?>
3 Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
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)
9 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"
13 <xsl:param name="html.stylesheet">
15 <xsl:when test = "$boost.defaults = 'Boost'">
16 <xsl:value-of select = "concat($boost.root, '/doc/src/boostbook.css')"/>
24 <xsl:param name="boost.graphics.root">
26 <xsl:when test = "$boost.defaults = 'Boost'">
27 <xsl:value-of select = "concat($boost.root, '/doc/src/images/')"/>
30 <xsl:value-of select = "'images/'"/>
35 <xsl:param name="boost.mathjax" select="0"/>
36 <xsl:param name="boost.mathjax.script"
37 select="'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'"/>
38 <!--See usage below for explanation of this param-->
39 <xsl:param name="boost.noexpand.chapter.toc" select="0"/>
41 <xsl:param name="admon.style"/>
42 <xsl:param name="admon.graphics">1</xsl:param>
43 <xsl:param name="boostbook.verbose" select="0"/>
44 <xsl:param name="navig.graphics" select="1"/>
45 <xsl:param name="navig.graphics.extension" select="'.png'"/>
46 <xsl:param name="chapter.autolabel" select="1"/>
47 <xsl:param name="use.id.as.filename" select="1"/>
48 <xsl:param name="refentry.generate.name" select="0"/>
49 <xsl:param name="refentry.generate.title" select="1"/>
50 <xsl:param name="make.year.ranges" select="1"/>
51 <xsl:param name="generate.manifest" select="1"/>
52 <xsl:param name="generate.section.toc.level" select="3"/>
53 <xsl:param name="doc.standalone">false</xsl:param>
54 <xsl:param name="chunker.output.indent">yes</xsl:param>
55 <xsl:param name="chunker.output.encoding">US-ASCII</xsl:param>
56 <xsl:param name="chunk.quietly" select="not(number($boostbook.verbose))"/>
57 <xsl:param name="toc.max.depth">2</xsl:param>
58 <xsl:param name="callout.graphics.number.limit">15</xsl:param>
59 <xsl:param name = "admon.graphics.path" select="$boost.graphics.root" />
60 <xsl:param name = "navig.graphics.path" select="$boost.graphics.root" />
61 <xsl:param name = "callout.graphics.path"
62 select = "concat($boost.graphics.root, 'callouts/')"/>
65 <xsl:param name="admon.style">
66 <!-- Remove the style. Let the CSS do the styling -->
69 <!-- Always have graphics -->
70 <xsl:param name="admon.graphics" select="1"/>
72 <xsl:param name="generate.toc">
93 <xsl:template name="format.cvs.revision">
94 <xsl:param name="text"/>
96 <!-- Remove the "$Date: " -->
97 <xsl:variable name="text.noprefix"
98 select="substring-after($text, '$Date: ')"/>
100 <!-- Grab the year -->
101 <xsl:variable name="year" select="substring-before($text.noprefix, '/')"/>
102 <xsl:variable name="text.noyear"
103 select="substring-after($text.noprefix, '/')"/>
105 <!-- Grab the month -->
106 <xsl:variable name="month" select="substring-before($text.noyear, '/')"/>
107 <xsl:variable name="text.nomonth"
108 select="substring-after($text.noyear, '/')"/>
110 <!-- Grab the year -->
111 <xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
112 <xsl:variable name="text.noday"
113 select="substring-after($text.nomonth, ' ')"/>
115 <!-- Get the time -->
116 <xsl:variable name="time" select="substring-before($text.noday, ' ')"/>
118 <xsl:variable name="month.name">
120 <xsl:when test="$month=1">January</xsl:when>
121 <xsl:when test="$month=2">February</xsl:when>
122 <xsl:when test="$month=3">March</xsl:when>
123 <xsl:when test="$month=4">April</xsl:when>
124 <xsl:when test="$month=5">May</xsl:when>
125 <xsl:when test="$month=6">June</xsl:when>
126 <xsl:when test="$month=7">July</xsl:when>
127 <xsl:when test="$month=8">August</xsl:when>
128 <xsl:when test="$month=9">September</xsl:when>
129 <xsl:when test="$month=10">October</xsl:when>
130 <xsl:when test="$month=11">November</xsl:when>
131 <xsl:when test="$month=12">December</xsl:when>
135 <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
140 <xsl:template name="format.svn.revision">
141 <xsl:param name="text"/>
143 <!-- Remove the "$Date: " or "$Date:: " -->
144 <xsl:variable name="text.noprefix"
145 select="substring-after($text, ': ')"/>
147 <!-- Grab the year -->
148 <xsl:variable name="year" select="substring-before($text.noprefix, '-')"/>
149 <xsl:variable name="text.noyear"
150 select="substring-after($text.noprefix, '-')"/>
152 <!-- Grab the month -->
153 <xsl:variable name="month" select="substring-before($text.noyear, '-')"/>
154 <xsl:variable name="text.nomonth"
155 select="substring-after($text.noyear, '-')"/>
157 <!-- Grab the year -->
158 <xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
159 <xsl:variable name="text.noday"
160 select="substring-after($text.nomonth, ' ')"/>
162 <!-- Get the time -->
163 <xsl:variable name="time" select="substring-before($text.noday, ' ')"/>
164 <xsl:variable name="text.notime"
165 select="substring-after($text.noday, ' ')"/>
167 <!-- Get the timezone -->
168 <xsl:variable name="timezone" select="substring-before($text.notime, ' ')"/>
170 <xsl:variable name="month.name">
172 <xsl:when test="$month=1">January</xsl:when>
173 <xsl:when test="$month=2">February</xsl:when>
174 <xsl:when test="$month=3">March</xsl:when>
175 <xsl:when test="$month=4">April</xsl:when>
176 <xsl:when test="$month=5">May</xsl:when>
177 <xsl:when test="$month=6">June</xsl:when>
178 <xsl:when test="$month=7">July</xsl:when>
179 <xsl:when test="$month=8">August</xsl:when>
180 <xsl:when test="$month=9">September</xsl:when>
181 <xsl:when test="$month=10">October</xsl:when>
182 <xsl:when test="$month=11">November</xsl:when>
183 <xsl:when test="$month=12">December</xsl:when>
187 <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year)"/>
188 <xsl:if test="$time != ''">
189 <xsl:value-of select="concat(' at ', $time, ' ', $timezone)"/>
193 <!-- Footer Copyright -->
194 <xsl:template match="copyright" mode="boost.footer">
195 <xsl:if test="position() > 1">
198 <xsl:call-template name="gentext">
199 <xsl:with-param name="key" select="'Copyright'"/>
201 <xsl:call-template name="gentext.space"/>
202 <xsl:call-template name="dingbat">
203 <xsl:with-param name="dingbat">copyright</xsl:with-param>
205 <xsl:call-template name="gentext.space"/>
206 <xsl:call-template name="copyright.years">
207 <xsl:with-param name="years" select="year"/>
208 <xsl:with-param name="print.ranges" select="$make.year.ranges"/>
209 <xsl:with-param name="single.year.ranges"
210 select="$make.single.year.ranges"/>
212 <xsl:call-template name="gentext.space"/>
213 <xsl:apply-templates select="holder" mode="titlepage.mode"/>
216 <!-- Footer License -->
217 <xsl:template match="legalnotice" mode="boost.footer">
218 <xsl:apply-templates select="para" mode="titlepage.mode" />
221 <xsl:template name="user.footer.content">
225 <xsl:variable name="revision-nodes"
226 select="ancestor-or-self::*
227 [not (attribute::rev:last-revision='')]"/>
228 <xsl:if test="count($revision-nodes) > 0">
229 <xsl:variable name="revision-node"
230 select="$revision-nodes[last()]"/>
231 <xsl:variable name="revision-text">
233 select="normalize-space($revision-node/attribute::rev:last-revision)"/>
235 <xsl:if test="string-length($revision-text) > 0 and not($revision-text = '$Date$')">
238 <xsl:text>Last revised: </xsl:text>
240 <xsl:when test="not(contains($revision-text, '$Date: ')) and not(contains($revision-text, '$Date:: '))">
241 <xsl:value-of select="$revision-text"/>
243 <xsl:when test="contains($revision-text, '/')">
244 <xsl:call-template name="format.cvs.revision">
245 <xsl:with-param name="text" select="$revision-text"/>
249 <xsl:call-template name="format.svn.revision">
250 <xsl:with-param name="text" select="$revision-text"/>
260 <div class = "copyright-footer">
261 <xsl:apply-templates select="ancestor::*/*/copyright"
262 mode="boost.footer"/>
263 <xsl:apply-templates select="ancestor::*/*/legalnotice"
264 mode="boost.footer"/>
271 <!-- We don't want refentry's to show up in the TOC because they
272 will merely be redundant with the synopsis. -->
273 <xsl:template match="refentry" mode="toc"/>
275 <!-- override the behaviour of some DocBook elements for better
276 rendering facilities -->
278 <xsl:template match = "programlisting[ancestor::informaltable]">
279 <pre class = "table-{name(.)}"><xsl:apply-templates/></pre>
282 <xsl:template match = "refsynopsisdiv">
283 <h2 class = "{name(.)}-title">Synopsis</h2>
284 <div class = "{name(.)}">
285 <xsl:apply-templates/>
289 <xsl:template name="generate.html.title"/>
291 <xsl:template match="*" mode="detect-math">
292 <xsl:variable name="is-chunk">
293 <xsl:call-template name="chunk"/>
295 <xsl:if test="$is-chunk = '0'">
296 <xsl:apply-templates mode="detect-math"/>
300 <xsl:template match="text()" mode="detect-math"/>
302 <xsl:template match="textobject[@role='tex']" mode="detect-math">
303 <xsl:text>1</xsl:text>
306 <xsl:template name="user.head.content">
307 <xsl:if test="$boost.mathjax = 1">
308 <xsl:variable name="has-math">
309 <xsl:apply-templates mode="detect-math" select="*"/>
311 <xsl:if test="string($has-math) != ''">
312 <script type="text/javascript" src="{$boost.mathjax.script}"/>
317 <xsl:template match="inlinemediaobject">
319 <xsl:when test="$boost.mathjax = 1 and textobject[@role='tex']">
320 <xsl:variable name="content" select="string(textobject[@role='tex'])"/>
321 <xsl:variable name="plain-content">
324 <xsl:when test="substring($content, 1, 1) = '$' and
325 substring($content, string-length($content), 1) = '$'">
326 <xsl:value-of select="substring($content, 2, string-length($content) - 2)"/>
329 <xsl:value-of select="$content"/>
333 <script type="math/tex">
334 <xsl:value-of select="$plain-content"/>
346 <!-- ============================================================ -->
348 <xsl:template name="output.html.stylesheets">
349 <xsl:param name="stylesheets" select="''"/>
352 <xsl:when test="contains($stylesheets, ' ')">
353 <link rel="stylesheet">
354 <xsl:attribute name="href">
355 <xsl:call-template name="href.target.relative">
356 <xsl:with-param name="target" select="substring-before($stylesheets, ' ')"/>
359 <xsl:if test="$html.stylesheet.type != ''">
360 <xsl:attribute name="type">
361 <xsl:value-of select="$html.stylesheet.type"/>
365 <xsl:call-template name="output.html.stylesheets">
366 <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
369 <xsl:when test="$stylesheets != ''">
370 <link rel="stylesheet">
371 <xsl:attribute name="href">
372 <xsl:call-template name="href.target.relative">
373 <xsl:with-param name="target" select="$stylesheets"/>
376 <xsl:if test="$html.stylesheet.type != ''">
377 <xsl:attribute name="type">
378 <xsl:value-of select="$html.stylesheet.type"/>
386 <xsl:template match="itemizedlist[@role = 'index']" mode="class.value">
387 <xsl:value-of select="'index'"/>
390 <xsl:template match="sidebar[@role = 'blurb']" mode="class.value">
391 <xsl:value-of select="'blurb'"/>
394 <xsl:template match="preface|chapter|appendix|article" mode="toc">
395 <xsl:param name="toc-context" select="."/>
398 When boost.noexpand.chapter.toc is set to 1, then the TOC for
399 chapters is only one level deep (ie toc.max.depth has no effect)
400 and nested sections within chapters are not shown. TOC's and LOC's
401 at other levels are not effected and respond to toc.max.depth as normal.
404 <xsl:when test="local-name($toc-context) = 'book' and $boost.noexpand.chapter.toc = 1">
405 <xsl:call-template name="subtoc">
406 <xsl:with-param name="toc-context" select="$toc-context"/>
407 <xsl:with-param name="nodes" select="foo"/>
411 <xsl:call-template name="subtoc">
412 <xsl:with-param name="toc-context" select="$toc-context"/>
413 <xsl:with-param name="nodes"
414 select="section|sect1|glossary|bibliography|index
415 |bridgehead[$bridgehead.in.toc != 0]"/>