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:template name=
"devhelp2">
31 <xsl:variable name=
"title">
32 <xsl:apply-templates select=
"." mode=
"generate.devhelp2.toc.title.mode"/>
34 <xsl:variable name=
"link">
35 <xsl:call-template name=
"href.target"/>
37 <xsl:variable name=
"author">
38 <xsl:if test=
"articleinfo|bookinfo">
39 <xsl:apply-templates mode=
"generate.devhelp2.authors"
40 select=
"articleinfo|bookinfo"/>
43 <xsl:variable name=
"toc.nodes" select=
"part|reference|preface|chapter|
44 appendix|article|bibliography|
45 glossary|index|refentry|
48 <book title=
"{$title}" link=
"{$link}" author=
"{$author}" name=
"{$gtkdoc.bookname}" version=
"2" language=
"c">
49 <xsl:if test=
"$toc.nodes">
51 <xsl:apply-templates select=
"$toc.nodes"
52 mode=
"generate.devhelp2.toc.mode"/>
56 <xsl:apply-templates select=
"//refsect2"
57 mode=
"generate.devhelp2.index.mode"/>
58 <xsl:apply-templates select=
"//refsect2/variablelist[@role='enum']/varlistentry"
59 mode=
"generate.devhelp2.index.mode"/>
64 <xsl:template match=
"*" mode=
"generate.devhelp2.toc.mode">
65 <xsl:variable name=
"title">
66 <xsl:apply-templates select=
"." mode=
"generate.devhelp2.toc.title.mode"/>
68 <xsl:variable name=
"target">
69 <xsl:variable name=
"anchor" select=
"title/anchor"/>
71 <xsl:when test=
"$anchor">
72 <xsl:call-template name=
"href.target">
73 <xsl:with-param name=
"object" select=
"$anchor"/>
77 <xsl:call-template name=
"href.target"/>
82 <sub name=
"{$title}" link=
"{$target}">
83 <xsl:apply-templates select=
"section|sect1|
85 bridgehead|part|chapter|glossary|index"
86 mode=
"generate.devhelp2.toc.mode"/>
90 <xsl:template match=
"*" mode=
"generate.devhelp2.index.mode">
91 <xsl:variable name=
"title" select=
"title|term/literal"/>
92 <xsl:variable name=
"anchor" select=
"title/anchor"/>
93 <xsl:variable name=
"type" select=
"@role"/>
94 <xsl:variable name=
"condition" select=
"@condition"/>
95 <xsl:variable name=
"target">
97 <xsl:when test=
"$anchor">
98 <xsl:call-template name=
"href.target">
99 <xsl:with-param name=
"object" select=
"$anchor"/>
103 <xsl:call-template name=
"href.target"/>
107 <keyword type=
"{$type}" name=
"{$title}" link=
"{$target}">
108 <xsl:if test=
"$condition">
109 <xsl:for-each select=
"str:split($condition,'|')">
110 <xsl:variable name=
"attrname">
111 <xsl:value-of select=
"substring-before(.,':')"/>
114 <xsl:when test=
"string-length($attrname)=0">
115 <xsl:variable name=
"attrname2">
116 <xsl:value-of select=
"."/>
118 <xsl:attribute name=
"{$attrname2}"/>
121 <xsl:attribute name=
"{$attrname}">
122 <xsl:value-of select=
"substring-after(.,':')"/>
132 <xsl:template match=
"article" mode=
"generate.devhelp2.toc.title.mode">
133 <xsl:value-of select=
"articleinfo/title"/>
135 <xsl:template match=
"book" mode=
"generate.devhelp2.toc.title.mode">
136 <xsl:value-of select=
"bookinfo/title"/>
138 <xsl:template match=
"refentry" mode=
"generate.devhelp2.toc.title.mode">
139 <xsl:value-of select=
"refmeta/refentrytitle"/>
141 <xsl:template match=
"*" mode=
"generate.devhelp2.toc.title.mode">
142 <xsl:value-of select=
"title"/>
145 <!-- generate list of authors ... -->
146 <xsl:template match=
"articleinfo|bookinfo" mode=
"generate.devhelp2.authors">
147 <xsl:for-each select=
"authorgroup/author">
148 <xsl:value-of select=
"firstname"/>
149 <xsl:text> </xsl:text>
150 <xsl:value-of select=
"surname"/>
151 <xsl:if test=
"not(last())">
152 <xsl:text>,
</xsl:text>