38d0a1a818e01d1bcf43001d624912d313c6f53e
[adg.git] / docs / common / gtk-doc.xsl
blob38d0a1a818e01d1bcf43001d624912d313c6f53e
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/xhtml/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="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="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 <!-- ========================================================= -->
64 <!-- l10n is slow, we don't ue it, so we'd like to turn it off
65 this atleast avoid the re-evaluation -->
66 <xsl:template name="l10n.language">en</xsl:template>
68 <xsl:param name="gtkdoc.l10n.xml" select="document('http://docbook.sourceforge.net/release/xsl/current/common/en.xml')"/>
70 <xsl:key name="gtkdoc.gentext.key"
71 match="l:gentext[@key]"
72 use="@key"/>
73 <xsl:key name="gtkdoc.context.key"
74 match="l:context[@name]"
75 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>
253 <xsl:variable name="is.title-unnumbered">
254 <xsl:if test="$is.title = 0 and $is.title-numbered = 0">
255 <xsl:call-template name="gentext.template.exists">
256 <xsl:with-param name="context" select="'title-unnumbered'"/>
257 <xsl:with-param name="name" select="local-name(.)"/>
258 <xsl:with-param name="lang">
259 <xsl:call-template name="l10n.language"/>
260 </xsl:with-param>
261 </xsl:call-template>
262 </xsl:if>
263 </xsl:variable>
265 <xsl:variable name="gentext.title">
266 <xsl:if test="$is.title != 0 or
267 $is.title-numbered != 0 or
268 $is.title-unnumbered != 0">
269 <xsl:apply-templates select="."
270 mode="object.title.markup.textonly"/>
271 </xsl:if>
272 </xsl:variable>
274 <xsl:choose>
275 <xsl:when test="string-length($gentext.title) != 0">
276 <xsl:attribute name="title">
277 <xsl:value-of select="$gentext.title"/>
278 </xsl:attribute>
279 </xsl:when>
280 <xsl:when test="alt">
281 <xsl:attribute name="title">
282 <xsl:value-of select="normalize-space(alt)"/>
283 </xsl:attribute>
284 </xsl:when>
285 </xsl:choose>
286 </xsl:if>
287 </xsl:template>
292 <!-- ========================================================= -->
293 <!-- template to create the index.sgml anchor index -->
295 <xsl:template match="book|article">
296 <xsl:variable name="tooldver">
297 <xsl:call-template name="version-greater-or-equal">
298 <xsl:with-param name="ver1" select="$VERSION" />
299 <xsl:with-param name="ver2">1.36</xsl:with-param>
300 </xsl:call-template>
301 </xsl:variable>
302 <xsl:if test="$tooldver = 0">
303 <xsl:message terminate="yes">
304 FATAL-ERROR: You need the DocBook XSL Stylesheets version 1.36 or higher
305 to build the documentation.
306 Get a newer version at http://docbook.sourceforge.net/projects/xsl/
307 </xsl:message>
308 </xsl:if>
309 <xsl:apply-imports/>
311 <!-- generate the index.sgml href index -->
312 <xsl:call-template name="generate.index"/>
313 <!-- generate $book.devhelp2 -->
314 <xsl:call-template name="generate.devhelp2"/>
315 </xsl:template>
317 <xsl:template name="generate.index">
318 <xsl:call-template name="write.text.chunk">
319 <xsl:with-param name="filename" select="'index.sgml'"/>
320 <xsl:with-param name="content">
321 <xsl:apply-templates select="/book/bookinfo/releaseinfo/ulink"
322 mode="generate.index.mode"/>
323 <!-- check all anchor and refentry elements -->
324 <!--
325 The obvious way to write this is //anchor|//refentry|etc...
326 The obvious way is slow because it causes multiple traversals
327 in libxslt. This take about half the time.
329 <xsl:apply-templates select="//*[name()='anchor' or name()='refentry' or name()='refsect1' or
330 name() = 'refsect2' or name()='refsynopsisdiv' or
331 name()='varlistentry']"
332 mode="generate.index.mode"/>
333 </xsl:with-param>
334 <xsl:with-param name="default.encoding" select="'UTF-8'"/>
335 <xsl:with-param name="chunker.output.indent" select="'no'"/>
336 </xsl:call-template>
337 </xsl:template>
339 <xsl:template match="*" mode="generate.index.mode">
340 <xsl:if test="not(@href) and count(@id) > 0">
341 <xsl:text>&lt;ANCHOR id=&quot;</xsl:text>
342 <xsl:value-of select="@id"/>
343 <xsl:text>&quot; href=&quot;</xsl:text>
344 <xsl:if test="$gtkdoc.bookname">
345 <xsl:value-of select="$gtkdoc.bookname"/>
346 <xsl:text>/</xsl:text>
347 </xsl:if>
348 <xsl:call-template name="href.target"/>
349 <xsl:text>&quot;&gt;&#10;</xsl:text>
350 </xsl:if>
351 </xsl:template>
353 <xsl:template match="/book/bookinfo/releaseinfo/ulink" mode="generate.index.mode">
354 <xsl:if test="@role='online-location'">
355 <xsl:text>&lt;ONLINE href=&quot;</xsl:text>
356 <xsl:value-of select="@url"/>
357 <xsl:text>&quot;&gt;&#10;</xsl:text>
358 </xsl:if>
359 </xsl:template>
361 <!-- ========================================================= -->
362 <!-- template to output gtkdoclink elements for the unknown targets -->
364 <xsl:template match="link">
365 <xsl:choose>
366 <xsl:when test="id(@linkend)">
367 <xsl:apply-imports/>
368 </xsl:when>
369 <xsl:otherwise>
370 <GTKDOCLINK HREF="{@linkend}">
371 <xsl:apply-templates/>
372 </GTKDOCLINK>
373 </xsl:otherwise>
374 </xsl:choose>
375 </xsl:template>
377 <!-- ========================================================= -->
378 <!-- Below are the visual portions of the stylesheet. They provide
379 the normal gtk-doc output style. -->
381 <xsl:param name="shade.verbatim" select="0"/>
382 <xsl:param name="refentry.separator" select="0"/>
384 <xsl:template match="refsect2">
385 <xsl:if test="preceding-sibling::refsect2">
386 <hr/>
387 </xsl:if>
388 <xsl:apply-imports/>
389 </xsl:template>
391 <xsl:template name="user.head.content">
392 <xsl:if test="$gtkdoc.version">
393 <meta name="generator" content="GTK-Doc V{$gtkdoc.version} (XML mode)"/>
394 </xsl:if>
395 <link rel="stylesheet" href="style.css" type="text/css"/>
396 </xsl:template>
398 <xsl:template name="user.footer.content">
399 <div class="footer">
400 <hr />
401 <xsl:choose>
402 <xsl:when test="$gtkdoc.version">
403 Generated by GTK-Doc V<xsl:copy-of select="$gtkdoc.version" />
404 </xsl:when>
405 <xsl:otherwise>
406 Generated by GTK-Doc
407 </xsl:otherwise>
408 </xsl:choose>
409 </div>
410 </xsl:template>
412 <xsl:template match="title" mode="book.titlepage.recto.mode">
413 <table class="navigation" id="top" width="100%"
414 cellpadding="2" cellspacing="0">
415 <tr>
416 <th valign="middle">
417 <p class="{name(.)}">
418 <xsl:value-of select="."/>
419 </p>
420 </th>
421 </tr>
422 </table>
423 </xsl:template>
425 <xsl:template name="header.navigation">
426 <xsl:param name="prev" select="/foo"/>
427 <xsl:param name="next" select="/foo"/>
428 <xsl:variable name="home" select="/*[1]"/>
429 <xsl:variable name="up" select="parent::*"/>
430 <xsl:variable name="refsections" select="./refsect1[@role]"/>
431 <xsl:variable name="glssections" select="./glossdiv/title"/>
432 <xsl:variable name="idxsections" select="./indexdiv/indexdiv/title"/>
433 <xsl:variable name="section_id" select="./@id"/>
434 <xsl:variable name="sect_object_hierarchy" select="./refsect1[@role='object_hierarchy']"/>
435 <xsl:variable name="sect_impl_interfaces" select="./refsect1[@role='impl_interfaces']"/>
436 <xsl:variable name="sect_prerequisites" select="./refsect1[@role='prerequisites']"/>
437 <xsl:variable name="sect_derived_interfaces" select="./refsect1[@role='derived_interfaces']"/>
438 <xsl:variable name="sect_implementations" select="./refsect1[@role='implementations']"/>
439 <xsl:variable name="sect_properties" select="./refsect1[@role='properties']"/>
440 <xsl:variable name="sect_child_properties" select="./refsect1[@role='child_properties']"/>
441 <xsl:variable name="sect_style_properties" select="./refsect1[@role='style_properties']"/>
442 <xsl:variable name="sect_signal_proto" select="./refsect1[@role='signal_proto']"/>
443 <xsl:variable name="sect_desc" select="./refsect1[@role='desc']"/>
444 <xsl:variable name="sect_synopsis" select="./refsynopsisdiv[@role='synopsis']"/>
445 <!--
446 <xsl:variable name="sect_details" select="./refsect1[@id='details']"/>
447 <xsl:variable name="sect_property_details" select="./refsect1[@id='property_details']"/>
448 <xsl:variable name="sect_child_property_details" select="./refsect1[@id='child_property_details']"/>
449 <xsl:variable name="sect_style_property_details" select="./refsect1[@id='style_property_details']"/>
450 <xsl:variable name="sect_signals" select="./refsect1[@id='signals']"/>
453 <xsl:if test="$suppress.navigation = '0' and $home != .">
454 <table class="navigation" id="top" width="100%"
455 summary = "Navigation header" cellpadding="2" cellspacing="2">
456 <tr valign="middle">
457 <xsl:choose>
458 <xsl:when test="count($prev) > 0">
459 <td>
460 <a accesskey="p">
461 <xsl:attribute name="href">
462 <xsl:call-template name="href.target">
463 <xsl:with-param name="object" select="$prev"/>
464 </xsl:call-template>
465 </xsl:attribute>
466 <img src="left.png" width="24" height="24" border="0">
467 <xsl:attribute name="alt">
468 <xsl:call-template name="gentext">
469 <xsl:with-param name="key">nav-prev</xsl:with-param>
470 </xsl:call-template>
471 </xsl:attribute>
472 </img>
473 </a>
474 </td>
475 </xsl:when>
476 <xsl:otherwise>
477 <td>&#160;</td>
478 </xsl:otherwise>
479 </xsl:choose>
480 <xsl:choose>
481 <xsl:when test="count($up) > 0 and $up != $home">
482 <td>
483 <a accesskey="u">
484 <xsl:attribute name="href">
485 <xsl:call-template name="href.target">
486 <xsl:with-param name="object" select="$up"/>
487 </xsl:call-template>
488 </xsl:attribute>
489 <img src="up.png" width="24" height="24" border="0">
490 <xsl:attribute name="alt">
491 <xsl:call-template name="gentext">
492 <xsl:with-param name="key">nav-up</xsl:with-param>
493 </xsl:call-template>
494 </xsl:attribute>
495 </img>
496 </a>
497 </td>
498 </xsl:when>
499 <xsl:otherwise>
500 <td>&#160;</td>
501 </xsl:otherwise>
502 </xsl:choose>
503 <xsl:choose>
504 <xsl:when test="$home != .">
505 <td>
506 <a accesskey="h">
507 <xsl:attribute name="href">
508 <xsl:call-template name="href.target">
509 <xsl:with-param name="object" select="$home"/>
510 </xsl:call-template>
511 </xsl:attribute>
512 <img src="home.png" width="24" height="24" border="0">
513 <xsl:attribute name="alt">
514 <xsl:call-template name="gentext">
515 <xsl:with-param name="key">nav-home</xsl:with-param>
516 </xsl:call-template>
517 </xsl:attribute>
518 </img>
519 </a>
520 </td>
521 </xsl:when>
522 <xsl:otherwise>
523 <td>&#160;</td>
524 </xsl:otherwise>
525 </xsl:choose>
526 <th width="100%" align="center">
527 <xsl:apply-templates select="$home" mode="object.title.markup"/>
528 </th>
529 <xsl:choose>
530 <xsl:when test="count($next) > 0">
531 <td>
532 <a accesskey="n">
533 <xsl:attribute name="href">
534 <xsl:call-template name="href.target">
535 <xsl:with-param name="object" select="$next"/>
536 </xsl:call-template>
537 </xsl:attribute>
538 <img src="right.png" width="24" height="24" border="0">
539 <xsl:attribute name="alt">
540 <xsl:call-template name="gentext">
541 <xsl:with-param name="key">nav-next</xsl:with-param>
542 </xsl:call-template>
543 </xsl:attribute>
544 </img>
545 </a>
546 </td>
547 </xsl:when>
548 <xsl:otherwise>
549 <td>&#160;</td>
550 </xsl:otherwise>
551 </xsl:choose>
552 </tr>
553 <!--<xsl:if test="name()='refentry'"-->
554 <xsl:choose>
555 <xsl:when test="count($refsections) > 0">
556 <tr>
557 <td colspan="5" class="shortcuts">
558 <xsl:if test="count($sect_synopsis) > 0">
559 <a href="#{$section_id}.synopsis" class="shortcut">Top</a>
560 </xsl:if>
561 <xsl:if test="count($sect_desc) > 0">
562 &#160;|&#160;
563 <a href="#{$section_id}.description" class="shortcut">
564 <xsl:value-of select="./refsect1[@role='desc']/title"/>
565 </a>
566 </xsl:if>
567 <xsl:if test="count($sect_object_hierarchy) > 0">
568 &#160;|&#160;
569 <a href="#{$section_id}.object-hierarchy" class="shortcut">
570 <xsl:value-of select="./refsect1[@role='object_hierarchy']/title"/>
571 </a>
572 </xsl:if>
573 <xsl:if test="count($sect_impl_interfaces) > 0">
574 &#160;|&#160;
575 <a href="#{$section_id}.implemented-interfaces" class="shortcut">
576 <xsl:value-of select="./refsect1[@role='impl_interfaces']/title"/>
577 </a>
578 </xsl:if>
579 <xsl:if test="count($sect_prerequisites) > 0">
580 &#160;|&#160;
581 <a href="#{$section_id}.prerequisites" class="shortcut">
582 <xsl:value-of select="./refsect1[@role='prerequisites']/title"/>
583 </a>
584 </xsl:if>
585 <xsl:if test="count($sect_derived_interfaces) > 0">
586 &#160;|&#160;
587 <a href="#{$section_id}.derived-interfaces" class="shortcut">
588 <xsl:value-of select="./refsect1[@role='derived_interfaces']/title"/>
589 </a>
590 </xsl:if>
591 <xsl:if test="count($sect_implementations) > 0">
592 &#160;|&#160;
593 <a href="#{$section_id}.implementations" class="shortcut">
594 <xsl:value-of select="./refsect1[@role='implementations']/title"/>
595 </a>
596 </xsl:if>
597 <xsl:if test="count($sect_properties) > 0">
598 &#160;|&#160;
599 <a href="#{$section_id}.properties" class="shortcut">
600 <xsl:value-of select="./refsect1[@role='properties']/title"/>
601 </a>
602 </xsl:if>
603 <xsl:if test="count($sect_child_properties) > 0">
604 &#160;|&#160;
605 <a href="#{$section_id}.child-properties" class="shortcut">
606 <xsl:value-of select="./refsect1[@role='child_properties']/title"/>
607 </a>
608 </xsl:if>
609 <xsl:if test="count($sect_style_properties) > 0">
610 &#160;|&#160;
611 <a href="#{$section_id}.style-properties" class="shortcut">
612 <xsl:value-of select="./refsect1[@role='style_properties']/title"/>
613 </a>
614 </xsl:if>
615 <xsl:if test="count($sect_signal_proto) > 0">
616 &#160;|&#160;
617 <a href="#{$section_id}.signals" class="shortcut">
618 <xsl:value-of select="./refsect1[@role='signal_proto']/title"/>
619 </a>
620 </xsl:if>
621 <!--
622 <xsl:if test="count($sect_details) > 0">
623 <a href="#details" class="shortcut">
624 <xsl:value-of select="./refsect1[@id='details']/title"/>
625 </a>
626 &#160;|&#160;
627 </xsl:if>
628 <xsl:if test="count($sect_property_details) > 0">
629 <a href="#property_details" class="shortcut">
630 <xsl:value-of select="./refsect1[@id='property_details']/title"/>
631 </a>
632 &#160;|&#160;
633 </xsl:if>
634 <xsl:if test="count($sect_child_property_details) > 0">
635 <a href="#child_property_details" class="shortcut">
636 <xsl:value-of select="./refsect1[@id='property_child_details']/title"/>
637 </a>
638 &#160;|&#160;
639 </xsl:if>
640 <xsl:if test="count($sect_style_property_details) > 0">
641 <a href="#style_property_details" class="shortcut">
642 <xsl:value-of select="./refsect1[@id='style_property_details']/title"/>
643 </a>
644 &#160;|&#160;
645 </xsl:if>
646 <xsl:if test="count($sect_signals) > 0">
647 <a href="#signals" class="shortcut">
648 <xsl:value-of select="./refsect1[@id='signals']/title"/>
649 </a>
650 &#160;|&#160;
651 </xsl:if>
653 </td>
654 </tr>
655 </xsl:when>
656 <!-- this is not yet very nice, as it requires all glossdic/indexdiv
657 elements having a anchor element. maybe we can customize the xsl
658 to automaticaly create local anchors
660 <xsl:when test="count($glssections) > 0">
661 <tr>
662 <td colspan="5" class="shortcuts">
663 <xsl:for-each select="./glossdiv">
664 <xsl:if test="position() > 1">
665 &#160;|&#160;
666 </xsl:if>
667 <a class="shortcut">
668 <xsl:attribute name="href">#gls<xsl:value-of select="./title"/></xsl:attribute>
669 <xsl:value-of select="./title"/>
670 </a>
671 </xsl:for-each>
672 </td>
673 </tr>
674 </xsl:when>
675 <xsl:when test="count($idxsections) > 0">
676 <tr>
677 <td colspan="5" class="shortcuts">
678 <xsl:for-each select="./indexdiv/indexdiv">
679 <xsl:if test="position() > 1">
680 &#160;|&#160;
681 </xsl:if>
682 <a class="shortcut">
683 <xsl:attribute name="href">#idx<xsl:value-of select="./title"/></xsl:attribute>
684 <xsl:value-of select="./title"/>
685 </a>
686 </xsl:for-each>
687 </td>
688 </tr>
689 </xsl:when>
690 </xsl:choose>
691 </table>
692 </xsl:if>
693 </xsl:template>
695 <xsl:template name="footer.navigation">
696 </xsl:template>
698 <!-- avoid creating multiple identical indices
699 if the stylesheets don't support filtered indices
701 <xsl:template match="index">
702 <xsl:variable name="has-filtered-index">
703 <xsl:call-template name="version-greater-or-equal">
704 <xsl:with-param name="ver1" select="$VERSION" />
705 <xsl:with-param name="ver2">1.66</xsl:with-param>
706 </xsl:call-template>
707 </xsl:variable>
708 <xsl:if test="($has-filtered-index = 1) or (count(@role) = 0)">
709 <xsl:apply-imports/>
710 </xsl:if>
711 </xsl:template>
713 <xsl:template match="index" mode="toc">
714 <xsl:variable name="has-filtered-index">
715 <xsl:call-template name="version-greater-or-equal">
716 <xsl:with-param name="ver1" select="$VERSION" />
717 <xsl:with-param name="ver2">1.66</xsl:with-param>
718 </xsl:call-template>
719 </xsl:variable>
720 <xsl:if test="($has-filtered-index = 1) or (count(@role) = 0)">
721 <xsl:apply-imports/>
722 </xsl:if>
723 </xsl:template>
725 <xsl:template match="para">
726 <xsl:choose>
727 <xsl:when test="@role = 'gallery'">
728 <div class="container">
729 <div class="gallery-spacer"> </div>
730 <xsl:apply-templates mode="gallery.mode"/>
731 <div class="gallery-spacer"> </div>
732 </div>
733 </xsl:when>
734 <xsl:otherwise>
735 <xsl:apply-imports/>
736 </xsl:otherwise>
737 </xsl:choose>
738 </xsl:template>
739 <!-- FIXME: try if that works too -->
740 <!--xsl:template match="para[@role='gallery']">
741 <div class="container">
742 <div class="gallery-spacer"> </div>
743 <xsl:apply-templates mode="gallery.mode"/>
744 <div class="gallery-spacer"> </div>
745 </div>
746 </xsl:template-->
750 <xsl:template match="link" mode="gallery.mode">
751 <div class="gallery-float">
752 <xsl:apply-templates select="."/>
753 </div>
754 </xsl:template>
756 <!-- add gallery handling to refnamediv template -->
757 <xsl:template match="refnamediv">
758 <div class="{name(.)}">
759 <table width="100%">
760 <tr><td valign="top">
761 <xsl:call-template name="anchor"/>
762 <xsl:choose>
763 <xsl:when test="$refentry.generate.name != 0">
764 <h2>
765 <xsl:call-template name="gentext">
766 <xsl:with-param name="key" select="'RefName'"/>
767 </xsl:call-template>
768 </h2>
769 </xsl:when>
770 <xsl:when test="$refentry.generate.title != 0">
771 <h2>
772 <xsl:choose>
773 <xsl:when test="../refmeta/refentrytitle">
774 <xsl:apply-templates select="../refmeta/refentrytitle"/>
775 </xsl:when>
776 <xsl:otherwise>
777 <xsl:apply-templates select="refname[1]"/>
778 </xsl:otherwise>
779 </xsl:choose>
780 </h2>
781 </xsl:when>
782 </xsl:choose>
784 <xsl:apply-templates/>
785 </p>
786 </td>
787 <td valign="top" align="right">
788 <xsl:choose>
789 <xsl:when test="../refmeta/refmiscinfo/inlinegraphic">
790 <xsl:apply-templates select="../refmeta/refmiscinfo/inlinegraphic"/>
791 </xsl:when>
792 <xsl:otherwise>
793 <!-- find the gallery image to use here
794 - determine the id of the enclosing refentry
795 - look for an inlinegraphic inside a link with linkend == refentryid inside a para with role == gallery
796 - use it here
798 <xsl:variable name="refentryid" select="../@id"/>
799 <xsl:apply-templates select="key('gallery.key', $refentryid)/inlinegraphic"/>
800 </xsl:otherwise>
801 </xsl:choose>
802 </td></tr>
803 </table>
804 </div>
805 </xsl:template>
807 <!-- add anchors for index sections -->
808 <xsl:template match="indexdiv">
809 <a><xsl:attribute name="name">idx<xsl:value-of select="./title"/></xsl:attribute></a>
810 <xsl:apply-templates/>
811 </xsl:template>
813 <!-- add anchors for glossary sections -->
814 <xsl:template match="glossdiv">
815 <a><xsl:attribute name="name">gls<xsl:value-of select="./title"/></xsl:attribute></a>
816 <xsl:apply-templates/>
817 </xsl:template>
819 <!-- Exterminate any trace of indexterms in the main flow -->
820 <xsl:template match="indexterm">
821 </xsl:template>
823 <!-- Extra link on the right side of doc-blobs -->
824 <xsl:template name="user.format.extralinks">
825 <xsl:if test="../ulink[@role='extralinks']">
826 <span class="extralinks">
827 <xsl:for-each select="../ulink[@role='extralinks']">
828 <xsl:if test="position() = 1">[&#160;</xsl:if>
829 <xsl:if test="position() > 1">&#160;|&#160;</xsl:if>
831 <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
832 <xsl:copy-of select="text()" />
833 </a>
834 <xsl:if test="position() = last()">&#160;]</xsl:if>
835 </xsl:for-each>
836 </span>
837 </xsl:if>
838 <!--xsl:copy-of select="text()" /-->
839 <xsl:apply-templates/>
840 </xsl:template>
842 <!-- this is not in use yet (see gtkdoc-mkdb
843 <xsl:template match="//refsect2/ulink[@role='extralinks']"/>
844 <xsl:template match="//refsect1/ulink[@role='extralinks']"/>
846 <xsl:template match="//refsect2/title">
847 <h3><xsl:call-template name="user.format.extralinks"/></h3>
848 </xsl:template>
850 <xsl:template match="//refsect1/title">
851 <h2><xsl:call-template name="user.format.extralinks"/></h2>
852 </xsl:template>
855 <!-- ==================================================================== -->
857 <xsl:template match="acronym">
858 <xsl:call-template name="generate.acronym.link"/>
859 </xsl:template>
861 <xsl:template name="generate.acronym.link">
862 <xsl:param name="acronym">
863 <xsl:apply-templates/>
864 </xsl:param>
865 <!--
866 We use for-each to change context to the database document because key()
867 only locates elements in the same document as the context node!
870 <xsl:param name="value" >
871 <xsl:value-of select="key('acronym.key', $acronym)/../glossdef/para[1]" />
872 </xsl:param>
873 <xsl:choose>
874 <xsl:when test="$value=''">
875 <!-- debug -->
876 <xsl:message>
877 In gtk-doc.xsl: For acronym (<xsl:value-of select="$acronym"/>) no value found!
878 </xsl:message>
880 <xsl:attribute name="href">
881 <xsl:text>http://foldoc.org/</xsl:text>
882 <xsl:value-of select="$acronym"/>
883 </xsl:attribute>
884 <xsl:call-template name="inline.charseq"/>
885 </a>
886 </xsl:when>
887 <xsl:otherwise>
888 <!-- found -->
889 <acronym>
890 <xsl:attribute name="title">
891 <xsl:value-of select="$value"/>
892 </xsl:attribute>
893 <xsl:call-template name="inline.charseq"/>
894 </acronym>
895 </xsl:otherwise>
896 </xsl:choose>
897 </xsl:template>
899 </xsl:stylesheet>