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