1 <?xml version='
1.0'
?> <!--*- mode: xml -*-->
2 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
5 <!-- import the chunked XSL stylesheet -->
6 <xsl:import href=
"http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
7 <xsl:include href=
"version-greater-or-equal.xsl"/>
9 <xsl:key name=
"acronym.key"
10 match=
"glossentry/glossterm"
12 <xsl:key name=
"gallery.key"
13 match=
"para[@role='gallery']/link"
16 <!-- change some parameters -->
17 <xsl:param name=
"toc.section.depth">2</xsl:param>
18 <xsl:param name=
"generate.toc">
25 <xsl:param name=
"default.encoding" select=
"'UTF-8'"/>
26 <xsl:param name=
"chapter.autolabel" select=
"0"/>
27 <xsl:param name=
"use.id.as.filename" select=
"1"/>
28 <xsl:param name=
"html.ext" select=
"'.html'"/>
29 <xsl:param name=
"refentry.generate.name" select=
"0"/>
30 <xsl:param name=
"refentry.generate.title" select=
"1"/>
32 <!-- use index filtering (if available) -->
33 <xsl:param name=
"index.on.role" select=
"1"/>
35 <!-- display variablelists as tables -->
36 <xsl:param name=
"variablelist.as.table" select=
"1"/>
38 <!-- this gets set on the command line ... -->
39 <xsl:param name=
"gtkdoc.version" select=
"''"/>
40 <xsl:param name=
"gtkdoc.bookname" select=
"''"/>
42 <!-- ========================================================= -->
43 <!-- template to create the index.sgml anchor index -->
45 <xsl:template match=
"book|article">
46 <xsl:variable name=
"tooldver">
47 <xsl:call-template name=
"version-greater-or-equal">
48 <xsl:with-param name=
"ver1" select=
"$VERSION" />
49 <xsl:with-param name=
"ver2">1.36</xsl:with-param>
52 <xsl:if test=
"$tooldver = 0">
53 <xsl:message terminate=
"yes">
54 FATAL-ERROR: You need the DocBook XSL Stylesheets version
1.36 or higher
55 to build the documentation.
56 Get a newer version at http://docbook.sourceforge.net/projects/xsl/
61 <!-- generate the index.sgml href index -->
62 <xsl:call-template name=
"generate.index"/>
65 <xsl:template name=
"generate.index">
66 <xsl:call-template name=
"write.text.chunk">
67 <xsl:with-param name=
"filename" select=
"'index.sgml'"/>
68 <xsl:with-param name=
"content">
69 <xsl:apply-templates select=
"//releaseinfo/ulink"
70 mode=
"generate.index.mode"/>
71 <!-- check all anchor and refentry elements -->
73 The obvious way to write this is //anchor|//refentry|etc...
74 The obvious way is slow because it causes multiple traversals
75 in libxslt. This take about half the time.
77 <xsl:apply-templates select=
"//*[name()='anchor' or name()='refentry' or name()='refsect1' or
78 name() = 'refsect2' or name()='refsynopsisdiv']"
79 mode=
"generate.index.mode"/>
81 <xsl:with-param name=
"default.encoding" select=
"'UTF-8'"/>
82 <xsl:with-param name=
"chunker.output.indent" select=
"'no'"/>
86 <xsl:template match=
"*" mode=
"generate.index.mode">
87 <xsl:if test=
"not(@href) and count(@id) > 0">
88 <xsl:text><ANCHOR id=
"</xsl:text>
89 <xsl:value-of select=
"@id"/>
90 <xsl:text>" href=
"</xsl:text>
91 <xsl:if test=
"$gtkdoc.bookname">
92 <xsl:value-of select=
"$gtkdoc.bookname"/>
93 <xsl:text>/
</xsl:text>
95 <xsl:call-template name=
"href.target"/>
96 <xsl:text>"> </xsl:text>
100 <xsl:template match=
"//releaseinfo/ulink" mode=
"generate.index.mode">
101 <xsl:if test=
"@role='online-location'">
102 <xsl:text><ONLINE href=
"</xsl:text>
103 <xsl:value-of select=
"@url"/>
104 <xsl:text>"> </xsl:text>
108 <!-- ========================================================= -->
109 <!-- template to output gtkdoclink elements for the unknown targets -->
111 <xsl:template match=
"link">
113 <xsl:when test=
"id(@linkend)">
117 <GTKDOCLINK HREF=
"{@linkend}">
118 <xsl:apply-templates/>
124 <!-- ========================================================= -->
125 <!-- Below are the visual portions of the stylesheet. They provide
126 the normal gtk-doc output style. -->
128 <xsl:param name=
"shade.verbatim" select=
"0"/>
129 <xsl:param name=
"refentry.separator" select=
"0"/>
131 <xsl:template match=
"refsect2">
132 <xsl:if test=
"preceding-sibling::refsect2">
138 <xsl:template name=
"user.head.content">
139 <xsl:if test=
"$gtkdoc.version">
140 <meta name=
"generator"
141 content=
"GTK-Doc V{$gtkdoc.version} (XML mode)"/>
143 <link rel=
"stylesheet" href=
"style.css" type=
"text/css"/>
145 <!-- copied from the html.head template in the docbook stylesheets
146 we don't want links for all refentrys, thats just too much
148 <xsl:variable name=
"this" select=
"."/>
149 <xsl:for-each select=
"//part
154 |//appendix[not(parent::article)]|appendix
155 |//glossary[not(parent::article)]|glossary
156 |//index[not(parent::article)]|index">
157 <link rel=
"{local-name(.)}">
158 <xsl:attribute name=
"href">
159 <xsl:call-template name=
"href.target">
160 <xsl:with-param name=
"context" select=
"$this"/>
161 <xsl:with-param name=
"object" select=
"."/>
164 <xsl:attribute name=
"title">
165 <xsl:apply-templates select=
"." mode=
"object.title.markup.textonly"/>
171 <xsl:template name=
"user.footer.content">
175 <xsl:when test=
"$gtkdoc.version">
176 Generated by GTK-Doc V
<xsl:copy-of select=
"$gtkdoc.version" />
185 <xsl:template match=
"title" mode=
"book.titlepage.recto.mode">
186 <table class=
"navigation" id=
"top" width=
"100%"
187 cellpadding=
"2" cellspacing=
"0">
190 <p class=
"{name(.)}">
191 <xsl:value-of select=
"."/>
198 <xsl:template name=
"header.navigation">
199 <xsl:param name=
"prev" select=
"/foo"/>
200 <xsl:param name=
"next" select=
"/foo"/>
201 <xsl:variable name=
"home" select=
"/*[1]"/>
202 <xsl:variable name=
"up" select=
"parent::*"/>
203 <xsl:variable name=
"sections" select=
"./refsect1[@role]"/>
204 <xsl:variable name=
"section_id" select=
"./@id"/>
205 <xsl:variable name=
"sect_object_hierarchy" select=
"./refsect1[@role='object_hierarchy']"/>
206 <xsl:variable name=
"sect_impl_interfaces" select=
"./refsect1[@role='impl_interfaces']"/>
207 <xsl:variable name=
"sect_prerequisites" select=
"./refsect1[@role='prerequisites']"/>
208 <xsl:variable name=
"sect_derived_interfaces" select=
"./refsect1[@role='derived_interfaces']"/>
209 <xsl:variable name=
"sect_implementations" select=
"./refsect1[@role='implementations']"/>
210 <xsl:variable name=
"sect_properties" select=
"./refsect1[@role='properties']"/>
211 <xsl:variable name=
"sect_child_properties" select=
"./refsect1[@role='child_properties']"/>
212 <xsl:variable name=
"sect_style_properties" select=
"./refsect1[@role='style_properties']"/>
213 <xsl:variable name=
"sect_signal_proto" select=
"./refsect1[@role='signal_proto']"/>
214 <xsl:variable name=
"sect_desc" select=
"./refsect1[@role='desc']"/>
215 <xsl:variable name=
"sect_synopsis" select=
"./refsynopsisdiv[@role='synopsis']"/>
217 <xsl:variable name="sect_details" select="./refsect1[@id='details']"/>
218 <xsl:variable name="sect_property_details" select="./refsect1[@id='property_details']"/>
219 <xsl:variable name="sect_child_property_details" select="./refsect1[@id='child_property_details']"/>
220 <xsl:variable name="sect_style_property_details" select="./refsect1[@id='style_property_details']"/>
221 <xsl:variable name="sect_signals" select="./refsect1[@id='signals']"/>
224 <xsl:if test=
"$suppress.navigation = '0' and $home != .">
225 <table class=
"navigation" id=
"top" width=
"100%"
226 summary =
"Navigation header" cellpadding=
"2" cellspacing=
"2">
229 <xsl:when test=
"count($prev) > 0">
232 <xsl:attribute name=
"href">
233 <xsl:call-template name=
"href.target">
234 <xsl:with-param name=
"object" select=
"$prev"/>
237 <img src=
"left.png" width=
"24" height=
"24" border=
"0">
238 <xsl:attribute name=
"alt">
239 <xsl:call-template name=
"gentext">
240 <xsl:with-param name=
"key">nav-prev
</xsl:with-param>
252 <xsl:when test=
"count($up) > 0 and $up != $home">
255 <xsl:attribute name=
"href">
256 <xsl:call-template name=
"href.target">
257 <xsl:with-param name=
"object" select=
"$up"/>
260 <img src=
"up.png" width=
"24" height=
"24" border=
"0">
261 <xsl:attribute name=
"alt">
262 <xsl:call-template name=
"gentext">
263 <xsl:with-param name=
"key">nav-up
</xsl:with-param>
275 <xsl:when test=
"$home != .">
278 <xsl:attribute name=
"href">
279 <xsl:call-template name=
"href.target">
280 <xsl:with-param name=
"object" select=
"$home"/>
283 <img src=
"home.png" width=
"24" height=
"24" border=
"0">
284 <xsl:attribute name=
"alt">
285 <xsl:call-template name=
"gentext">
286 <xsl:with-param name=
"key">nav-home
</xsl:with-param>
297 <th width=
"100%" align=
"center">
298 <xsl:apply-templates select=
"$home" mode=
"object.title.markup"/>
301 <xsl:when test=
"count($next) > 0">
304 <xsl:attribute name=
"href">
305 <xsl:call-template name=
"href.target">
306 <xsl:with-param name=
"object" select=
"$next"/>
309 <img src=
"right.png" width=
"24" height=
"24" border=
"0">
310 <xsl:attribute name=
"alt">
311 <xsl:call-template name=
"gentext">
312 <xsl:with-param name=
"key">nav-next
</xsl:with-param>
324 <!--<xsl:if test="name()='refentry'"-->
325 <xsl:if test=
"count($sections) > 0">
327 <td colspan=
"5" class=
"shortcuts">
328 <xsl:if test=
"count($sect_synopsis) > 0">
329 <a href=
"#{$section_id}.synopsis" class=
"shortcut">Top
</a>
331 <xsl:if test=
"count($sect_desc) > 0">
333 <a href=
"#{$section_id}.description" class=
"shortcut">
334 <xsl:value-of select=
"./refsect1[@role='desc']/title"/>
337 <xsl:if test=
"count($sect_object_hierarchy) > 0">
339 <a href=
"#{$section_id}.object-hierarchy" class=
"shortcut">
340 <xsl:value-of select=
"./refsect1[@role='object_hierarchy']/title"/>
343 <xsl:if test=
"count($sect_impl_interfaces) > 0">
345 <a href=
"#{$section_id}.implemented-interfaces" class=
"shortcut">
346 <xsl:value-of select=
"./refsect1[@role='impl_interfaces']/title"/>
349 <xsl:if test=
"count($sect_prerequisites) > 0">
351 <a href=
"#{$section_id}.prerequisites" class=
"shortcut">
352 <xsl:value-of select=
"./refsect1[@role='prerequisites']/title"/>
355 <xsl:if test=
"count($sect_derived_interfaces) > 0">
357 <a href=
"#{$section_id}.derived-interfaces" class=
"shortcut">
358 <xsl:value-of select=
"./refsect1[@role='derived_interfaces']/title"/>
361 <xsl:if test=
"count($sect_implementations) > 0">
363 <a href=
"#{$section_id}.implementations" class=
"shortcut">
364 <xsl:value-of select=
"./refsect1[@role='implementations']/title"/>
367 <xsl:if test=
"count($sect_properties) > 0">
369 <a href=
"#{$section_id}.properties" class=
"shortcut">
370 <xsl:value-of select=
"./refsect1[@role='properties']/title"/>
373 <xsl:if test=
"count($sect_child_properties) > 0">
375 <a href=
"#{$section_id}.child-properties" class=
"shortcut">
376 <xsl:value-of select=
"./refsect1[@role='child_properties']/title"/>
379 <xsl:if test=
"count($sect_style_properties) > 0">
381 <a href=
"#{$section_id}.style-properties" class=
"shortcut">
382 <xsl:value-of select=
"./refsect1[@role='style_properties']/title"/>
385 <xsl:if test=
"count($sect_signal_proto) > 0">
387 <a href=
"#{$section_id}.signals" class=
"shortcut">
388 <xsl:value-of select=
"./refsect1[@role='signal_proto']/title"/>
392 <xsl:if test="count($sect_details) > 0">
393 <a href="#details" class="shortcut">
394 <xsl:value-of select="./refsect1[@id='details']/title"/>
398 <xsl:if test="count($sect_property_details) > 0">
399 <a href="#property_details" class="shortcut">
400 <xsl:value-of select="./refsect1[@id='property_details']/title"/>
404 <xsl:if test="count($sect_child_property_details) > 0">
405 <a href="#child_property_details" class="shortcut">
406 <xsl:value-of select="./refsect1[@id='property_child_details']/title"/>
410 <xsl:if test="count($sect_style_property_details) > 0">
411 <a href="#style_property_details" class="shortcut">
412 <xsl:value-of select="./refsect1[@id='style_property_details']/title"/>
416 <xsl:if test="count($sect_signals) > 0">
417 <a href="#signals" class="shortcut">
418 <xsl:value-of select="./refsect1[@id='signals']/title"/>
430 <xsl:template name=
"footer.navigation">
433 <!-- avoid creating multiple identical indices
434 if the stylesheets don't support filtered indices
436 <xsl:template match=
"index">
437 <xsl:variable name=
"has-filtered-index">
438 <xsl:call-template name=
"version-greater-or-equal">
439 <xsl:with-param name=
"ver1" select=
"$VERSION" />
440 <xsl:with-param name=
"ver2">1.66</xsl:with-param>
443 <xsl:if test=
"($has-filtered-index = 1) or (count(@role) = 0)">
448 <xsl:template match=
"index" mode=
"toc">
449 <xsl:variable name=
"has-filtered-index">
450 <xsl:call-template name=
"version-greater-or-equal">
451 <xsl:with-param name=
"ver1" select=
"$VERSION" />
452 <xsl:with-param name=
"ver2">1.66</xsl:with-param>
455 <xsl:if test=
"($has-filtered-index = 1) or (count(@role) = 0)">
460 <xsl:template match=
"para">
462 <xsl:when test=
"@role = 'gallery'">
463 <div class=
"container">
464 <div class=
"gallery-spacer"> </div>
465 <xsl:apply-templates mode=
"gallery.mode"/>
466 <div class=
"gallery-spacer"> </div>
475 <xsl:template match=
"link" mode=
"gallery.mode">
476 <div class=
"gallery-float">
477 <xsl:apply-templates select=
"."/>
481 <!-- add gallery handling to refnamediv template -->
482 <xsl:template match=
"refnamediv">
483 <div class=
"{name(.)}">
485 <tr><td valign=
"top">
486 <xsl:call-template name=
"anchor"/>
488 <xsl:when test=
"$refentry.generate.name != 0">
490 <xsl:call-template name=
"gentext">
491 <xsl:with-param name=
"key" select=
"'RefName'"/>
495 <xsl:when test=
"$refentry.generate.title != 0">
498 <xsl:when test=
"../refmeta/refentrytitle">
499 <xsl:apply-templates select=
"../refmeta/refentrytitle"/>
502 <xsl:apply-templates select=
"refname[1]"/>
509 <xsl:apply-templates/>
512 <td valign=
"top" align=
"right">
513 <!-- find the gallery image to use here
514 - determine the id of the enclosing refentry
515 - look for an inlinegraphic inside a link with linkend == refentryid inside a para with role == gallery
518 <xsl:variable name=
"refentryid" select=
"../@id"/>
519 <xsl:apply-templates select=
"key('gallery.key', $refentryid)/inlinegraphic"/>
525 <!-- Exterminate any trace of indexterms in the main flow -->
526 <xsl:template match=
"indexterm">
529 <!-- ==================================================================== -->
531 <xsl:template match=
"acronym">
532 <xsl:call-template name=
"generate.acronym.link"/>
535 <xsl:template name=
"generate.acronym.link">
536 <xsl:param name=
"acronym">
537 <xsl:apply-templates/>
540 We use for-each to change context to the database document because key()
541 only locates elements in the same document as the context node!
544 <xsl:param name=
"value" >
545 <xsl:value-of select=
"key('acronym.key', $acronym)/../glossdef/para[1]" />
548 <xsl:when test=
"$value=''">
551 In gtk-doc.xsl: For acronym (
<xsl:value-of select=
"$acronym"/>) no value found!
554 <xsl:attribute name=
"href">
555 <xsl:text>http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=
</xsl:text>
556 <xsl:value-of select=
"$acronym"/>
558 <xsl:call-template name=
"inline.charseq"/>
564 <xsl:attribute name=
"title">
565 <xsl:value-of select=
"$value"/>
567 <xsl:call-template name=
"inline.charseq"/>