2 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
5 <!-- ********************************************************************
6 $Id: refentry.xsl,v 1.1 2007/03/10 05:15:13 scott Exp $
7 ********************************************************************
9 This file is part of the XSL DocBook Stylesheet distribution.
10 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
11 and other information.
13 ******************************************************************** -->
15 <!-- ==================================================================== -->
17 <xsl:template match=
"reference">
18 <xsl:call-template name=
"id.warning"/>
21 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
22 <xsl:call-template name=
"dir">
23 <xsl:with-param name=
"inherit" select=
"1"/>
25 <xsl:call-template name=
"language.attribute"/>
26 <xsl:if test=
"$generate.id.attributes != 0">
27 <xsl:attribute name=
"id">
28 <xsl:call-template name=
"object.id"/>
32 <xsl:call-template name=
"reference.titlepage"/>
34 <xsl:variable name=
"toc.params">
35 <xsl:call-template name=
"find.path.params">
36 <xsl:with-param name=
"table" select=
"normalize-space($generate.toc)"/>
40 <xsl:if test=
"not(partintro) and contains($toc.params, 'toc')">
41 <xsl:call-template name=
"division.toc"/>
43 <xsl:apply-templates/>
47 <xsl:template match=
"reference" mode=
"division.number">
48 <xsl:number from=
"book" count=
"reference" format=
"I."/>
51 <xsl:template match=
"reference/docinfo"></xsl:template>
52 <xsl:template match=
"reference/referenceinfo"></xsl:template>
53 <xsl:template match=
"reference/title"></xsl:template>
54 <xsl:template match=
"reference/subtitle"></xsl:template>
55 <xsl:template match=
"reference/titleabbrev"></xsl:template>
57 <!-- ==================================================================== -->
59 <xsl:template name=
"refentry.title">
60 <xsl:param name=
"node" select=
"."/>
61 <xsl:variable name=
"refmeta" select=
"$node//refmeta"/>
62 <xsl:variable name=
"refentrytitle" select=
"$refmeta//refentrytitle"/>
63 <xsl:variable name=
"refnamediv" select=
"$node//refnamediv"/>
64 <xsl:variable name=
"refname" select=
"$refnamediv//refname"/>
65 <xsl:variable name=
"refdesc" select=
"$refnamediv//refdescriptor"/>
66 <xsl:variable name=
"title">
68 <xsl:when test=
"$refentrytitle">
69 <xsl:apply-templates select=
"$refentrytitle[1]" mode=
"title"/>
71 <xsl:when test=
"$refdesc">
72 <xsl:apply-templates select=
"$refdesc[1]" mode=
"title"/>
74 <xsl:when test=
"$refname">
75 <xsl:apply-templates select=
"$refname[1]" mode=
"title"/>
77 <xsl:otherwise></xsl:otherwise>
82 <xsl:copy-of select=
"$title"/>
86 <xsl:template match=
"refentry">
87 <xsl:call-template name=
"id.warning"/>
90 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
91 <xsl:call-template name=
"dir">
92 <xsl:with-param name=
"inherit" select=
"1"/>
94 <xsl:call-template name=
"language.attribute"/>
95 <xsl:if test=
"$refentry.separator != 0 and preceding-sibling::refentry">
96 <div class=
"refentry.separator">
100 <xsl:call-template name=
"anchor">
101 <xsl:with-param name=
"conditional" select=
"0"/>
103 <xsl:call-template name=
"refentry.titlepage"/>
104 <xsl:apply-templates/>
105 <xsl:call-template name=
"process.footnotes"/>
109 <xsl:template match=
"refentry/docinfo|refentry/refentryinfo"></xsl:template>
110 <xsl:template match=
"refentry/info"></xsl:template>
112 <xsl:template match=
"refentrytitle|refname|refdescriptor" mode=
"title">
113 <xsl:apply-templates/>
116 <xsl:template match=
"refmeta">
119 <xsl:template match=
"manvolnum">
120 <xsl:if test=
"$refentry.xref.manvolnum != 0">
121 <xsl:text>(
</xsl:text>
122 <xsl:apply-templates/>
123 <xsl:text>)
</xsl:text>
127 <xsl:template match=
"refmiscinfo">
130 <xsl:template match=
"refentrytitle">
131 <xsl:call-template name=
"inline.charseq"/>
134 <xsl:template match=
"refnamediv">
136 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
137 <xsl:call-template name=
"dir">
138 <xsl:with-param name=
"inherit" select=
"1"/>
140 <xsl:call-template name=
"anchor"/>
143 <xsl:when test=
"preceding-sibling::refnamediv">
144 <!-- no title on secondary refnamedivs! -->
146 <xsl:when test=
"$refentry.generate.name != 0">
148 <xsl:call-template name=
"gentext">
149 <xsl:with-param name=
"key" select=
"'RefName'"/>
153 <xsl:when test=
"$refentry.generate.title != 0">
156 <xsl:when test=
"../refmeta/refentrytitle">
157 <xsl:apply-templates select=
"../refmeta/refentrytitle"/>
160 <xsl:apply-templates select=
"refname[1]"/>
168 <xsl:apply-templates/>
173 <xsl:template match=
"refname">
174 <xsl:if test=
"not(preceding-sibling::refdescriptor)">
175 <xsl:apply-templates/>
176 <xsl:if test=
"following-sibling::refname">
177 <xsl:text>,
</xsl:text>
182 <xsl:template match=
"refpurpose">
183 <xsl:if test=
"node()">
184 <xsl:text> </xsl:text>
185 <xsl:call-template name=
"dingbat">
186 <xsl:with-param name=
"dingbat">em-dash
</xsl:with-param>
188 <xsl:text> </xsl:text>
189 <xsl:apply-templates/>
193 <xsl:template match=
"refdescriptor">
194 <xsl:apply-templates/>
197 <xsl:template match=
"refclass">
198 <xsl:if test=
"$refclass.suppress = 0">
201 <xsl:if test=
"@role">
202 <xsl:value-of select=
"@role"/>
203 <xsl:text>:
</xsl:text>
205 <xsl:apply-templates/>
211 <xsl:template match=
"refsynopsisdiv">
213 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
214 <xsl:call-template name=
"dir">
215 <xsl:with-param name=
"inherit" select=
"1"/>
217 <xsl:call-template name=
"anchor"/>
220 <xsl:when test=
"refsynopsisdiv/title|title">
221 <xsl:apply-templates select=
"(refsynopsisdiv/title|title)[1]"
222 mode=
"titlepage.mode"/>
225 <xsl:call-template name=
"gentext">
226 <xsl:with-param name=
"key" select=
"'RefSynopsisDiv'"/>
231 <xsl:apply-templates/>
235 <xsl:template match=
"refsynopsisdivinfo"></xsl:template>
237 <xsl:template match=
"refsynopsisdiv/title">
240 <xsl:template match=
"refsynopsisdiv/title" mode=
"titlepage.mode">
241 <xsl:apply-templates/>
244 <xsl:template match=
"refsection|refsect1|refsect2|refsect3">
246 <xsl:apply-templates select=
"." mode=
"class.attribute"/>
247 <xsl:call-template name=
"dir">
248 <xsl:with-param name=
"inherit" select=
"1"/>
250 <xsl:call-template name=
"language.attribute"/>
251 <xsl:call-template name=
"anchor">
252 <xsl:with-param name=
"conditional" select=
"0"/>
254 <!-- pick up info title -->
255 <xsl:apply-templates select=
"(title|info/title)[1]"/>
256 <xsl:apply-templates select=
"node()[not(self::title) and not(self::info)]"/>
260 <xsl:template match=
"refsection/title|refsection/info/title">
261 <!-- the ID is output in the block.object call for refsect1 -->
262 <xsl:variable name=
"level" select=
"count(ancestor-or-self::refsection)"/>
263 <xsl:variable name=
"refsynopsisdiv">
264 <xsl:text>0</xsl:text>
265 <xsl:if test=
"ancestor::refsynopsisdiv">1</xsl:if>
267 <xsl:variable name=
"hlevel">
269 <xsl:when test=
"$level+$refsynopsisdiv > 5">6</xsl:when>
271 <xsl:value-of select=
"$level+1+$refsynopsisdiv"/>
275 <xsl:element name=
"h{$hlevel}">
276 <xsl:apply-templates/>
280 <xsl:template match=
"refsect1/title|refsect1/info/title">
281 <!-- the ID is output in the block.object call for refsect1 -->
283 <xsl:apply-templates/>
287 <xsl:template match=
"refsect2/title|refsect2/info/title">
288 <!-- the ID is output in the block.object call for refsect2 -->
290 <xsl:apply-templates/>
294 <xsl:template match=
"refsect3/title|refsect3/info/title">
295 <!-- the ID is output in the block.object call for refsect3 -->
297 <xsl:apply-templates/>
301 <xsl:template match=
"refsectioninfo|refsection/info"></xsl:template>
302 <xsl:template match=
"refsect1info|refsect1/info"></xsl:template>
303 <xsl:template match=
"refsect2info|refsect2/info"></xsl:template>
304 <xsl:template match=
"refsect3info|refsect3/info"></xsl:template>
307 <!-- ==================================================================== -->