Updated Spanish translation
[gtk-doc.git] / devhelp2.xsl
blobc8320344e81091123357a7625e13e2728fcbb4c8
1 <?xml version='1.0'?> <!--*- mode: xml -*-->
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 version='1.0'
4 xmlns="http://www.devhelp.net/book"
5 xmlns:str="http://exslt.org/strings"
6 exclude-result-prefixes="str">
8 <xsl:template name="generate.devhelp2">
9 <xsl:call-template name="write.chunk">
10 <xsl:with-param name="filename">
11 <xsl:choose>
12 <xsl:when test="$gtkdoc.bookname">
13 <xsl:value-of select="$gtkdoc.bookname"/>
14 </xsl:when>
15 <xsl:otherwise>
16 <xsl:text>book</xsl:text>
17 </xsl:otherwise>
18 </xsl:choose>
19 <xsl:text>.devhelp2</xsl:text>
20 </xsl:with-param>
21 <xsl:with-param name="method" select="'xml'"/>
22 <xsl:with-param name="indent" select="'yes'"/>
23 <xsl:with-param name="encoding" select="'utf-8'"/>
24 <xsl:with-param name="doctype-public"/>
25 <xsl:with-param name="content">
26 <xsl:call-template name="devhelp2"/>
27 </xsl:with-param>
28 </xsl:call-template>
29 </xsl:template>
31 <xsl:variable name="gtkdoc.refsect2" select="//refsect2"/>
33 <xsl:template name="devhelp2">
34 <xsl:variable name="title">
35 <xsl:apply-templates select="." mode="generate.devhelp2.toc.title.mode"/>
36 </xsl:variable>
37 <xsl:variable name="link">
38 <xsl:call-template name="href.target"/>
39 </xsl:variable>
40 <xsl:variable name="author">
41 <xsl:if test="articleinfo|bookinfo">
42 <xsl:apply-templates mode="generate.devhelp2.authors"
43 select="articleinfo|bookinfo"/>
44 </xsl:if>
45 </xsl:variable>
46 <xsl:variable name="toc.nodes" select="part|reference|preface|chapter|
47 appendix|article|bibliography|
48 glossary|index|refentry|
49 bridgehead|sect1"/>
51 <book title="{$title}" link="{$link}" author="{$author}" name="{$gtkdoc.bookname}" version="2" language="c">
52 <xsl:if test="$toc.nodes">
53 <chapters>
54 <xsl:apply-templates select="$toc.nodes"
55 mode="generate.devhelp2.toc.mode"/>
56 </chapters>
57 </xsl:if>
58 <functions>
59 <xsl:apply-templates select="$gtkdoc.refsect2[@role]"
60 mode="generate.devhelp2.index.mode"/>
61 <xsl:apply-templates select="$gtkdoc.refsect2/refsect3[@role='enum_members']/informaltable/tgroup/tbody/row[@role='constant']"
62 mode="generate.devhelp2.index.mode"/>
63 </functions>
64 </book>
65 </xsl:template>
67 <xsl:template match="*" mode="generate.devhelp2.toc.mode">
68 <xsl:variable name="title">
69 <xsl:apply-templates select="." mode="generate.devhelp2.toc.title.mode"/>
70 </xsl:variable>
71 <xsl:variable name="target">
72 <xsl:variable name="anchor" select="title/anchor"/>
73 <xsl:choose>
74 <xsl:when test="$anchor">
75 <xsl:call-template name="href.target">
76 <xsl:with-param name="object" select="$anchor"/>
77 </xsl:call-template>
78 </xsl:when>
79 <xsl:otherwise>
80 <xsl:call-template name="href.target"/>
81 </xsl:otherwise>
82 </xsl:choose>
83 </xsl:variable>
85 <sub name="{$title}" link="{$target}">
86 <xsl:apply-templates select="section|sect1|
87 refentry|refsect|
88 bridgehead|part|chapter|glossary|index"
89 mode="generate.devhelp2.toc.mode"/>
90 </sub>
91 </xsl:template>
93 <xsl:template match="*" mode="generate.devhelp2.index.mode">
94 <xsl:variable name="title" select="title|term/literal|entry[@role='enum_member_name']/para"/>
95 <xsl:variable name="anchor" select="title/anchor|entry[@role='enum_member_name']/para"/>
96 <xsl:variable name="type" select="@role"/>
97 <xsl:variable name="condition" select="@condition"/>
98 <xsl:variable name="target">
99 <xsl:choose>
100 <xsl:when test="$anchor">
101 <xsl:call-template name="href.target">
102 <xsl:with-param name="object" select="$anchor"/>
103 </xsl:call-template>
104 </xsl:when>
105 <xsl:otherwise>
106 <xsl:call-template name="href.target"/>
107 </xsl:otherwise>
108 </xsl:choose>
109 </xsl:variable>
110 <keyword type="{$type}" name="{$title}" link="{$target}">
111 <xsl:if test="$condition">
112 <xsl:for-each select="str:split($condition,'|')">
113 <xsl:variable name="attrname">
114 <xsl:value-of select="substring-before(.,':')"/>
115 </xsl:variable>
116 <xsl:choose>
117 <xsl:when test="string-length($attrname)=0">
118 <xsl:variable name="attrname2">
119 <xsl:value-of select="."/>
120 </xsl:variable>
121 <xsl:attribute name="{$attrname2}"/>
122 </xsl:when>
123 <xsl:otherwise>
124 <xsl:attribute name="{$attrname}">
125 <xsl:value-of select="substring-after(.,':')"/>
126 </xsl:attribute>
127 </xsl:otherwise>
128 </xsl:choose>
129 </xsl:for-each>
130 </xsl:if>
131 </keyword>
132 </xsl:template>
134 <!-- get title -->
135 <xsl:template match="article" mode="generate.devhelp2.toc.title.mode">
136 <xsl:value-of select="articleinfo/title"/>
137 </xsl:template>
138 <xsl:template match="book" mode="generate.devhelp2.toc.title.mode">
139 <xsl:value-of select="bookinfo/title"/>
140 </xsl:template>
141 <xsl:template match="refentry" mode="generate.devhelp2.toc.title.mode">
142 <xsl:value-of select="refmeta/refentrytitle"/>
143 </xsl:template>
144 <xsl:template match="*" mode="generate.devhelp2.toc.title.mode">
145 <xsl:value-of select="title"/>
146 </xsl:template>
148 <!-- generate list of authors ... -->
149 <xsl:template match="articleinfo|bookinfo" mode="generate.devhelp2.authors">
150 <xsl:for-each select="authorgroup/author">
151 <xsl:value-of select="firstname"/>
152 <xsl:text> </xsl:text>
153 <xsl:value-of select="surname"/>
154 <xsl:if test="not(last())">
155 <xsl:text>, </xsl:text>
156 </xsl:if>
157 </xsl:for-each>
158 </xsl:template>
160 </xsl:stylesheet>