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=
"doctype-public"/>
25 <xsl:with-param name=
"content">
26 <xsl:call-template name=
"devhelp2"/>
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"/>
37 <xsl:variable name=
"link">
38 <xsl:call-template name=
"href.target"/>
40 <xsl:variable name=
"author">
41 <xsl:if test=
"articleinfo|bookinfo">
42 <xsl:apply-templates mode=
"generate.devhelp2.authors"
43 select=
"articleinfo|bookinfo"/>
46 <xsl:variable name=
"toc.nodes" select=
"part|reference|preface|chapter|
47 appendix|article|bibliography|
48 glossary|index|refentry|
51 <book title=
"{$title}" link=
"{$link}" author=
"{$author}" name=
"{$gtkdoc.bookname}" version=
"2" language=
"c">
52 <xsl:if test=
"$toc.nodes">
54 <xsl:apply-templates select=
"$toc.nodes"
55 mode=
"generate.devhelp2.toc.mode"/>
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"/>
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"/>
71 <xsl:variable name=
"target">
72 <xsl:variable name=
"anchor" select=
"title/anchor"/>
74 <xsl:when test=
"$anchor">
75 <xsl:call-template name=
"href.target">
76 <xsl:with-param name=
"object" select=
"$anchor"/>
80 <xsl:call-template name=
"href.target"/>
85 <sub name=
"{$title}" link=
"{$target}">
86 <xsl:apply-templates select=
"section|sect1|
88 bridgehead|part|chapter|glossary|index"
89 mode=
"generate.devhelp2.toc.mode"/>
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">
100 <xsl:when test=
"$anchor">
101 <xsl:call-template name=
"href.target">
102 <xsl:with-param name=
"object" select=
"$anchor"/>
106 <xsl:call-template name=
"href.target"/>
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(.,':')"/>
117 <xsl:when test=
"string-length($attrname)=0">
118 <xsl:variable name=
"attrname2">
119 <xsl:value-of select=
"."/>
121 <xsl:attribute name=
"{$attrname2}"/>
124 <xsl:attribute name=
"{$attrname}">
125 <xsl:value-of select=
"substring-after(.,':')"/>
135 <xsl:template match=
"article" mode=
"generate.devhelp2.toc.title.mode">
136 <xsl:value-of select=
"articleinfo/title"/>
138 <xsl:template match=
"book" mode=
"generate.devhelp2.toc.title.mode">
139 <xsl:value-of select=
"bookinfo/title"/>
141 <xsl:template match=
"refentry" mode=
"generate.devhelp2.toc.title.mode">
142 <xsl:value-of select=
"refmeta/refentrytitle"/>
144 <xsl:template match=
"*" mode=
"generate.devhelp2.toc.title.mode">
145 <xsl:value-of select=
"title"/>
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>