build: bumped version to 0.7.3
[adg.git] / docs / common / devhelp2.xsl
blob76a20b764ce664da3d3a13b183f3aff4aff7c4ed
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="content">
25 <xsl:call-template name="devhelp2"/>
26 </xsl:with-param>
27 </xsl:call-template>
28 </xsl:template>
30 <xsl:variable name="gtkdoc.refsect2" select="//refsect2"/>
32 <xsl:template name="devhelp2">
33 <xsl:variable name="title">
34 <xsl:apply-templates select="." mode="generate.devhelp2.toc.title.mode"/>
35 </xsl:variable>
36 <xsl:variable name="link">
37 <xsl:call-template name="href.target"/>
38 </xsl:variable>
39 <xsl:variable name="author">
40 <xsl:if test="articleinfo|bookinfo">
41 <xsl:apply-templates mode="generate.devhelp2.authors"
42 select="articleinfo|bookinfo"/>
43 </xsl:if>
44 </xsl:variable>
45 <xsl:variable name="toc.nodes" select="part|reference|preface|chapter|
46 appendix|article|bibliography|
47 glossary|index|refentry|
48 bridgehead|sect1"/>
50 <book title="{$title}" link="{$link}" author="{$author}" name="{$gtkdoc.bookname}" version="2" language="c">
51 <xsl:if test="$toc.nodes">
52 <chapters>
53 <xsl:apply-templates select="$toc.nodes"
54 mode="generate.devhelp2.toc.mode"/>
55 </chapters>
56 </xsl:if>
57 <functions>
58 <xsl:apply-templates select="$gtkdoc.refsect2"
59 mode="generate.devhelp2.index.mode"/>
60 <xsl:apply-templates select="$gtkdoc.refsect2/variablelist[@role='enum']/varlistentry"
61 mode="generate.devhelp2.index.mode"/>
62 </functions>
63 </book>
64 </xsl:template>
66 <xsl:template match="*" mode="generate.devhelp2.toc.mode">
67 <xsl:variable name="title">
68 <xsl:apply-templates select="." mode="generate.devhelp2.toc.title.mode"/>
69 </xsl:variable>
70 <xsl:variable name="target">
71 <xsl:variable name="anchor" select="title/anchor"/>
72 <xsl:choose>
73 <xsl:when test="$anchor">
74 <xsl:call-template name="href.target">
75 <xsl:with-param name="object" select="$anchor"/>
76 </xsl:call-template>
77 </xsl:when>
78 <xsl:otherwise>
79 <xsl:call-template name="href.target"/>
80 </xsl:otherwise>
81 </xsl:choose>
82 </xsl:variable>
84 <sub name="{$title}" link="{$target}">
85 <xsl:apply-templates select="section|sect1|
86 refentry|refsect|
87 bridgehead|part|chapter|glossary|index"
88 mode="generate.devhelp2.toc.mode"/>
89 </sub>
90 </xsl:template>
92 <xsl:template match="*" mode="generate.devhelp2.index.mode">
93 <xsl:variable name="title" select="title|term/literal"/>
94 <xsl:variable name="anchor" select="title/anchor"/>
95 <xsl:variable name="type" select="@role"/>
96 <xsl:variable name="condition" select="@condition"/>
97 <xsl:variable name="target">
98 <xsl:choose>
99 <xsl:when test="$anchor">
100 <xsl:call-template name="href.target">
101 <xsl:with-param name="object" select="$anchor"/>
102 </xsl:call-template>
103 </xsl:when>
104 <xsl:otherwise>
105 <xsl:call-template name="href.target"/>
106 </xsl:otherwise>
107 </xsl:choose>
108 </xsl:variable>
109 <keyword type="{$type}" name="{$title}" link="{$target}">
110 <xsl:if test="$condition">
111 <xsl:for-each select="str:split($condition,'|')">
112 <xsl:variable name="attrname">
113 <xsl:value-of select="substring-before(.,':')"/>
114 </xsl:variable>
115 <xsl:choose>
116 <xsl:when test="string-length($attrname)=0">
117 <xsl:variable name="attrname2">
118 <xsl:value-of select="."/>
119 </xsl:variable>
120 <xsl:attribute name="{$attrname2}"/>
121 </xsl:when>
122 <xsl:otherwise>
123 <xsl:attribute name="{$attrname}">
124 <xsl:value-of select="substring-after(.,':')"/>
125 </xsl:attribute>
126 </xsl:otherwise>
127 </xsl:choose>
128 </xsl:for-each>
129 </xsl:if>
130 </keyword>
131 </xsl:template>
133 <!-- get title -->
134 <xsl:template match="article" mode="generate.devhelp2.toc.title.mode">
135 <xsl:value-of select="articleinfo/title"/>
136 </xsl:template>
137 <xsl:template match="book" mode="generate.devhelp2.toc.title.mode">
138 <xsl:value-of select="bookinfo/title"/>
139 </xsl:template>
140 <xsl:template match="refentry" mode="generate.devhelp2.toc.title.mode">
141 <xsl:value-of select="refmeta/refentrytitle"/>
142 </xsl:template>
143 <xsl:template match="*" mode="generate.devhelp2.toc.title.mode">
144 <xsl:value-of select="title"/>
145 </xsl:template>
147 <!-- generate list of authors ... -->
148 <xsl:template match="articleinfo|bookinfo" mode="generate.devhelp2.authors">
149 <xsl:for-each select="authorgroup/author">
150 <xsl:value-of select="firstname"/>
151 <xsl:text> </xsl:text>
152 <xsl:value-of select="surname"/>
153 <xsl:if test="not(last())">
154 <xsl:text>, </xsl:text>
155 </xsl:if>
156 </xsl:for-each>
157 </xsl:template>
159 </xsl:stylesheet>