Updated Spanish translation
[gtk-doc.git] / gtk-doc-single.xsl
blobbbc5f2605e5be6b9ef47b6c45050ac17fd2a09a2
1 <?xml version='1.0'?> <!--*- mode: xml -*-->
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 version="1.0">
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"
11 use="."/>
12 <xsl:key name="gallery.key"
13 match="para[@role='gallery']/link"
14 use="@linkend"/>
16 <!-- change some parameters -->
17 <xsl:param name="toc.section.depth">2</xsl:param>
18 <xsl:param name="generate.toc">
19 book toc
20 chapter toc
21 part toc
22 reference toc
23 </xsl:param>
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>
50 </xsl:call-template>
51 </xsl:variable>
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/
57 </xsl:message>
58 </xsl:if>
59 <xsl:apply-imports/>
61 <!-- generate the index.sgml href index -->
62 <xsl:call-template name="generate.index"/>
63 </xsl:template>
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 -->
72 <!--
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.
76 -->
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"/>
80 </xsl:with-param>
81 <xsl:with-param name="default.encoding" select="'UTF-8'"/>
82 <xsl:with-param name="chunker.output.indent" select="'no'"/>
83 </xsl:call-template>
84 </xsl:template>
86 <xsl:template match="*" mode="generate.index.mode">
87 <xsl:if test="not(@href) and count(@id) > 0">
88 <xsl:text>&lt;ANCHOR id=&quot;</xsl:text>
89 <xsl:value-of select="@id"/>
90 <xsl:text>&quot; href=&quot;</xsl:text>
91 <xsl:if test="$gtkdoc.bookname">
92 <xsl:value-of select="$gtkdoc.bookname"/>
93 <xsl:text>/</xsl:text>
94 </xsl:if>
95 <xsl:call-template name="href.target"/>
96 <xsl:text>&quot;&gt;&#10;</xsl:text>
97 </xsl:if>
98 </xsl:template>
100 <xsl:template match="//releaseinfo/ulink" mode="generate.index.mode">
101 <xsl:if test="@role='online-location'">
102 <xsl:text>&lt;ONLINE href=&quot;</xsl:text>
103 <xsl:value-of select="@url"/>
104 <xsl:text>&quot;&gt;&#10;</xsl:text>
105 </xsl:if>
106 </xsl:template>
108 <!-- ========================================================= -->
109 <!-- template to output gtkdoclink elements for the unknown targets -->
111 <xsl:template match="link">
112 <xsl:choose>
113 <xsl:when test="id(@linkend)">
114 <xsl:apply-imports/>
115 </xsl:when>
116 <xsl:otherwise>
117 <GTKDOCLINK HREF="{@linkend}">
118 <xsl:apply-templates/>
119 </GTKDOCLINK>
120 </xsl:otherwise>
121 </xsl:choose>
122 </xsl:template>
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">
133 <hr/>
134 </xsl:if>
135 <xsl:apply-imports/>
136 </xsl:template>
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)"/>
142 </xsl:if>
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
150 |//reference
151 |//preface
152 |//chapter
153 |//article
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="."/>
162 </xsl:call-template>
163 </xsl:attribute>
164 <xsl:attribute name="title">
165 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
166 </xsl:attribute>
167 </link>
168 </xsl:for-each>
169 </xsl:template>
171 <xsl:template name="user.footer.content">
172 <div class="footer">
173 <hr />
174 <xsl:choose>
175 <xsl:when test="$gtkdoc.version">
176 Generated by GTK-Doc V<xsl:copy-of select="$gtkdoc.version" />
177 </xsl:when>
178 <xsl:otherwise>
179 Generated by GTK-Doc
180 </xsl:otherwise>
181 </xsl:choose>
182 </div>
183 </xsl:template>
185 <xsl:template match="title" mode="book.titlepage.recto.mode">
186 <table class="navigation" id="top" width="100%"
187 cellpadding="2" cellspacing="0">
188 <tr>
189 <th valign="middle">
190 <p class="{name(.)}">
191 <xsl:value-of select="."/>
192 </p>
193 </th>
194 </tr>
195 </table>
196 </xsl:template>
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']"/>
216 <!--
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">
227 <tr valign="middle">
228 <xsl:choose>
229 <xsl:when test="count($prev) > 0">
230 <td>
231 <a accesskey="p">
232 <xsl:attribute name="href">
233 <xsl:call-template name="href.target">
234 <xsl:with-param name="object" select="$prev"/>
235 </xsl:call-template>
236 </xsl:attribute>
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>
241 </xsl:call-template>
242 </xsl:attribute>
243 </img>
244 </a>
245 </td>
246 </xsl:when>
247 <xsl:otherwise>
248 <td>&#160;</td>
249 </xsl:otherwise>
250 </xsl:choose>
251 <xsl:choose>
252 <xsl:when test="count($up) > 0 and $up != $home">
253 <td>
254 <a accesskey="u">
255 <xsl:attribute name="href">
256 <xsl:call-template name="href.target">
257 <xsl:with-param name="object" select="$up"/>
258 </xsl:call-template>
259 </xsl:attribute>
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>
264 </xsl:call-template>
265 </xsl:attribute>
266 </img>
267 </a>
268 </td>
269 </xsl:when>
270 <xsl:otherwise>
271 <td>&#160;</td>
272 </xsl:otherwise>
273 </xsl:choose>
274 <xsl:choose>
275 <xsl:when test="$home != .">
276 <td>
277 <a accesskey="h">
278 <xsl:attribute name="href">
279 <xsl:call-template name="href.target">
280 <xsl:with-param name="object" select="$home"/>
281 </xsl:call-template>
282 </xsl:attribute>
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>
287 </xsl:call-template>
288 </xsl:attribute>
289 </img>
290 </a>
291 </td>
292 </xsl:when>
293 <xsl:otherwise>
294 <td>&#160;</td>
295 </xsl:otherwise>
296 </xsl:choose>
297 <th width="100%" align="center">
298 <xsl:apply-templates select="$home" mode="object.title.markup"/>
299 </th>
300 <xsl:choose>
301 <xsl:when test="count($next) > 0">
302 <td>
303 <a accesskey="n">
304 <xsl:attribute name="href">
305 <xsl:call-template name="href.target">
306 <xsl:with-param name="object" select="$next"/>
307 </xsl:call-template>
308 </xsl:attribute>
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>
313 </xsl:call-template>
314 </xsl:attribute>
315 </img>
316 </a>
317 </td>
318 </xsl:when>
319 <xsl:otherwise>
320 <td>&#160;</td>
321 </xsl:otherwise>
322 </xsl:choose>
323 </tr>
324 <!--<xsl:if test="name()='refentry'"-->
325 <xsl:if test="count($sections) > 0">
326 <tr>
327 <td colspan="5" class="shortcuts">
328 <xsl:if test="count($sect_synopsis) > 0">
329 <a href="#{$section_id}.synopsis" class="shortcut">Top</a>
330 </xsl:if>
331 <xsl:if test="count($sect_desc) > 0">
332 &#160;|&#160;
333 <a href="#{$section_id}.description" class="shortcut">
334 <xsl:value-of select="./refsect1[@role='desc']/title"/>
335 </a>
336 </xsl:if>
337 <xsl:if test="count($sect_object_hierarchy) > 0">
338 &#160;|&#160;
339 <a href="#{$section_id}.object-hierarchy" class="shortcut">
340 <xsl:value-of select="./refsect1[@role='object_hierarchy']/title"/>
341 </a>
342 </xsl:if>
343 <xsl:if test="count($sect_impl_interfaces) > 0">
344 &#160;|&#160;
345 <a href="#{$section_id}.implemented-interfaces" class="shortcut">
346 <xsl:value-of select="./refsect1[@role='impl_interfaces']/title"/>
347 </a>
348 </xsl:if>
349 <xsl:if test="count($sect_prerequisites) > 0">
350 &#160;|&#160;
351 <a href="#{$section_id}.prerequisites" class="shortcut">
352 <xsl:value-of select="./refsect1[@role='prerequisites']/title"/>
353 </a>
354 </xsl:if>
355 <xsl:if test="count($sect_derived_interfaces) > 0">
356 &#160;|&#160;
357 <a href="#{$section_id}.derived-interfaces" class="shortcut">
358 <xsl:value-of select="./refsect1[@role='derived_interfaces']/title"/>
359 </a>
360 </xsl:if>
361 <xsl:if test="count($sect_implementations) > 0">
362 &#160;|&#160;
363 <a href="#{$section_id}.implementations" class="shortcut">
364 <xsl:value-of select="./refsect1[@role='implementations']/title"/>
365 </a>
366 </xsl:if>
367 <xsl:if test="count($sect_properties) > 0">
368 &#160;|&#160;
369 <a href="#{$section_id}.properties" class="shortcut">
370 <xsl:value-of select="./refsect1[@role='properties']/title"/>
371 </a>
372 </xsl:if>
373 <xsl:if test="count($sect_child_properties) > 0">
374 &#160;|&#160;
375 <a href="#{$section_id}.child-properties" class="shortcut">
376 <xsl:value-of select="./refsect1[@role='child_properties']/title"/>
377 </a>
378 </xsl:if>
379 <xsl:if test="count($sect_style_properties) > 0">
380 &#160;|&#160;
381 <a href="#{$section_id}.style-properties" class="shortcut">
382 <xsl:value-of select="./refsect1[@role='style_properties']/title"/>
383 </a>
384 </xsl:if>
385 <xsl:if test="count($sect_signal_proto) > 0">
386 &#160;|&#160;
387 <a href="#{$section_id}.signals" class="shortcut">
388 <xsl:value-of select="./refsect1[@role='signal_proto']/title"/>
389 </a>
390 </xsl:if>
391 <!--
392 <xsl:if test="count($sect_details) > 0">
393 <a href="#details" class="shortcut">
394 <xsl:value-of select="./refsect1[@id='details']/title"/>
395 </a>
396 &#160;|&#160;
397 </xsl:if>
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"/>
401 </a>
402 &#160;|&#160;
403 </xsl:if>
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"/>
407 </a>
408 &#160;|&#160;
409 </xsl:if>
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"/>
413 </a>
414 &#160;|&#160;
415 </xsl:if>
416 <xsl:if test="count($sect_signals) > 0">
417 <a href="#signals" class="shortcut">
418 <xsl:value-of select="./refsect1[@id='signals']/title"/>
419 </a>
420 &#160;|&#160;
421 </xsl:if>
423 </td>
424 </tr>
425 </xsl:if>
426 </table>
427 </xsl:if>
428 </xsl:template>
430 <xsl:template name="footer.navigation">
431 </xsl:template>
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>
441 </xsl:call-template>
442 </xsl:variable>
443 <xsl:if test="($has-filtered-index = 1) or (count(@role) = 0)">
444 <xsl:apply-imports/>
445 </xsl:if>
446 </xsl:template>
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>
453 </xsl:call-template>
454 </xsl:variable>
455 <xsl:if test="($has-filtered-index = 1) or (count(@role) = 0)">
456 <xsl:apply-imports/>
457 </xsl:if>
458 </xsl:template>
460 <xsl:template match="para">
461 <xsl:choose>
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>
467 </div>
468 </xsl:when>
469 <xsl:otherwise>
470 <xsl:apply-imports/>
471 </xsl:otherwise>
472 </xsl:choose>
473 </xsl:template>
475 <xsl:template match="link" mode="gallery.mode">
476 <div class="gallery-float">
477 <xsl:apply-templates select="."/>
478 </div>
479 </xsl:template>
481 <!-- add gallery handling to refnamediv template -->
482 <xsl:template match="refnamediv">
483 <div class="{name(.)}">
484 <table width="100%">
485 <tr><td valign="top">
486 <xsl:call-template name="anchor"/>
487 <xsl:choose>
488 <xsl:when test="$refentry.generate.name != 0">
489 <h2>
490 <xsl:call-template name="gentext">
491 <xsl:with-param name="key" select="'RefName'"/>
492 </xsl:call-template>
493 </h2>
494 </xsl:when>
495 <xsl:when test="$refentry.generate.title != 0">
496 <h2>
497 <xsl:choose>
498 <xsl:when test="../refmeta/refentrytitle">
499 <xsl:apply-templates select="../refmeta/refentrytitle"/>
500 </xsl:when>
501 <xsl:otherwise>
502 <xsl:apply-templates select="refname[1]"/>
503 </xsl:otherwise>
504 </xsl:choose>
505 </h2>
506 </xsl:when>
507 </xsl:choose>
509 <xsl:apply-templates/>
510 </p>
511 </td>
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
516 - use it here
518 <xsl:variable name="refentryid" select="../@id"/>
519 <xsl:apply-templates select="key('gallery.key', $refentryid)/inlinegraphic"/>
520 </td></tr>
521 </table>
522 </div>
523 </xsl:template>
525 <!-- Exterminate any trace of indexterms in the main flow -->
526 <xsl:template match="indexterm">
527 </xsl:template>
529 <!-- ==================================================================== -->
531 <xsl:template match="acronym">
532 <xsl:call-template name="generate.acronym.link"/>
533 </xsl:template>
535 <xsl:template name="generate.acronym.link">
536 <xsl:param name="acronym">
537 <xsl:apply-templates/>
538 </xsl:param>
539 <!--
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]" />
546 </xsl:param>
547 <xsl:choose>
548 <xsl:when test="$value=''">
549 <!-- debug -->
550 <xsl:message>
551 In gtk-doc.xsl: For acronym (<xsl:value-of select="$acronym"/>) no value found!
552 </xsl:message>
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"/>
557 </xsl:attribute>
558 <xsl:call-template name="inline.charseq"/>
559 </a>
560 </xsl:when>
561 <xsl:otherwise>
562 <!-- found -->
563 <acronym>
564 <xsl:attribute name="title">
565 <xsl:value-of select="$value"/>
566 </xsl:attribute>
567 <xsl:call-template name="inline.charseq"/>
568 </acronym>
569 </xsl:otherwise>
570 </xsl:choose>
571 </xsl:template>
573 </xsl:stylesheet>