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