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