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