mc-manual.xml fix new/delete expresions -> expression
[valgrind.git] / docs / lib / vg-html-common.xsl
blob7ffb6824a4d0c67993da78691bc8eb310dfaeee3
1 <?xml version="1.0"?> <!-- -*- sgml -*- -->
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
4 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
5 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk-common.xsl"/>
6 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/manifest.xsl"/>
7 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk-code.xsl"/>
10 <!-- Note [Dec.1 2005]: the tempate 'chunk-code.xsl' in -->
11 <!-- '/usr/share/xml/docbook/stylesheet/nwalsh/1.69.0/html/' -->
12 <!-- has been edited to remove 'article' and 'refentry' -->
13 <!-- so that separate titlepages don't get generated for them -->
14 <!-- Note [Dec.1 2005, JRS]: ../1.69.0/.. was changed to -->
15 <!-- ../current/.. in docs/Makefile.am, since the latter is a -->
16 <!-- symlink to the former, at least on SuSE 10.0. -->
18 <!-- use UTF-8 encoding -->
19 <xsl:output method="html" encoding="UTF-8" indent="yes"/>
21 <!-- set various parameters -->
22 <xsl:param name="use.id.as.filename" select="'1'"/>
23 <xsl:param name="chunker.output.indent" select="'yes'"/>
24 <!-- set chunking at the chapter level only -->
25 <xsl:param name="chunk.section.depth" select="'0'"/>
26 <!-- set toc-levels -->
27 <xsl:param name="generate.toc">
28 set toc,title
29 book toc,title,figure,table,example,equation
30 chapter toc,title
31 section toc
32 sect1 toc
33 sect2 toc
34 sect3 toc
35 sect4 nop
36 sect5 nop
37 qandaset toc
38 qandadiv toc
39 appendix toc,title
40 article/appendix nop
41 article nop
42 preface toc,title
43 reference toc,title
44 </xsl:param>
47 <!-- properties common to html + fo ................................... -->
49 <!-- we like '1.2 Title' -->
50 <xsl:param name="section.autolabel" select="'1'"/>
51 <xsl:param name="section.label.includes.component.label" select="'1'"/>
53 <!-- Do not put 'Chapter' at the start of eg 'Chapter 1. Doing This' -->
54 <xsl:param name="local.l10n.xml" select="document('')"/>
55 <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
56 <l:l10n language="en">
57 <l:context name="title-numbered">
58 <l:template name="chapter" text="%n.&#160;%t"/>
59 </l:context>
60 </l:l10n>
61 </l:i18n>
63 <!-- per Bob Stayton: turn off xml:base processing pro tem -->
64 <!-- should hopefully be fixed in next docbook stylesheets release (1.70) -->
65 <xsl:template match="@fileref">
66 <xsl:value-of select="."/>
67 </xsl:template>
69 <!-- end properties common to html + fo ............................... -->
72 <!-- center everything at the top of a titlepage -->
73 <xsl:attribute-set name="set.titlepage.recto.style">
74 <xsl:attribute name="align">center</xsl:attribute>
75 </xsl:attribute-set>
78 <!-- don`t put an expanded set-level TOC, only book titles -->
79 <xsl:template match="book" mode="toc">
80 <xsl:param name="toc-context" select="."/>
81 <xsl:choose>
82 <xsl:when test="local-name($toc-context) = 'set'">
83 <xsl:call-template name="subtoc">
84 <xsl:with-param name="toc-context" select="$toc-context"/>
85 <xsl:with-param name="nodes" select="foo"/>
86 </xsl:call-template>
87 </xsl:when>
88 <xsl:otherwise>
89 <xsl:call-template name="subtoc">
90 <xsl:with-param name="toc-context" select="$toc-context"/>
91 <xsl:with-param name="nodes" select="part|reference
92 |preface|chapter|appendix
93 |article
94 |bibliography|glossary|index
95 |refentry
96 |bridgehead[$bridgehead.in.toc !=
97 0]"/>
98 </xsl:call-template>
99 </xsl:otherwise>
100 </xsl:choose>
101 </xsl:template>
104 <!-- custom footer -->
105 <xsl:template name="footer.navigation">
106 <xsl:param name="prev" select="/foo"/>
107 <xsl:param name="next" select="/foo"/>
108 <xsl:param name="nav.context"/>
110 <xsl:variable name="home" select="/*[1]"/>
111 <xsl:variable name="up" select="parent::*"/>
113 <xsl:variable name="row1" select="count($prev) &gt; 0
114 or count($up) &gt; 0
115 or count($next) &gt; 0"/>
117 <xsl:variable name="row2" select="($prev != 0)
118 or (generate-id($home) != generate-id(.) or $nav.context = 'toc')
119 or ($chunk.tocs.and.lots != 0 and $nav.context != 'toc')
120 or ($next != 0)"/>
121 <div>
122 <xsl:if test="$row1 or $row2">
123 <br />
124 <table class="nav" width="100%" cellspacing="3" cellpadding="2" border="0" summary="Navigation footer">
125 <xsl:if test="$row1">
126 <tr>
127 <td rowspan="2" width="40%" align="left">
128 <xsl:if test="count($prev)>0">
129 <a accesskey="p">
130 <xsl:attribute name="href">
131 <xsl:call-template name="href.target">
132 <xsl:with-param name="object" select="$prev"/>
133 </xsl:call-template>
134 </xsl:attribute>
135 <xsl:text>&#060;&#060;&#160;</xsl:text>
136 <xsl:apply-templates select="$prev" mode="object.title.markup"/>
137 </a>
138 </xsl:if>
139 <xsl:text>&#160;</xsl:text>
140 </td>
141 <td width="20%" align="center">
142 <xsl:choose>
143 <xsl:when test="count($up)>0">
144 <a accesskey="u">
145 <xsl:attribute name="href">
146 <xsl:call-template name="href.target">
147 <xsl:with-param name="object" select="$up"/>
148 </xsl:call-template>
149 </xsl:attribute>
150 <xsl:call-template name="navig.content">
151 <xsl:with-param name="direction" select="'up'"/>
152 </xsl:call-template>
153 </a>
154 </xsl:when>
155 <xsl:otherwise>&#160;</xsl:otherwise>
156 </xsl:choose>
157 </td>
158 <td rowspan="2" width="40%" align="right">
159 <xsl:text>&#160;</xsl:text>
160 <xsl:if test="count($next)>0">
161 <a accesskey="n">
162 <xsl:attribute name="href">
163 <xsl:call-template name="href.target">
164 <xsl:with-param name="object" select="$next"/>
165 </xsl:call-template>
166 </xsl:attribute>
167 <xsl:apply-templates select="$next" mode="object.title.markup"/>
168 <xsl:text>&#160;&#062;&#062;</xsl:text>
169 </a>
170 </xsl:if>
171 </td>
172 </tr>
173 </xsl:if>
174 <xsl:if test="$row2">
175 <tr>
176 <td width="20%" align="center">
177 <xsl:choose>
178 <xsl:when test="$home != . or $nav.context = 'toc'">
179 <a accesskey="h">
180 <xsl:attribute name="href">
181 <xsl:call-template name="href.target">
182 <xsl:with-param name="object" select="$home"/>
183 </xsl:call-template>
184 </xsl:attribute>
185 <xsl:call-template name="navig.content">
186 <xsl:with-param name="direction" select="'home'"/>
187 </xsl:call-template>
188 </a>
189 <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
190 <xsl:text>&#160;|&#160;</xsl:text>
191 </xsl:if>
192 </xsl:when>
193 <xsl:otherwise>&#160;</xsl:otherwise>
194 </xsl:choose>
195 <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
196 <a accesskey="t">
197 <xsl:attribute name="href">
198 <xsl:apply-templates select="/*[1]" mode="recursive-chunk-filename"/>
199 <xsl:text>-toc</xsl:text>
200 <xsl:value-of select="$html.ext"/>
201 </xsl:attribute>
202 <xsl:call-template name="gentext">
203 <xsl:with-param name="key" select="'nav-toc'"/>
204 </xsl:call-template>
205 </a>
206 </xsl:if>
207 </td>
208 </tr>
209 </xsl:if>
210 </table>
211 </xsl:if>
212 </div>
213 </xsl:template>
216 <!-- qandaset styles -->
217 <!-- these templates have been carefully tweaked to correct the -->
218 <!-- horrible mess that docbook makes of dl/dt/dd tags. Edit with care -->
219 <xsl:template match="qandaset">
220 <xsl:variable name="title" select="(blockinfo/title|title)[1]"/>
221 <xsl:variable name="toc">
222 <xsl:call-template name="dbhtml-attribute">
223 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
224 <xsl:with-param name="attribute" select="'toc'"/>
225 </xsl:call-template>
226 </xsl:variable>
228 <xsl:variable name="toc.params">
229 <xsl:call-template name="find.path.params">
230 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
231 </xsl:call-template>
232 </xsl:variable>
234 <div class="{name(.)}">
235 <xsl:apply-templates select="$title"/>
236 <xsl:if test="(contains($toc.params, 'toc') and $toc != '0') or $toc = '1'">
237 <xsl:call-template name="process.qanda.toc"/>
238 </xsl:if>
239 <xsl:apply-templates select="qandaentry|qandadiv"/>
240 </div>
241 </xsl:template>
244 <xsl:template match="qandadiv">
245 <br/>
246 <table width="100%" summary="Q and A Div" cellpadding="2" cellspacing="2" border="0">
247 <xsl:if test="blockinfo/title|title">
248 <tr class="qandadiv">
249 <td align="left" valign="top" colspan="2">
250 <xsl:call-template name="anchor">
251 <xsl:with-param name="conditional" select="0"/>
252 </xsl:call-template>
253 <xsl:apply-templates select="(blockinfo/title|title)[1]"/>
254 </td>
255 </tr>
256 </xsl:if>
258 <xsl:variable name="toc">
259 <xsl:call-template name="dbhtml-attribute">
260 <xsl:with-param name="pis"
261 select="processing-instruction('dbhtml')"/>
262 <xsl:with-param name="attribute" select="'toc'"/>
263 </xsl:call-template>
264 </xsl:variable>
266 <xsl:variable name="toc.params">
267 <xsl:call-template name="find.path.params">
268 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
269 </xsl:call-template>
270 </xsl:variable>
272 <xsl:if test="(contains($toc.params, 'toc') and $toc != '0') or $toc = '1'">
273 <tr class="toc" colspan="2">
274 <td align="left" valign="top" colspan="2">
275 <xsl:call-template name="process.myqanda.toc"/>
276 </td>
277 </tr>
278 </xsl:if>
279 <xsl:apply-templates select="qandadiv|qandaentry"/>
280 </table>
281 </xsl:template>
284 <!-- put questions in bold -->
285 <xsl:template match="question/para">
286 <b><xsl:apply-templates/></b>
287 </xsl:template>
289 <xsl:template match="question">
290 <xsl:variable name="deflabel">
291 <xsl:choose>
292 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
293 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
294 /@defaultlabel"/>
295 </xsl:when>
296 <xsl:otherwise>
297 <xsl:value-of select="$qanda.defaultlabel"/>
298 </xsl:otherwise>
299 </xsl:choose>
300 </xsl:variable>
301 <tr><td colspan="2"><xsl:text>&#160;</xsl:text></td></tr>
302 <tr class="{name(.)}">
303 <td align="left" valign="top">
304 <xsl:call-template name="anchor">
305 <xsl:with-param name="node" select=".."/>
306 <xsl:with-param name="conditional" select="0"/>
307 </xsl:call-template>
308 <xsl:call-template name="anchor">
309 <xsl:with-param name="conditional" select="0"/>
310 </xsl:call-template>
312 <xsl:apply-templates select="." mode="label.markup"/>
313 <xsl:if test="$deflabel = 'number' and not(label)">
314 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
315 </xsl:if>
316 </b>
317 </td>
318 <td align="left" valign="top">
319 <xsl:choose>
320 <xsl:when test="$deflabel = 'none' and not(label)">
321 <b><xsl:apply-templates select="*[name(.) != 'label']"/></b>
322 </xsl:when>
323 <xsl:otherwise>
324 <xsl:apply-templates select="*[name(.) != 'label']"/>
325 </xsl:otherwise>
326 </xsl:choose>
327 </td>
328 </tr>
329 </xsl:template>
332 <xsl:template name="process.myqanda.toc">
333 <xsl:apply-templates select="qandadiv" mode="qandatoc.mode"/>
334 <xsl:apply-templates select="qandaentry" mode="myqandatoc.mode"/>
335 </xsl:template>
338 <xsl:template name="process.qanda.toc">
339 <xsl:apply-templates select="qandadiv" mode="qandatoc.mode"/>
340 <xsl:apply-templates select="qandaentry" mode="qandatoc.mode"/>
341 </xsl:template>
344 <xsl:template match="qandadiv" mode="qandatoc.mode">
345 <dl>
346 <dt><xsl:apply-templates select="title" mode="qandatoc.mode"/></dt>
347 <xsl:call-template name="process.qanda.toc"/>
348 </dl>
349 </xsl:template>
352 <!-- this one is used at the top of the page -->
353 <xsl:template match="question" mode="qandatoc.mode">
354 <xsl:variable name="firstch" select="(*[name(.)!='label'])[1]"/>
355 <xsl:variable name="deflabel">
356 <xsl:choose>
357 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
358 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
359 /@defaultlabel"/>
360 </xsl:when>
361 <xsl:otherwise>
362 <xsl:value-of select="$qanda.defaultlabel"/>
363 </xsl:otherwise>
364 </xsl:choose>
365 </xsl:variable>
366 <dd>
367 <xsl:apply-templates select="." mode="label.markup"/>
368 <xsl:if test="$deflabel = 'number' and not(label)">
369 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
370 </xsl:if>
371 <xsl:text> </xsl:text>
373 <xsl:attribute name="href">
374 <xsl:call-template name="href.target">
375 <xsl:with-param name="object" select=".."/>
376 </xsl:call-template>
377 </xsl:attribute>
378 <xsl:value-of select="$firstch"/>
379 </a>
380 </dd>
381 </xsl:template>
384 <!-- this one is used within table cells -->
385 <xsl:template match="qandaentry" mode="myqandatoc.mode">
386 <xsl:apply-templates select="question" mode="myqandatoc.mode"/>
387 </xsl:template>
389 <xsl:template match="question" mode="myqandatoc.mode">
390 <xsl:variable name="firstch" select="(*[name(.)!='label'])[1]"/>
391 <xsl:variable name="deflabel">
392 <xsl:choose>
393 <xsl:when test="ancestor-or-self::*[@defaultlabel]">
394 <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
395 /@defaultlabel"/>
396 </xsl:when>
397 <xsl:otherwise>
398 <xsl:value-of select="$qanda.defaultlabel"/>
399 </xsl:otherwise>
400 </xsl:choose>
401 </xsl:variable>
402 <xsl:apply-templates select="." mode="label.markup"/>
403 <xsl:if test="$deflabel = 'number' and not(label)">
404 <xsl:apply-templates select="." mode="intralabel.punctuation"/>
405 </xsl:if>
406 <xsl:text> </xsl:text>
408 <xsl:attribute name="href">
409 <xsl:call-template name="href.target">
410 <xsl:with-param name="object" select=".."/>
411 </xsl:call-template>
412 </xsl:attribute>
413 <xsl:value-of select="$firstch"/>
414 </a>
415 <br />
416 </xsl:template>
419 </xsl:stylesheet>