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=
"online">
47 <xsl:value-of select=
"/book/bookinfo/releaseinfo/ulink[@role='online-location']/@url"/>
49 <xsl:variable name=
"toc.nodes" select=
"part|reference|preface|chapter|
50 appendix|article|bibliography|
51 glossary|index|refentry|
54 <book title=
"{$title}" link=
"{$link}" author=
"{$author}" name=
"{$gtkdoc.bookname}" version=
"2" language=
"c">
55 <xsl:if test=
"$online != ''">
56 <xsl:attribute name=
"online"><xsl:value-of select=
"$online"/></xsl:attribute>
58 <xsl:if test=
"$toc.nodes">
60 <xsl:apply-templates select=
"$toc.nodes"
61 mode=
"generate.devhelp2.toc.mode"/>
65 <xsl:apply-templates select=
"$gtkdoc.refsect2[@role]"
66 mode=
"generate.devhelp2.index.mode"/>
67 <xsl:apply-templates select=
"$gtkdoc.refsect2/refsect3[@role='enum_members']/informaltable/tgroup/tbody/row[@role='constant']"
68 mode=
"generate.devhelp2.index.mode"/>
69 <xsl:apply-templates select=
"$gtkdoc.refsect2/refsect3[@role='struct_members']/informaltable/tgroup/tbody/row[@role='member']"
70 mode=
"generate.devhelp2.index.mode"/>
75 <xsl:template match=
"*" mode=
"generate.devhelp2.toc.mode">
76 <xsl:variable name=
"title">
77 <xsl:apply-templates select=
"." mode=
"generate.devhelp2.toc.title.mode"/>
79 <xsl:variable name=
"target">
80 <xsl:variable name=
"anchor" select=
"title/anchor"/>
82 <xsl:when test=
"$anchor">
83 <xsl:call-template name=
"href.target">
84 <xsl:with-param name=
"object" select=
"$anchor"/>
88 <xsl:call-template name=
"href.target"/>
93 <sub name=
"{$title}" link=
"{$target}">
94 <xsl:apply-templates select=
"section|sect1|
96 bridgehead|part|chapter|glossary|index"
97 mode=
"generate.devhelp2.toc.mode"/>
101 <xsl:template match=
"*" mode=
"generate.devhelp2.index.mode">
102 <xsl:variable name=
"title" select=
"title|
104 entry[@role='enum_member_name']/para|
105 entry[@role='struct_member_name']/para/structfield/@id"/>
106 <xsl:variable name=
"anchor" select=
"title/anchor|
107 entry[@role='enum_member_name']/para|
108 entry[@role='struct_member_name']/para/structfield"/>
109 <xsl:variable name=
"type" select=
"@role"/>
110 <xsl:variable name=
"condition" select=
"@condition"/>
111 <xsl:variable name=
"target">
113 <xsl:when test=
"$anchor">
114 <xsl:call-template name=
"href.target">
115 <xsl:with-param name=
"object" select=
"$anchor"/>
119 <xsl:call-template name=
"href.target"/>
123 <keyword type=
"{$type}" name=
"{$title}" link=
"{$target}">
124 <xsl:if test=
"$condition">
125 <xsl:for-each select=
"str:split($condition,'|')">
126 <xsl:variable name=
"attrname">
127 <xsl:value-of select=
"substring-before(.,':')"/>
130 <xsl:when test=
"string-length($attrname)=0">
131 <xsl:variable name=
"attrname2">
132 <xsl:value-of select=
"."/>
134 <xsl:attribute name=
"{$attrname2}"/>
137 <xsl:attribute name=
"{$attrname}">
138 <xsl:value-of select=
"substring-after(.,':')"/>
148 <xsl:template match=
"article" mode=
"generate.devhelp2.toc.title.mode">
149 <xsl:value-of select=
"articleinfo/title"/>
151 <xsl:template match=
"book" mode=
"generate.devhelp2.toc.title.mode">
152 <xsl:value-of select=
"bookinfo/title"/>
154 <xsl:template match=
"refentry" mode=
"generate.devhelp2.toc.title.mode">
155 <xsl:value-of select=
"refmeta/refentrytitle"/>
157 <xsl:template match=
"*" mode=
"generate.devhelp2.toc.title.mode">
158 <xsl:value-of select=
"title"/>
161 <!-- generate list of authors ... -->
162 <xsl:template match=
"articleinfo|bookinfo" mode=
"generate.devhelp2.authors">
163 <xsl:for-each select=
"authorgroup/author">
164 <xsl:value-of select=
"firstname"/>
165 <xsl:text> </xsl:text>
166 <xsl:value-of select=
"surname"/>
167 <xsl:if test=
"not(last())">
168 <xsl:text>,
</xsl:text>