1 <?xml version='
1.0'
?> <!--*- mode: xml -*-->
2 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
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">
12 <xsl:when test=
"$gtkdoc.bookname">
13 <xsl:value-of select=
"$gtkdoc.bookname"/>
16 <xsl:text>book
</xsl:text>
19 <xsl:text>.devhelp2
</xsl:text>
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"/>
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"/>
36 <xsl:variable name=
"link">
37 <xsl:call-template name=
"href.target"/>
39 <xsl:variable name=
"author">
40 <xsl:if test=
"articleinfo|bookinfo">
41 <xsl:apply-templates mode=
"generate.devhelp2.authors"
42 select=
"articleinfo|bookinfo"/>
45 <xsl:variable name=
"toc.nodes" select=
"part|reference|preface|chapter|
46 appendix|article|bibliography|
47 glossary|index|refentry|
50 <book title=
"{$title}" link=
"{$link}" author=
"{$author}" name=
"{$gtkdoc.bookname}" version=
"2" language=
"c">
51 <xsl:if test=
"$toc.nodes">
53 <xsl:apply-templates select=
"$toc.nodes"
54 mode=
"generate.devhelp2.toc.mode"/>
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"/>
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"/>
70 <xsl:variable name=
"target">
71 <xsl:variable name=
"anchor" select=
"title/anchor"/>
73 <xsl:when test=
"$anchor">
74 <xsl:call-template name=
"href.target">
75 <xsl:with-param name=
"object" select=
"$anchor"/>
79 <xsl:call-template name=
"href.target"/>
84 <sub name=
"{$title}" link=
"{$target}">
85 <xsl:apply-templates select=
"section|sect1|
87 bridgehead|part|chapter|glossary|index"
88 mode=
"generate.devhelp2.toc.mode"/>
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">
99 <xsl:when test=
"$anchor">
100 <xsl:call-template name=
"href.target">
101 <xsl:with-param name=
"object" select=
"$anchor"/>
105 <xsl:call-template name=
"href.target"/>
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(.,':')"/>
116 <xsl:when test=
"string-length($attrname)=0">
117 <xsl:variable name=
"attrname2">
118 <xsl:value-of select=
"."/>
120 <xsl:attribute name=
"{$attrname2}"/>
123 <xsl:attribute name=
"{$attrname}">
124 <xsl:value-of select=
"substring-after(.,':')"/>
134 <xsl:template match=
"article" mode=
"generate.devhelp2.toc.title.mode">
135 <xsl:value-of select=
"articleinfo/title"/>
137 <xsl:template match=
"book" mode=
"generate.devhelp2.toc.title.mode">
138 <xsl:value-of select=
"bookinfo/title"/>
140 <xsl:template match=
"refentry" mode=
"generate.devhelp2.toc.title.mode">
141 <xsl:value-of select=
"refmeta/refentrytitle"/>
143 <xsl:template match=
"*" mode=
"generate.devhelp2.toc.title.mode">
144 <xsl:value-of select=
"title"/>
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>