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 | <xsl:include href="reference.xsl"/> |
---|
12 | |
---|
13 | <xsl:output method="xml" |
---|
14 | doctype-public="-//OASIS//DTD DocBook XML V4.2//EN" |
---|
15 | doctype-system="http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"/> |
---|
16 | |
---|
17 | <!-- The maximum number of columns allowed in preformatted text --> |
---|
18 | <xsl:param name="max-columns" select="78"/> |
---|
19 | |
---|
20 | <!-- The root of the Boost directory --> |
---|
21 | <xsl:param name="boost.root" select="'../..'"/> |
---|
22 | <xsl:param name="boost.header.root" select="$boost.root"/> |
---|
23 | |
---|
24 | <!-- A space-separated list of libraries to include in the |
---|
25 | output. If this list is empty, all libraries will be included. --> |
---|
26 | <xsl:param name="boost.include.libraries" select="''"/> |
---|
27 | |
---|
28 | <!-- A space-separated list of xml elements in the input file for which |
---|
29 | whitespace should be preserved --> |
---|
30 | <xsl:preserve-space elements="*"/> |
---|
31 | |
---|
32 | <xsl:template match="library-reference"> |
---|
33 | <xsl:choose> |
---|
34 | <xsl:when test="ancestor::library-reference"> |
---|
35 | <xsl:apply-templates/> |
---|
36 | </xsl:when> |
---|
37 | <xsl:otherwise> |
---|
38 | <section> |
---|
39 | <xsl:choose> |
---|
40 | <xsl:when test="@id"> |
---|
41 | <xsl:attribute name="id"> |
---|
42 | <xsl:value-of select="@id"/> |
---|
43 | </xsl:attribute> |
---|
44 | </xsl:when> |
---|
45 | <xsl:when test="ancestor::library/attribute::id"> |
---|
46 | <xsl:attribute name="id"> |
---|
47 | <xsl:value-of select="ancestor::library/attribute::id"/> |
---|
48 | <xsl:text>.reference</xsl:text> |
---|
49 | </xsl:attribute> |
---|
50 | </xsl:when> |
---|
51 | </xsl:choose> |
---|
52 | <xsl:if test="not(title)"> |
---|
53 | <title> |
---|
54 | <xsl:text>Reference</xsl:text> |
---|
55 | </title> |
---|
56 | </xsl:if> |
---|
57 | |
---|
58 | <xsl:if test="concept"> |
---|
59 | <section> |
---|
60 | <xsl:choose> |
---|
61 | <xsl:when test="@id"> |
---|
62 | <xsl:attribute name="id"> |
---|
63 | <xsl:value-of select="@id"/> |
---|
64 | <xsl:text>.concepts</xsl:text> |
---|
65 | </xsl:attribute> |
---|
66 | </xsl:when> |
---|
67 | <xsl:when test="ancestor::library/attribute::id"> |
---|
68 | <xsl:attribute name="id"> |
---|
69 | <xsl:value-of select="ancestor::library/attribute::id"/> |
---|
70 | <xsl:text>.concepts</xsl:text> |
---|
71 | </xsl:attribute> |
---|
72 | </xsl:when> |
---|
73 | </xsl:choose> |
---|
74 | |
---|
75 | <title>Concepts</title> |
---|
76 | |
---|
77 | <itemizedlist> |
---|
78 | <xsl:for-each select="concept"> |
---|
79 | <listitem> |
---|
80 | <xsl:call-template name="internal-link"> |
---|
81 | <xsl:with-param name="to"> |
---|
82 | <xsl:call-template name="generate.id"/> |
---|
83 | </xsl:with-param> |
---|
84 | <xsl:with-param name="text" select="@name"/> |
---|
85 | </xsl:call-template> |
---|
86 | </listitem> |
---|
87 | </xsl:for-each> |
---|
88 | </itemizedlist> |
---|
89 | </section> |
---|
90 | </xsl:if> |
---|
91 | |
---|
92 | <xsl:apply-templates/> |
---|
93 | </section> |
---|
94 | </xsl:otherwise> |
---|
95 | </xsl:choose> |
---|
96 | </xsl:template> |
---|
97 | |
---|
98 | <xsl:template match="header"> |
---|
99 | <xsl:if test="*"> |
---|
100 | <section> |
---|
101 | <xsl:attribute name="id"> |
---|
102 | <xsl:call-template name="generate.id"/> |
---|
103 | </xsl:attribute> |
---|
104 | |
---|
105 | <title> |
---|
106 | <xsl:text>Header <</xsl:text> |
---|
107 | <ulink> |
---|
108 | <xsl:attribute name="url"> |
---|
109 | <xsl:value-of select="$boost.header.root"/> |
---|
110 | <xsl:text>/</xsl:text> |
---|
111 | <xsl:value-of select="@name"/> |
---|
112 | </xsl:attribute> |
---|
113 | <xsl:value-of select="@name"/> |
---|
114 | </ulink> |
---|
115 | <xsl:text>></xsl:text> |
---|
116 | </title> |
---|
117 | |
---|
118 | <xsl:apply-templates select="para|section" mode="annotation"/> |
---|
119 | |
---|
120 | <xsl:if test="macro"> |
---|
121 | <xsl:call-template name="synopsis"> |
---|
122 | <xsl:with-param name="text"> |
---|
123 | <xsl:apply-templates mode="synopsis" select="macro"> |
---|
124 | <xsl:with-param name="indentation" select="0"/> |
---|
125 | </xsl:apply-templates> |
---|
126 | </xsl:with-param> |
---|
127 | </xsl:call-template> |
---|
128 | </xsl:if> |
---|
129 | |
---|
130 | <xsl:if test="descendant::class|descendant::struct|descendant::union |
---|
131 | |descendant::function|descendant::free-function-group |
---|
132 | |descendant::overloaded-function|descendant::enum |
---|
133 | |descendant::typedef"> |
---|
134 | <xsl:call-template name="synopsis"> |
---|
135 | <xsl:with-param name="text"> |
---|
136 | <xsl:apply-templates mode="synopsis" |
---|
137 | select="namespace|class|struct|union |
---|
138 | |function|free-function-group |
---|
139 | |overloaded-function|enum |
---|
140 | |typedef"> |
---|
141 | <xsl:with-param name="indentation" select="0"/> |
---|
142 | </xsl:apply-templates> |
---|
143 | </xsl:with-param> |
---|
144 | </xsl:call-template> |
---|
145 | </xsl:if> |
---|
146 | |
---|
147 | <xsl:apply-templates mode="namespace-reference"/> |
---|
148 | </section> |
---|
149 | </xsl:if> |
---|
150 | </xsl:template> |
---|
151 | |
---|
152 | <xsl:template match="header" mode="generate.id"> |
---|
153 | <xsl:text>header.</xsl:text> |
---|
154 | <xsl:value-of select="translate(@name, '/','.')"/> |
---|
155 | </xsl:template> |
---|
156 | |
---|
157 | <xsl:template match="*" mode="passthrough"> |
---|
158 | <xsl:copy-of select="."/> |
---|
159 | </xsl:template> |
---|
160 | |
---|
161 | <!-- Syntax highlighting --> |
---|
162 | <xsl:template name="highlight-keyword"> |
---|
163 | <xsl:param name="keyword"/> |
---|
164 | <xsl:choose> |
---|
165 | <xsl:when test="$boost.syntax.highlight='1'"> |
---|
166 | <emphasis role="bold"><xsl:value-of select="$keyword"/></emphasis> |
---|
167 | </xsl:when> |
---|
168 | <xsl:otherwise> |
---|
169 | <xsl:value-of select="$keyword"/> |
---|
170 | </xsl:otherwise> |
---|
171 | </xsl:choose> |
---|
172 | </xsl:template> |
---|
173 | |
---|
174 | <xsl:template name="highlight-comment"> |
---|
175 | <xsl:param name="text"/> |
---|
176 | <emphasis><xsl:copy-of select="$text"/></emphasis> |
---|
177 | </xsl:template> |
---|
178 | |
---|
179 | <xsl:template name="monospaced"> |
---|
180 | <xsl:param name="text"/> |
---|
181 | <computeroutput><xsl:value-of select="$text"/></computeroutput> |
---|
182 | </xsl:template> |
---|
183 | |
---|
184 | <!-- Linking --> |
---|
185 | <xsl:template name="internal-link"> |
---|
186 | <xsl:param name="to"/> |
---|
187 | <xsl:param name="text"/> |
---|
188 | <xsl:param name="highlight" select="false()"/> |
---|
189 | |
---|
190 | <link linkend="{$to}"> |
---|
191 | <xsl:if test="$highlight"> |
---|
192 | <xsl:call-template name="source-highlight"> |
---|
193 | <xsl:with-param name="text" select="$text"/> |
---|
194 | </xsl:call-template> |
---|
195 | </xsl:if> |
---|
196 | <xsl:if test="not($highlight)"> |
---|
197 | <xsl:value-of select="string($text)"/> |
---|
198 | </xsl:if> |
---|
199 | </link> |
---|
200 | </xsl:template> |
---|
201 | |
---|
202 | <xsl:template name="anchor"> |
---|
203 | <xsl:param name="to"/> |
---|
204 | <xsl:param name="text"/> |
---|
205 | <xsl:param name="highlight" select="false()"/> |
---|
206 | |
---|
207 | <anchor id="{$to}"/> |
---|
208 | <xsl:if test="$highlight"> |
---|
209 | <xsl:call-template name="source-highlight"> |
---|
210 | <xsl:with-param name="text" select="$text"/> |
---|
211 | </xsl:call-template> |
---|
212 | </xsl:if> |
---|
213 | <xsl:if test="not($highlight)"> |
---|
214 | <xsl:value-of select="$text"/> |
---|
215 | </xsl:if> |
---|
216 | </xsl:template> |
---|
217 | |
---|
218 | <xsl:template name="link-or-anchor"> |
---|
219 | <xsl:param name="to"/> |
---|
220 | <xsl:param name="text"/> |
---|
221 | |
---|
222 | <!-- True if we should create an anchor, otherwise we will create |
---|
223 | a link. If you require more control (e.g., with the possibility of |
---|
224 | having no link or anchor), set link-type instead: if present, it |
---|
225 | takes precedence. --> |
---|
226 | <xsl:param name="is-anchor"/> |
---|
227 | |
---|
228 | <!-- 'anchor', 'link', or 'none' --> |
---|
229 | <xsl:param name="link-type"> |
---|
230 | <xsl:choose> |
---|
231 | <xsl:when test="$is-anchor"> |
---|
232 | <xsl:text>anchor</xsl:text> |
---|
233 | </xsl:when> |
---|
234 | <xsl:otherwise> |
---|
235 | <xsl:text>link</xsl:text> |
---|
236 | </xsl:otherwise> |
---|
237 | </xsl:choose> |
---|
238 | </xsl:param> |
---|
239 | |
---|
240 | <xsl:param name="highlight" select="false()"/> |
---|
241 | |
---|
242 | <xsl:choose> |
---|
243 | <xsl:when test="$link-type='anchor'"> |
---|
244 | <xsl:call-template name="anchor"> |
---|
245 | <xsl:with-param name="to" select="$to"/> |
---|
246 | <xsl:with-param name="text" select="$text"/> |
---|
247 | <xsl:with-param name="highlight" select="$highlight"/> |
---|
248 | </xsl:call-template> |
---|
249 | </xsl:when> |
---|
250 | <xsl:when test="$link-type='link'"> |
---|
251 | <xsl:call-template name="internal-link"> |
---|
252 | <xsl:with-param name="to" select="$to"/> |
---|
253 | <xsl:with-param name="text" select="$text"/> |
---|
254 | <xsl:with-param name="highlight" select="$highlight"/> |
---|
255 | </xsl:call-template> |
---|
256 | </xsl:when> |
---|
257 | <xsl:when test="$link-type='none'"> |
---|
258 | <xsl:if test="$highlight"> |
---|
259 | <xsl:call-template name="source-highlight"> |
---|
260 | <xsl:with-param name="text" select="$text"/> |
---|
261 | </xsl:call-template> |
---|
262 | </xsl:if> |
---|
263 | <xsl:if test="not($highlight)"> |
---|
264 | <xsl:value-of select="$text"/> |
---|
265 | </xsl:if> |
---|
266 | </xsl:when> |
---|
267 | <xsl:otherwise> |
---|
268 | <xsl:message> |
---|
269 | Error: XSL template 'link-or-anchor' called with invalid link-type '<xsl:value-of select="$link-type"/>' |
---|
270 | </xsl:message> |
---|
271 | </xsl:otherwise> |
---|
272 | </xsl:choose> |
---|
273 | </xsl:template> |
---|
274 | |
---|
275 | <xsl:template name="separator"/> |
---|
276 | |
---|
277 | <xsl:template name="reference-documentation"> |
---|
278 | <xsl:param name="name"/> |
---|
279 | <xsl:param name="refname"/> |
---|
280 | <xsl:param name="purpose"/> |
---|
281 | <xsl:param name="anchor"/> |
---|
282 | <xsl:param name="synopsis"/> |
---|
283 | <xsl:param name="text"/> |
---|
284 | |
---|
285 | <refentry id="{$anchor}"> |
---|
286 | <refmeta> |
---|
287 | <refentrytitle><xsl:value-of select="$name"/></refentrytitle> |
---|
288 | <manvolnum>3</manvolnum> |
---|
289 | </refmeta> |
---|
290 | <refnamediv> |
---|
291 | <refname><xsl:value-of select="$refname"/></refname> |
---|
292 | <refpurpose> |
---|
293 | <xsl:apply-templates mode="annotation" select="$purpose"/> |
---|
294 | </refpurpose> |
---|
295 | </refnamediv> |
---|
296 | <refsynopsisdiv> |
---|
297 | <synopsis> |
---|
298 | <xsl:copy-of select="$synopsis"/> |
---|
299 | </synopsis> |
---|
300 | </refsynopsisdiv> |
---|
301 | <xsl:if test="not(string($text)='')"> |
---|
302 | <refsect1> |
---|
303 | <title>Description</title> |
---|
304 | <xsl:copy-of select="$text"/> |
---|
305 | </refsect1> |
---|
306 | </xsl:if> |
---|
307 | </refentry> |
---|
308 | </xsl:template> |
---|
309 | |
---|
310 | <xsl:template name="member-documentation"> |
---|
311 | <xsl:param name="name"/> |
---|
312 | <xsl:param name="text"/> |
---|
313 | |
---|
314 | <refsect2> |
---|
315 | <title><xsl:copy-of select="$name"/></title> |
---|
316 | <xsl:copy-of select="$text"/> |
---|
317 | </refsect2> |
---|
318 | </xsl:template> |
---|
319 | |
---|
320 | <xsl:template name="preformatted"> |
---|
321 | <xsl:param name="text"/> |
---|
322 | |
---|
323 | <literallayout class="monospaced"> |
---|
324 | <xsl:copy-of select="$text"/> |
---|
325 | </literallayout> |
---|
326 | </xsl:template> |
---|
327 | |
---|
328 | <xsl:template name="synopsis"> |
---|
329 | <xsl:param name="text"/> |
---|
330 | |
---|
331 | <synopsis> |
---|
332 | <xsl:copy-of select="$text"/> |
---|
333 | </synopsis> |
---|
334 | </xsl:template> |
---|
335 | |
---|
336 | <!-- Fallthrough for DocBook elements --> |
---|
337 | <xsl:template match="*"> |
---|
338 | <xsl:element name="{name(.)}"> |
---|
339 | <xsl:for-each select="./@*"> |
---|
340 | <xsl:choose> |
---|
341 | <xsl:when test="local-name(.)='last-revision'"> |
---|
342 | <xsl:attribute |
---|
343 | name="rev:last-revision" |
---|
344 | namespace="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"> |
---|
345 | <xsl:value-of select="."/> |
---|
346 | </xsl:attribute> |
---|
347 | </xsl:when> |
---|
348 | <xsl:otherwise> |
---|
349 | <xsl:attribute name="{name(.)}"> |
---|
350 | <xsl:value-of select="."/> |
---|
351 | </xsl:attribute> |
---|
352 | </xsl:otherwise> |
---|
353 | </xsl:choose> |
---|
354 | </xsl:for-each> |
---|
355 | <xsl:apply-templates/> |
---|
356 | </xsl:element> |
---|
357 | </xsl:template> |
---|
358 | |
---|
359 | <xsl:template match="code"> |
---|
360 | <computeroutput> |
---|
361 | <xsl:apply-templates mode="annotation"/> |
---|
362 | </computeroutput> |
---|
363 | </xsl:template> |
---|
364 | |
---|
365 | <xsl:template match="bold"> |
---|
366 | <emphasis role="bold"> |
---|
367 | <xsl:apply-templates mode="annotation"/> |
---|
368 | </emphasis> |
---|
369 | </xsl:template> |
---|
370 | |
---|
371 | <xsl:template match="library"> |
---|
372 | <xsl:if test="not(@html-only = 1) and |
---|
373 | ($boost.include.libraries='' or |
---|
374 | contains($boost.include.libraries, @id))"> |
---|
375 | <chapter> |
---|
376 | <xsl:attribute name="id"> |
---|
377 | <xsl:choose> |
---|
378 | <xsl:when test="@id"> |
---|
379 | <xsl:value-of select="@id"/> |
---|
380 | </xsl:when> |
---|
381 | <xsl:otherwise> |
---|
382 | <xsl:call-template name="generate.id"/> |
---|
383 | </xsl:otherwise> |
---|
384 | </xsl:choose> |
---|
385 | </xsl:attribute> |
---|
386 | |
---|
387 | <xsl:if test="@last-revision"> |
---|
388 | <xsl:attribute |
---|
389 | name="rev:last-revision" |
---|
390 | namespace="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"> |
---|
391 | <xsl:value-of select="@last-revision"/> |
---|
392 | </xsl:attribute> |
---|
393 | </xsl:if> |
---|
394 | <xsl:apply-templates/> |
---|
395 | </chapter> |
---|
396 | </xsl:if> |
---|
397 | </xsl:template> |
---|
398 | |
---|
399 | <xsl:template match="chapter"> |
---|
400 | <xsl:if test="$boost.include.libraries=''"> |
---|
401 | <chapter> |
---|
402 | <xsl:for-each select="./@*"> |
---|
403 | <xsl:attribute name="{name(.)}"> |
---|
404 | <xsl:value-of select="."/> |
---|
405 | </xsl:attribute> |
---|
406 | </xsl:for-each> |
---|
407 | |
---|
408 | <xsl:apply-templates/> |
---|
409 | </chapter> |
---|
410 | </xsl:if> |
---|
411 | </xsl:template> |
---|
412 | |
---|
413 | <xsl:template match="boostbook"> |
---|
414 | <book><xsl:apply-templates/></book> |
---|
415 | </xsl:template> |
---|
416 | |
---|
417 | <xsl:template match="programlisting"> |
---|
418 | <programlisting><xsl:apply-templates/></programlisting> |
---|
419 | </xsl:template> |
---|
420 | |
---|
421 | <!-- These DocBook elements have special meaning. Use the annotation mode --> |
---|
422 | <xsl:template match="classname|methodname|functionname|enumname| |
---|
423 | macroname|headername"> |
---|
424 | <computeroutput> |
---|
425 | <xsl:apply-templates select="." mode="annotation"/> |
---|
426 | </computeroutput> |
---|
427 | </xsl:template> |
---|
428 | |
---|
429 | <xsl:template match="libraryname|conceptname"> |
---|
430 | <xsl:apply-templates select="." mode="annotation"/> |
---|
431 | </xsl:template> |
---|
432 | |
---|
433 | <xsl:template match="description"> |
---|
434 | <xsl:apply-templates mode="annotation"/> |
---|
435 | </xsl:template> |
---|
436 | |
---|
437 | <!-- Swallow using-namespace and using-class directives along with |
---|
438 | last-revised elements --> |
---|
439 | <xsl:template match="using-namespace|using-class|last-revised"/> |
---|
440 | |
---|
441 | <!-- If there is no "namespace-reference" mode, forward to |
---|
442 | "reference" mode --> |
---|
443 | <xsl:template match="*" mode="namespace-reference"> |
---|
444 | <xsl:apply-templates select="." mode="reference"/> |
---|
445 | </xsl:template> |
---|
446 | |
---|
447 | <!-- Make the various blocks immediately below a "part" be |
---|
448 | "chapter"-s. Must also take into account turning |
---|
449 | chapters within chpaters into sections. --> |
---|
450 | <xsl:template match="part/part|part/article"> |
---|
451 | <chapter> |
---|
452 | <xsl:for-each select="./@*"> |
---|
453 | <xsl:attribute name="{name(.)}"> |
---|
454 | <xsl:value-of select="."/> |
---|
455 | </xsl:attribute> |
---|
456 | </xsl:for-each> |
---|
457 | <xsl:apply-templates/> |
---|
458 | </chapter> |
---|
459 | </xsl:template> |
---|
460 | <xsl:template match="part/part/partinfo|part/article/articleinfo"> |
---|
461 | <chapterinfo><xsl:apply-templates/></chapterinfo> |
---|
462 | </xsl:template> |
---|
463 | <xsl:template match="part/part/chapter"> |
---|
464 | <section> |
---|
465 | <xsl:for-each select="./@*"> |
---|
466 | <xsl:attribute name="{name(.)}"> |
---|
467 | <xsl:value-of select="."/> |
---|
468 | </xsl:attribute> |
---|
469 | </xsl:for-each> |
---|
470 | <xsl:apply-templates/> |
---|
471 | </section> |
---|
472 | </xsl:template> |
---|
473 | <xsl:template match="part/part/chapter/chapterinfo"> |
---|
474 | <sectioninfo><xsl:apply-templates/></sectioninfo> |
---|
475 | </xsl:template> |
---|
476 | </xsl:stylesheet> |
---|