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">
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"/>
62 <xsl:template match=
"*" mode=
"generate.devhelp2.toc.mode">
63 <xsl:variable name=
"title">
64 <xsl:apply-templates select=
"." mode=
"generate.devhelp2.toc.title.mode"/>
66 <xsl:variable name=
"target">
67 <xsl:variable name=
"anchor" select=
"title/anchor"/>
69 <xsl:when test=
"$anchor">
70 <xsl:call-template name=
"href.target">
71 <xsl:with-param name=
"object" select=
"$anchor"/>
75 <xsl:call-template name=
"href.target"/>
80 <sub name=
"{$title}" link=
"{$target}">
81 <xsl:apply-templates select=
"section|sect1|
83 bridgehead|part|chapter"
84 mode=
"generate.devhelp2.toc.mode"/>
88 <xsl:template match=
"*" mode=
"generate.devhelp2.index.mode">
89 <xsl:variable name=
"title" select=
"title"/>
90 <xsl:variable name=
"anchor" select=
"title/anchor"/>
91 <xsl:variable name=
"type" select=
"title/anchor/@role"/>
92 <xsl:variable name=
"condition" select=
"title/anchor/@condition"/>
93 <xsl:variable name=
"target">
95 <xsl:when test=
"$anchor">
96 <xsl:call-template name=
"href.target">
97 <xsl:with-param name=
"object" select=
"$anchor"/>
101 <xsl:call-template name=
"href.target"/>
105 <keyword type=
"{$type}" name=
"{$title}" link=
"{$target}">
106 <xsl:if test=
"$condition">
107 <xsl:for-each select=
"str:split($condition,'|')">
108 <xsl:variable name=
"attrname">
109 <xsl:value-of select=
"substring-before(.,':')"/>
112 <xsl:when test=
"string-length($attrname)=0">
113 <xsl:variable name=
"attrname2">
114 <xsl:value-of select=
"."/>
116 <xsl:attribute name=
"{$attrname2}"/>
119 <xsl:attribute name=
"{$attrname}">
120 <xsl:value-of select=
"substring-after(.,':')"/>
130 <xsl:template match=
"article" mode=
"generate.devhelp2.toc.title.mode">
131 <xsl:value-of select=
"articleinfo/title"/>
133 <xsl:template match=
"book" mode=
"generate.devhelp2.toc.title.mode">
134 <xsl:value-of select=
"bookinfo/title"/>
136 <xsl:template match=
"refentry" mode=
"generate.devhelp2.toc.title.mode">
137 <xsl:value-of select=
"refmeta/refentrytitle"/>
139 <xsl:template match=
"*" mode=
"generate.devhelp2.toc.title.mode">
140 <xsl:value-of select=
"title"/>
143 <!-- generate list of authors ... -->
144 <xsl:template match=
"articleinfo|bookinfo" mode=
"generate.devhelp2.authors">
145 <xsl:for-each select=
"authorgroup/author">
146 <xsl:value-of select=
"firstname"/>
147 <xsl:text> </xsl:text>
148 <xsl:value-of select=
"surname"/>
149 <xsl:if test=
"not(last())">
150 <xsl:text>,
</xsl:text>