mkhtml2: skip sections without 'id' atts for refentry nav
[gtk-doc.git] / gtk-doc.xsl
blob3471e6c0ac0918c1c0465f09cb806b414e9edb29
1 <?xml version='1.0'?> <!--*- mode: xml -*-->
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
4 exclude-result-prefixes="l"
5 version="1.0">
7 <!-- import the chunked XSL stylesheet -->
8 <!-- http://www.sagehill.net/docbookxsl/Chunking.html#FastChunking says we should use
9 "chunkfast.xsl", but I can't see a difference. Also it is not clear wheter
10 one should still set "chunk.fast". Again, no meassuable difference. -->
11 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/>
12 <xsl:include href="devhelp2.xsl"/>
13 <xsl:include href="version-greater-or-equal.xsl"/>
15 <xsl:key name="acronym.key" match="glossentry/glossterm" use="."/>
16 <xsl:key name="gallery.key" match="para[@role='gallery']/link" use="@linkend"/>
18 <!-- change some parameters -->
19 <!-- http://docbook.sourceforge.net/release/xsl/current/doc/html/index.html -->
20 <xsl:param name="admon.style"/>
21 <xsl:param name="toc.section.depth">2</xsl:param>
22 <xsl:param name="generate.toc">
23 book toc
24 chapter toc
25 glossary toc
26 index toc
27 part toc
28 reference toc
29 </xsl:param>
30 <xsl:param name="process.empty.source.toc">1</xsl:param>
32 <xsl:param name="chunker.output.encoding" select="'UTF-8'"/>
33 <xsl:param name="chunker.output.indent" select="'yes'"/>
34 <xsl:param name="chunker.output.doctype-public" select="'-//W3C//DTD HTML 4.01 Transitional//EN'"/>
35 <xsl:param name="chunk.fast" select="1"/>
37 <xsl:param name="default.encoding" select="'UTF-8'"/>
38 <xsl:param name="chapter.autolabel" select="0"/>
39 <xsl:param name="use.id.as.filename" select="1"/>
40 <xsl:param name="generate.consistent.ids" select="1"/>
41 <xsl:param name="html.ext" select="'.html'"/>
42 <xsl:param name="refentry.generate.name" select="0"/>
43 <xsl:param name="refentry.generate.title" select="1"/>
44 <!-- don't generate all those link tags (very slow and hardly used)
45 it does not show much effect as we have a user.head.content template
46 <xsl:param name="html.extra.head.links" select="0" />
47 -->
49 <!-- use index filtering (if available) -->
50 <xsl:param name="index.on.role" select="1"/>
52 <!-- display variablelists as tables -->
53 <xsl:param name="variablelist.as.table" select="1"/>
55 <!-- new things to consider
56 <xsl:param name="glossterm.auto.link" select="0"></xsl:param>
57 -->
59 <!-- this gets set on the command line ... -->
60 <xsl:param name="gtkdoc.version" select="''"/>
61 <xsl:param name="gtkdoc.bookname" select="''"/>
63 <!-- Override the typical template to prevent showing titles -->
64 <xsl:param name="admon.textlabel" select="0"/>
66 <!-- ========================================================= -->
68 <!-- l10n is slow, we don't ue it, so we'd like to turn it off
69 this atleast avoid the re-evaluation -->
70 <xsl:template name="l10n.language">en</xsl:template>
72 <xsl:param name="gtkdoc.l10n.xml" select="document('http://docbook.sourceforge.net/release/xsl/current/common/en.xml')"/>
74 <xsl:key name="gtkdoc.gentext.key" match="l:gentext[@key]" use="@key"/>
75 <xsl:key name="gtkdoc.context.key" match="l:context[@name]" use="@name"/>
77 <xsl:template name="gentext">
78 <xsl:param name="key" select="local-name(.)"/>
80 <xsl:for-each select="$gtkdoc.l10n.xml">
81 <xsl:variable name="l10n.gentext" select="key('gtkdoc.gentext.key', $key)"/>
83 <xsl:choose>
84 <xsl:when test="$l10n.gentext">
85 <xsl:value-of select="$l10n.gentext/@text"/>
86 </xsl:when>
87 <xsl:otherwise>
88 <xsl:message>
89 <xsl:text>No "en" localization of "</xsl:text>
90 <xsl:value-of select="$key"/>
91 <xsl:text>" exists.</xsl:text>
92 </xsl:message>
93 </xsl:otherwise>
94 </xsl:choose>
95 </xsl:for-each>
96 </xsl:template>
98 <xsl:template name="gentext.dingbat">
99 <xsl:param name="dingbat">bullet</xsl:param>
101 <xsl:variable name="l10n.dingbat"
102 select="($gtkdoc.l10n.xml/l:l10n/l:dingbat[@key=$dingbat])[1]"/>
104 <xsl:choose>
105 <xsl:when test="$l10n.dingbat">
106 <xsl:value-of select="$l10n.dingbat/@text"/>
107 </xsl:when>
108 <xsl:otherwise>
109 <xsl:message>
110 <xsl:text>No "en" localization of dingbat </xsl:text>
111 <xsl:value-of select="$dingbat"/>
112 <xsl:text> exists; using "en".</xsl:text>
113 </xsl:message>
114 </xsl:otherwise>
115 </xsl:choose>
116 </xsl:template>
118 <xsl:template name="gentext.template">
119 <xsl:param name="context" select="'default'"/>
120 <xsl:param name="name" select="'default'"/>
121 <xsl:param name="origname" select="$name"/>
123 <!-- cut leading / if any to avoid one recursion -->
124 <xsl:variable name="rname">
125 <xsl:choose>
126 <xsl:when test="starts-with($name, '/')">
127 <xsl:value-of select="substring-after($name, '/')"/>
128 </xsl:when>
129 <xsl:otherwise>
130 <xsl:value-of select="$name"/>
131 </xsl:otherwise>
132 </xsl:choose>
133 </xsl:variable>
135 <!-- this is called with context="title|title-numbered|title-unnumbered>
136 <xsl:message>
137 <xsl:text>context:</xsl:text><xsl:value-of select="$context"/>
138 <xsl:text>;name:</xsl:text><xsl:value-of select="$rname"/>
139 <xsl:text>;origname:</xsl:text><xsl:value-of select="$origname"/>
140 </xsl:message>
142 see html/html.xsl:<xsl:template match="*" mode="html.title.attribute">
145 <xsl:for-each select="$gtkdoc.l10n.xml">
146 <xsl:variable name="context.node" select="key('gtkdoc.context.key', $context)"/>
147 <xsl:variable name="template.node"
148 select="($context.node/l:template[@name=$rname])[1]"/>
150 <xsl:choose>
151 <xsl:when test="$template.node/@text">
152 <xsl:value-of select="$template.node/@text"/>
153 <!-- debug
154 <xsl:message>
155 <xsl:text>=</xsl:text><xsl:value-of select="$template.node/@text"/>
156 </xsl:message>
158 </xsl:when>
159 <xsl:otherwise>
160 <xsl:choose>
161 <xsl:when test="contains($rname, '/')">
162 <xsl:call-template name="gentext.template">
163 <xsl:with-param name="context" select="$context"/>
164 <xsl:with-param name="name" select="substring-after($rname, '/')"/>
165 <xsl:with-param name="origname" select="$origname"/>
166 </xsl:call-template>
167 </xsl:when>
168 </xsl:choose>
169 </xsl:otherwise>
170 </xsl:choose>
171 </xsl:for-each>
172 </xsl:template>
174 <!-- silently test whether a gentext template exists -->
175 <xsl:template name="gentext.template.exists">
176 <xsl:param name="context" select="'default'"/>
177 <xsl:param name="name" select="'default'"/>
178 <xsl:param name="origname" select="$name"/>
180 <xsl:variable name="template">
181 <xsl:call-template name="gentext.template">
182 <xsl:with-param name="context" select="$context"/>
183 <xsl:with-param name="name" select="$name"/>
184 <xsl:with-param name="origname" select="$origname"/>
185 </xsl:call-template>
186 </xsl:variable>
188 <xsl:choose>
189 <xsl:when test="string-length($template) != 0">1</xsl:when>
190 <xsl:otherwise>0</xsl:otherwise>
191 </xsl:choose>
192 </xsl:template>
194 <!-- shortcut version -->
195 <!-- @bug: https://bugzilla.gnome.org/show_bug.cgi?id=617478 -->
196 <xsl:template name="generate.html.title"/>
197 <!--xsl:template name="generate.html.title">
198 <xsl:variable name="has.title.markup">
199 <xsl:apply-templates select="." mode="title.markup">
200 <xsl:with-param name="verbose" select="0"/>
201 </xsl:apply-templates>
202 </xsl:variable>
203 <xsl:if test="$has.title.markup != '???TITLE???'">
204 <xsl:variable name="gentext.title">
205 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
206 </xsl:variable>
207 <xsl:choose>
208 <xsl:when test="string-length($gentext.title) != 0">
209 <xsl:attribute name="title">
210 <xsl:value-of select="$gentext.title"/>
211 </xsl:attribute>
212 </xsl:when>
213 <xsl:when test="alt">
214 <xsl:attribute name="title">
215 <xsl:value-of select="normalize-space(alt)"/>
216 </xsl:attribute>
217 </xsl:when>
218 </xsl:choose>
219 </xsl:if>
220 </xsl:template-->
222 <!-- Generate a title attribute for the context node (e.g. links) -->
223 <xsl:template match="*" mode="html.title.attribute">
224 <xsl:variable name="has.title.markup">
225 <xsl:apply-templates select="." mode="title.markup">
226 <xsl:with-param name="verbose" select="0"/>
227 </xsl:apply-templates>
228 </xsl:variable>
229 <xsl:if test="$has.title.markup != '???TITLE???'">
230 <xsl:variable name="is.title">
231 <xsl:call-template name="gentext.template.exists">
232 <xsl:with-param name="context" select="'title'"/>
233 <xsl:with-param name="name" select="local-name(.)"/>
234 <xsl:with-param name="lang">
235 <xsl:call-template name="l10n.language"/>
236 </xsl:with-param>
237 </xsl:call-template>
238 </xsl:variable>
240 <xsl:variable name="is.title-numbered">
241 <xsl:if test="$is.title = 0">
242 <xsl:call-template name="gentext.template.exists">
243 <xsl:with-param name="context" select="'title-numbered'"/>
244 <xsl:with-param name="name" select="local-name(.)"/>
245 <xsl:with-param name="lang">
246 <xsl:call-template name="l10n.language"/>
247 </xsl:with-param>
248 </xsl:call-template>
249 </xsl:if>
250 </xsl:variable>
252 <xsl:variable name="is.title-unnumbered">
253 <xsl:if test="$is.title = 0 and $is.title-numbered = 0">
254 <xsl:call-template name="gentext.template.exists">
255 <xsl:with-param name="context" select="'title-unnumbered'"/>
256 <xsl:with-param name="name" select="local-name(.)"/>
257 <xsl:with-param name="lang">
258 <xsl:call-template name="l10n.language"/>
259 </xsl:with-param>
260 </xsl:call-template>
261 </xsl:if>
262 </xsl:variable>
264 <xsl:variable name="gentext.title">
265 <xsl:if test="$is.title != 0 or
266 $is.title-numbered != 0 or
267 $is.title-unnumbered != 0">
268 <xsl:apply-templates select="."
269 mode="object.title.markup.textonly"/>
270 </xsl:if>
271 </xsl:variable>
273 <xsl:choose>
274 <xsl:when test="string-length($gentext.title) != 0">
275 <xsl:attribute name="title">
276 <xsl:value-of select="$gentext.title"/>
277 </xsl:attribute>
278 </xsl:when>
279 <xsl:when test="alt">
280 <xsl:attribute name="title">
281 <xsl:value-of select="normalize-space(alt)"/>
282 </xsl:attribute>
283 </xsl:when>
284 </xsl:choose>
285 </xsl:if>
286 </xsl:template>
291 <!-- ========================================================= -->
292 <!-- template to create the index.sgml anchor index -->
294 <xsl:template match="book|article">
295 <xsl:variable name="tooldver">
296 <xsl:call-template name="version-greater-or-equal">
297 <xsl:with-param name="ver1" select="$VERSION" />
298 <xsl:with-param name="ver2">1.36</xsl:with-param>
299 </xsl:call-template>
300 </xsl:variable>
301 <xsl:if test="$tooldver = 0">
302 <xsl:message terminate="yes">
303 FATAL-ERROR: You need the DocBook XSL Stylesheets version 1.36 or higher
304 to build the documentation.
305 Get a newer version at http://docbook.sourceforge.net/projects/xsl/
306 </xsl:message>
307 </xsl:if>
308 <xsl:apply-imports/>
310 <!-- generate $book.devhelp2 -->
311 <xsl:call-template name="generate.devhelp2"/>
312 </xsl:template>
314 <!-- ========================================================= -->
315 <!-- template to output gtkdoclink elements for the unknown targets -->
317 <xsl:template match="link">
318 <xsl:choose>
319 <xsl:when test="id(@linkend)">
320 <xsl:apply-imports/>
321 </xsl:when>
322 <xsl:otherwise>
323 <GTKDOCLINK HREF="{@linkend}">
324 <xsl:apply-templates/>
325 </GTKDOCLINK>
326 </xsl:otherwise>
327 </xsl:choose>
328 </xsl:template>
330 <!-- ========================================================= -->
331 <!-- Below are the visual portions of the stylesheet. They provide
332 the normal gtk-doc output style. -->
334 <xsl:param name="shade.verbatim" select="0"/>
335 <xsl:param name="refentry.separator" select="0"/>
337 <xsl:template match="refsect2">
338 <xsl:if test="preceding-sibling::refsect2">
339 <hr/>
340 </xsl:if>
341 <xsl:apply-imports/>
342 </xsl:template>
344 <xsl:template name="user.head.title">
345 <xsl:param name="node" select="."/>
346 <xsl:param name="title"/>
347 <xsl:variable name="home" select="/*[1]"/>
348 <title>
349 <xsl:copy-of select="$title"/>: <xsl:apply-templates select="$home" mode="object.title.markup"/>
350 </title>
351 </xsl:template>
353 <xsl:template name="user.head.content">
354 <xsl:if test="$gtkdoc.version">
355 <meta name="generator" content="GTK-Doc V{$gtkdoc.version} (XML mode)"/>
356 </xsl:if>
357 <link rel="stylesheet" href="style.css" type="text/css"/>
358 </xsl:template>
360 <xsl:template name="user.footer.content">
361 <div class="footer">
362 <hr />
363 <xsl:choose>
364 <xsl:when test="$gtkdoc.version">
365 <xsl:text>Generated by GTK-Doc V</xsl:text><xsl:copy-of select="$gtkdoc.version" />
366 </xsl:when>
367 <xsl:otherwise>
368 <xsl:text>Generated by GTK-Doc</xsl:text>
369 </xsl:otherwise>
370 </xsl:choose>
371 </div>
372 </xsl:template>
374 <xsl:template match="title" mode="book.titlepage.recto.mode">
375 <table class="navigation" id="top" width="100%"
376 cellpadding="2" cellspacing="0">
377 <tr>
378 <th valign="middle">
379 <p class="{name(.)}">
380 <xsl:value-of select="."/>
381 </p>
382 </th>
383 </tr>
384 </table>
385 </xsl:template>
387 <xsl:template name="header.navigation">
388 <xsl:param name="prev" select="/foo"/>
389 <xsl:param name="next" select="/foo"/>
390 <xsl:variable name="home" select="/*[1]"/>
391 <xsl:variable name="up" select="parent::*"/>
392 <xsl:variable name="refsections" select="./refsect1[@role]"/>
393 <xsl:variable name="glssections" select="./glossdiv/title"/>
394 <xsl:variable name="idxsections" select="./indexdiv/indexdiv/title"/>
395 <xsl:variable name="section_id" select="./@id"/>
396 <xsl:variable name="sect_object_hierarchy" select="./refsect1[@role='object_hierarchy']"/>
397 <xsl:variable name="sect_impl_interfaces" select="./refsect1[@role='impl_interfaces']"/>
398 <xsl:variable name="sect_prerequisites" select="./refsect1[@role='prerequisites']"/>
399 <xsl:variable name="sect_derived_interfaces" select="./refsect1[@role='derived_interfaces']"/>
400 <xsl:variable name="sect_implementations" select="./refsect1[@role='implementations']"/>
401 <xsl:variable name="sect_properties" select="./refsect1[@role='properties']"/>
402 <xsl:variable name="sect_child_properties" select="./refsect1[@role='child_properties']"/>
403 <xsl:variable name="sect_style_properties" select="./refsect1[@role='style_properties']"/>
404 <xsl:variable name="sect_signal_proto" select="./refsect1[@role='signal_proto']"/>
405 <xsl:variable name="sect_desc" select="./refsect1[@role='desc']"/>
406 <xsl:variable name="sect_synopsis" select="./refsynopsisdiv[@role='synopsis']"/>
407 <!--
408 <xsl:variable name="sect_details" select="./refsect1[@id='details']"/>
409 <xsl:variable name="sect_property_details" select="./refsect1[@id='property_details']"/>
410 <xsl:variable name="sect_child_property_details" select="./refsect1[@id='child_property_details']"/>
411 <xsl:variable name="sect_style_property_details" select="./refsect1[@id='style_property_details']"/>
412 <xsl:variable name="sect_signals" select="./refsect1[@id='signals']"/>
415 <xsl:if test="$suppress.navigation = '0' and $home != .">
416 <table class="navigation" id="top" width="100%"
417 summary = "Navigation header" cellpadding="2" cellspacing="5">
418 <tr valign="middle">
419 <td width="100%" align="left" class="shortcuts">
420 <!--<xsl:if test="name()='refentry'"-->
421 <xsl:choose>
422 <xsl:when test="count($refsections) > 0">
423 <a href="#" class="shortcut">Top</a>
424 <xsl:if test="count($sect_desc) > 0">
425 <span id="nav_description">&#160;&#160;<span class="dim">|</span>&#160;
426 <a href="#{$section_id}.description" class="shortcut">
427 <xsl:value-of select="./refsect1[@role='desc']/title"/>
428 </a></span>
429 </xsl:if>
430 <xsl:if test="count($sect_object_hierarchy) > 0">
431 <span id="nav_hierarchy">&#160;&#160;<span class="dim">|</span>&#160;
432 <a href="#{$section_id}.object-hierarchy" class="shortcut">
433 <xsl:value-of select="./refsect1[@role='object_hierarchy']/title"/>
434 </a></span>
435 </xsl:if>
436 <xsl:if test="count($sect_impl_interfaces) > 0">
437 <span id="nav_interfaces">&#160;&#160;<span class="dim">|</span>&#160;
438 <a href="#{$section_id}.implemented-interfaces" class="shortcut">
439 <xsl:value-of select="./refsect1[@role='impl_interfaces']/title"/>
440 </a></span>
441 </xsl:if>
442 <xsl:if test="count($sect_prerequisites) > 0">
443 <span id="nav_prerequisites">&#160;&#160;<span class="dim">|</span>&#160;
444 <a href="#{$section_id}.prerequisites" class="shortcut">
445 <xsl:value-of select="./refsect1[@role='prerequisites']/title"/>
446 </a></span>
447 </xsl:if>
448 <xsl:if test="count($sect_derived_interfaces) > 0">
449 <span id="nav_derived_interfaces">&#160;&#160;<span class="dim">|</span>&#160;
450 <a href="#{$section_id}.derived-interfaces" class="shortcut">
451 <xsl:value-of select="./refsect1[@role='derived_interfaces']/title"/>
452 </a></span>
453 </xsl:if>
454 <xsl:if test="count($sect_implementations) > 0">
455 <span id="nav_implementations">&#160;&#160;<span class="dim">|</span>&#160;
456 <a href="#{$section_id}.implementations" class="shortcut">
457 <xsl:value-of select="./refsect1[@role='implementations']/title"/>
458 </a></span>
459 </xsl:if>
460 <xsl:if test="count($sect_properties) > 0">
461 <span id="nav_properties">&#160;&#160;<span class="dim">|</span>&#160;
462 <a href="#{$section_id}.properties" class="shortcut">
463 <xsl:value-of select="./refsect1[@role='properties']/title"/>
464 </a></span>
465 </xsl:if>
466 <xsl:if test="count($sect_child_properties) > 0">
467 <span id="nav_child_properties">&#160;&#160;<span class="dim">|</span>&#160;
468 <a href="#{$section_id}.child-properties" class="shortcut">
469 <xsl:value-of select="./refsect1[@role='child_properties']/title"/>
470 </a></span>
471 </xsl:if>
472 <xsl:if test="count($sect_style_properties) > 0">
473 <span id="nav_style_properties">&#160;&#160;<span class="dim">|</span>&#160;
474 <a href="#{$section_id}.style-properties" class="shortcut">
475 <xsl:value-of select="./refsect1[@role='style_properties']/title"/>
476 </a></span>
477 </xsl:if>
478 <xsl:if test="count($sect_signal_proto) > 0">
479 <span id="nav_signals">&#160;&#160;<span class="dim">|</span>&#160;
480 <a href="#{$section_id}.signals" class="shortcut">
481 <xsl:value-of select="./refsect1[@role='signal_proto']/title"/>
482 </a></span>
483 </xsl:if>
484 </xsl:when>
485 <!-- this is not yet very nice, as it requires all glossdic/indexdiv
486 elements having a anchor element. maybe we can customize the xsl
487 to automaticaly create local anchors
489 <xsl:when test="count($glssections) > 0">
490 <span id="nav_glossary">
491 <xsl:for-each select="./glossdiv">
492 <xsl:if test="position() > 1">
493 &#160;<span class="dim">|</span>&#160;
494 </xsl:if>
495 <a class="shortcut">
496 <xsl:attribute name="href">#gls<xsl:value-of select="./title"/></xsl:attribute>
497 <xsl:value-of select="./title"/>
498 </a>
499 </xsl:for-each>
500 </span>
501 </xsl:when>
502 <xsl:when test="count($idxsections) > 0">
503 <span id="nav_index">
504 <xsl:for-each select="./indexdiv/indexdiv">
505 <xsl:if test="position() > 1">
506 &#160;<span class="dim">|</span>&#160;
507 </xsl:if>
508 <a class="shortcut">
509 <xsl:attribute name="href">#idx<xsl:value-of select="./title"/></xsl:attribute>
510 <xsl:value-of select="./title"/>
511 </a>
512 </xsl:for-each>
513 </span>
514 </xsl:when>
515 </xsl:choose>
516 </td>
517 <xsl:choose>
518 <xsl:when test="$home != .">
519 <td>
520 <a accesskey="h">
521 <xsl:attribute name="href">
522 <xsl:call-template name="href.target">
523 <xsl:with-param name="object" select="$home"/>
524 </xsl:call-template>
525 </xsl:attribute>
526 <img src="home.png" width="16" height="16" border="0">
527 <xsl:attribute name="alt">
528 <xsl:call-template name="gentext">
529 <xsl:with-param name="key">nav-home</xsl:with-param>
530 </xsl:call-template>
531 </xsl:attribute>
532 </img>
533 </a>
534 </td>
535 </xsl:when>
536 <xsl:otherwise>
537 <td>&#160;</td>
538 </xsl:otherwise>
539 </xsl:choose>
540 <xsl:choose>
541 <xsl:when test="count($up) > 0 and $up != $home">
542 <td>
543 <a accesskey="u">
544 <xsl:attribute name="href">
545 <xsl:call-template name="href.target">
546 <xsl:with-param name="object" select="$up"/>
547 </xsl:call-template>
548 </xsl:attribute>
549 <img src="up.png" width="16" height="16" border="0">
550 <xsl:attribute name="alt">
551 <xsl:call-template name="gentext">
552 <xsl:with-param name="key">nav-up</xsl:with-param>
553 </xsl:call-template>
554 </xsl:attribute>
555 </img>
556 </a>
557 </td>
558 </xsl:when>
559 <xsl:otherwise>
560 <td><img src="up-insensitive.png" width="16" height="16" border="0"/></td>
561 </xsl:otherwise>
562 </xsl:choose>
563 <xsl:choose>
564 <xsl:when test="count($prev) > 0">
565 <td>
566 <a accesskey="p">
567 <xsl:attribute name="href">
568 <xsl:call-template name="href.target">
569 <xsl:with-param name="object" select="$prev"/>
570 </xsl:call-template>
571 </xsl:attribute>
572 <img src="left.png" width="16" height="16" border="0">
573 <xsl:attribute name="alt">
574 <xsl:call-template name="gentext">
575 <xsl:with-param name="key">nav-prev</xsl:with-param>
576 </xsl:call-template>
577 </xsl:attribute>
578 </img>
579 </a>
580 </td>
581 </xsl:when>
582 <xsl:otherwise>
583 <td><img src="left-insensitive.png" width="16" height="16" border="0"/></td>
584 </xsl:otherwise>
585 </xsl:choose>
586 <xsl:choose>
587 <xsl:when test="count($next) > 0">
588 <td>
589 <a accesskey="n">
590 <xsl:attribute name="href">
591 <xsl:call-template name="href.target">
592 <xsl:with-param name="object" select="$next"/>
593 </xsl:call-template>
594 </xsl:attribute>
595 <img src="right.png" width="16" height="16" border="0">
596 <xsl:attribute name="alt">
597 <xsl:call-template name="gentext">
598 <xsl:with-param name="key">nav-next</xsl:with-param>
599 </xsl:call-template>
600 </xsl:attribute>
601 </img>
602 </a>
603 </td>
604 </xsl:when>
605 <xsl:otherwise>
606 <td><img src="right-insensitive.png" width="16" height="16" border="0"/></td>
607 </xsl:otherwise>
608 </xsl:choose>
609 </tr>
610 </table>
611 </xsl:if>
612 </xsl:template>
614 <xsl:template name="footer.navigation">
615 </xsl:template>
617 <!-- avoid creating multiple identical indices
618 if the stylesheets don't support filtered indices
620 <xsl:template match="index">
621 <xsl:variable name="has-filtered-index">
622 <xsl:call-template name="version-greater-or-equal">
623 <xsl:with-param name="ver1" select="$VERSION" />
624 <xsl:with-param name="ver2">1.66</xsl:with-param>
625 </xsl:call-template>
626 </xsl:variable>
627 <xsl:if test="($has-filtered-index = 1) or (count(@role) = 0)">
628 <xsl:apply-imports/>
629 </xsl:if>
630 </xsl:template>
632 <xsl:template match="index" mode="toc">
633 <xsl:variable name="has-filtered-index">
634 <xsl:call-template name="version-greater-or-equal">
635 <xsl:with-param name="ver1" select="$VERSION" />
636 <xsl:with-param name="ver2">1.66</xsl:with-param>
637 </xsl:call-template>
638 </xsl:variable>
639 <xsl:if test="($has-filtered-index = 1) or (count(@role) = 0)">
640 <xsl:apply-imports/>
641 </xsl:if>
642 </xsl:template>
644 <xsl:template match="para">
645 <xsl:choose>
646 <xsl:when test="@role = 'gallery'">
647 <div class="container">
648 <div class="gallery-spacer"> </div>
649 <xsl:apply-templates mode="gallery.mode"/>
650 <div class="gallery-spacer"> </div>
651 </div>
652 </xsl:when>
653 <xsl:otherwise>
654 <xsl:apply-imports/>
655 </xsl:otherwise>
656 </xsl:choose>
657 </xsl:template>
658 <!-- FIXME: try if that works too -->
659 <!--xsl:template match="para[@role='gallery']">
660 <div class="container">
661 <div class="gallery-spacer"> </div>
662 <xsl:apply-templates mode="gallery.mode"/>
663 <div class="gallery-spacer"> </div>
664 </div>
665 </xsl:template-->
669 <xsl:template match="link" mode="gallery.mode">
670 <div class="gallery-float">
671 <xsl:apply-templates select="."/>
672 </div>
673 </xsl:template>
675 <!-- add gallery handling to refnamediv template -->
676 <xsl:template match="refnamediv">
677 <div class="{name(.)}">
678 <table width="100%">
679 <tr><td valign="top">
680 <xsl:call-template name="anchor"/>
681 <xsl:choose>
682 <xsl:when test="$refentry.generate.name != 0">
683 <h2>
684 <xsl:call-template name="gentext">
685 <xsl:with-param name="key" select="'RefName'"/>
686 </xsl:call-template>
687 </h2>
688 </xsl:when>
689 <xsl:when test="$refentry.generate.title != 0">
690 <h2>
691 <xsl:choose>
692 <xsl:when test="../refmeta/refentrytitle">
693 <xsl:apply-templates select="../refmeta/refentrytitle"/>
694 </xsl:when>
695 <xsl:otherwise>
696 <xsl:apply-templates select="refname[1]"/>
697 </xsl:otherwise>
698 </xsl:choose>
699 </h2>
700 </xsl:when>
701 </xsl:choose>
703 <xsl:apply-templates/>
704 </p>
705 </td>
706 <td class="gallery_image" valign="top" align="right">
707 <xsl:choose>
708 <xsl:when test="../refmeta/refmiscinfo/inlinegraphic">
709 <xsl:apply-templates select="../refmeta/refmiscinfo/inlinegraphic"/>
710 </xsl:when>
711 <xsl:otherwise>
712 <!-- find the gallery image to use here
713 - determine the id of the enclosing refentry
714 - look for an inlinegraphic inside a link with linkend == refentryid inside a para with role == gallery
715 - use it here
717 <xsl:variable name="refentryid" select="../@id"/>
718 <xsl:apply-templates select="key('gallery.key', $refentryid)/inlinegraphic"/>
719 </xsl:otherwise>
720 </xsl:choose>
721 </td></tr>
722 </table>
723 </div>
724 </xsl:template>
726 <!-- a copy from refentry.xsl to add the missing mode attribute,
727 see bug/729911, https://sourceforge.net/p/docbook/bugs/1358/
728 fixed in: https://sourceforge.net/p/docbook/code/9962/
730 <xsl:template match="refpurpose" mode="no.anchor.mode">
731 <xsl:if test="node()">
732 <xsl:text> </xsl:text>
733 <xsl:call-template name="dingbat">
734 <xsl:with-param name="dingbat">em-dash</xsl:with-param>
735 </xsl:call-template>
736 <xsl:text> </xsl:text>
737 <xsl:apply-templates mode="no.anchor.mode"/>
738 </xsl:if>
739 </xsl:template>
741 <!-- add anchors for index sections -->
742 <xsl:template match="indexdiv">
743 <a><xsl:attribute name="name">idx<xsl:value-of select="./title"/></xsl:attribute></a>
744 <xsl:apply-templates/>
745 </xsl:template>
747 <!-- add anchors for glossary sections -->
748 <xsl:template match="glossdiv">
749 <a><xsl:attribute name="name">gls<xsl:value-of select="./title"/></xsl:attribute></a>
750 <xsl:apply-templates/>
751 </xsl:template>
753 <!-- Exterminate any trace of indexterms in the main flow -->
754 <xsl:template match="indexterm">
755 </xsl:template>
757 <!-- Extra link on the right side of doc-blobs -->
758 <xsl:template name="user.format.extralinks">
759 <xsl:if test="../ulink[@role='extralinks']">
760 <span class="extralinks">
761 <xsl:for-each select="../ulink[@role='extralinks']">
762 <xsl:if test="position() = 1">[&#160;</xsl:if>
763 <xsl:if test="position() > 1">&#160;&#160;<span class="dim">|</span>&#160;</xsl:if>
765 <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
766 <xsl:copy-of select="text()" />
767 </a>
768 <xsl:if test="position() = last()">&#160;&#160;]</xsl:if>
769 </xsl:for-each>
770 </span>
771 </xsl:if>
772 <!--xsl:copy-of select="text()" /-->
773 <xsl:apply-templates/>
774 </xsl:template>
776 <!-- this is not in use yet (see gtkdoc-mkdb
777 <xsl:template match="//refsect2/ulink[@role='extralinks']"/>
778 <xsl:template match="//refsect1/ulink[@role='extralinks']"/>
780 <xsl:template match="//refsect2/title">
781 <h3><xsl:call-template name="user.format.extralinks"/></h3>
782 </xsl:template>
784 <xsl:template match="//refsect1/title">
785 <h2><xsl:call-template name="user.format.extralinks"/></h2>
786 </xsl:template>
789 <!-- ==================================================================== -->
791 <xsl:template match="acronym">
792 <xsl:call-template name="generate.acronym.link"/>
793 </xsl:template>
795 <xsl:template name="generate.acronym.link">
796 <xsl:param name="acronym">
797 <xsl:apply-templates/>
798 </xsl:param>
799 <xsl:param name="value" >
800 <xsl:value-of select="key('acronym.key', $acronym)/../glossdef/para[1]" />
801 </xsl:param>
802 <xsl:choose>
803 <xsl:when test="$value=''">
804 <!-- debug -->
805 <xsl:message>
806 In gtk-doc.xsl: For acronym (<xsl:value-of select="$acronym"/>) no value found!
807 </xsl:message>
809 <xsl:attribute name="href">
810 <xsl:text>http://foldoc.org/</xsl:text>
811 <xsl:value-of select="$acronym"/>
812 </xsl:attribute>
813 <xsl:call-template name="inline.charseq"/>
814 </a>
815 </xsl:when>
816 <xsl:otherwise>
817 <!-- found -->
818 <acronym>
819 <xsl:attribute name="title">
820 <xsl:value-of select="$value"/>
821 </xsl:attribute>
822 <xsl:call-template name="inline.charseq"/>
823 </acronym>
824 </xsl:otherwise>
825 </xsl:choose>
826 </xsl:template>
828 </xsl:stylesheet>