2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5 <!-- ********************************************************************
6 $Id: refentry.xsl 8421 2009-05-04 07:49:49Z bobstayton $
7 ********************************************************************
9 This file is part of the XSL DocBook Stylesheet distribution.
10 See ../README or http://docbook.sf.net/release/xsl/current/ for
11 copyright and other information.
13 ******************************************************************** -->
15 <!-- ==================================================================== -->
17 <xsl:template match="reference">
18 <xsl:call-template name="id.warning"/>
21 <xsl:call-template name="common.html.attributes">
22 <xsl:with-param name="inherit" select="1"/>
24 <xsl:if test="$generate.id.attributes != 0">
25 <xsl:attribute name="id">
26 <xsl:call-template name="object.id"/>
30 <xsl:call-template name="reference.titlepage"/>
32 <xsl:variable name="toc.params">
33 <xsl:call-template name="find.path.params">
34 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
38 <xsl:if test="not(partintro) and contains($toc.params, 'toc')">
39 <xsl:call-template name="division.toc"/>
41 <xsl:apply-templates/>
45 <xsl:template match="reference" mode="division.number">
46 <xsl:number from="book" count="reference" format="I."/>
49 <xsl:template match="reference/docinfo"></xsl:template>
50 <xsl:template match="reference/referenceinfo"></xsl:template>
51 <xsl:template match="reference/title"></xsl:template>
52 <xsl:template match="reference/subtitle"></xsl:template>
53 <xsl:template match="reference/titleabbrev"></xsl:template>
55 <!-- ==================================================================== -->
57 <xsl:template name="refentry.title">
58 <xsl:param name="node" select="."/>
59 <xsl:variable name="refmeta" select="$node//refmeta"/>
60 <xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
61 <xsl:variable name="refnamediv" select="$node//refnamediv"/>
62 <xsl:variable name="refname" select="$refnamediv//refname"/>
63 <xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/>
64 <xsl:variable name="title">
66 <xsl:when test="$refentrytitle">
67 <xsl:apply-templates select="$refentrytitle[1]" mode="title"/>
69 <xsl:when test="$refdesc">
70 <xsl:apply-templates select="$refdesc[1]" mode="title"/>
72 <xsl:when test="$refname">
73 <xsl:apply-templates select="$refname[1]" mode="title"/>
75 <xsl:otherwise></xsl:otherwise>
80 <xsl:copy-of select="$title"/>
84 <xsl:template match="refentry">
85 <xsl:call-template name="id.warning"/>
88 <xsl:call-template name="common.html.attributes">
89 <xsl:with-param name="inherit" select="1"/>
91 <xsl:if test="$refentry.separator != 0 and preceding-sibling::refentry">
92 <div class="refentry.separator">
96 <xsl:call-template name="anchor">
97 <xsl:with-param name="conditional" select="0"/>
99 <xsl:call-template name="refentry.titlepage"/>
100 <xsl:apply-templates/>
101 <xsl:call-template name="process.footnotes"/>
105 <xsl:template match="refentry/docinfo|refentry/refentryinfo"></xsl:template>
106 <xsl:template match="refentry/info"></xsl:template>
108 <xsl:template match="refentrytitle|refname|refdescriptor" mode="title">
109 <xsl:apply-templates/>
112 <xsl:template match="refmeta">
115 <xsl:template match="manvolnum">
116 <xsl:if test="$refentry.xref.manvolnum != 0">
117 <xsl:text>(</xsl:text>
118 <xsl:apply-templates/>
119 <xsl:text>)</xsl:text>
123 <xsl:template match="refmiscinfo">
126 <xsl:template match="refentrytitle">
127 <xsl:call-template name="inline.charseq"/>
130 <xsl:template match="refnamediv">
132 <xsl:call-template name="common.html.attributes">
133 <xsl:with-param name="inherit" select="1"/>
135 <xsl:call-template name="anchor"/>
138 <xsl:when test="preceding-sibling::refnamediv">
139 <!-- no title on secondary refnamedivs! -->
141 <xsl:when test="$refentry.generate.name != 0">
143 <xsl:call-template name="gentext">
144 <xsl:with-param name="key" select="'RefName'"/>
148 <xsl:when test="$refentry.generate.title != 0">
151 <xsl:when test="../refmeta/refentrytitle">
152 <xsl:apply-templates select="../refmeta/refentrytitle"/>
155 <xsl:apply-templates select="refname[1]"/>
163 <xsl:apply-templates/>
168 <xsl:template match="refname">
169 <xsl:if test="not(preceding-sibling::refdescriptor)">
170 <xsl:apply-templates/>
171 <xsl:if test="following-sibling::refname">
172 <xsl:text>, </xsl:text>
177 <xsl:template match="refpurpose">
178 <xsl:if test="node()">
179 <xsl:text> </xsl:text>
180 <xsl:call-template name="dingbat">
181 <xsl:with-param name="dingbat">em-dash</xsl:with-param>
183 <xsl:text> </xsl:text>
184 <xsl:apply-templates/>
188 <xsl:template match="refdescriptor">
189 <xsl:apply-templates/>
192 <xsl:template match="refclass">
193 <xsl:if test="$refclass.suppress = 0">
195 <xsl:if test="@role">
196 <xsl:value-of select="@role"/>
197 <xsl:text>: </xsl:text>
199 <xsl:apply-templates/>
204 <xsl:template match="refsynopsisdiv">
206 <xsl:call-template name="common.html.attributes">
207 <xsl:with-param name="inherit" select="1"/>
209 <xsl:call-template name="anchor"/>
212 <xsl:when test="refsynopsisdiv/title|title">
213 <xsl:apply-templates select="(refsynopsisdiv/title|title)[1]"
214 mode="titlepage.mode"/>
217 <xsl:call-template name="gentext">
218 <xsl:with-param name="key" select="'RefSynopsisDiv'"/>
223 <xsl:apply-templates/>
227 <xsl:template match="refsynopsisdivinfo"></xsl:template>
229 <xsl:template match="refsynopsisdiv/title">
232 <xsl:template match="refsynopsisdiv/title" mode="titlepage.mode">
233 <xsl:apply-templates/>
236 <xsl:template match="refsection|refsect1|refsect2|refsect3">
238 <xsl:call-template name="common.html.attributes">
239 <xsl:with-param name="inherit" select="1"/>
241 <xsl:call-template name="anchor">
242 <xsl:with-param name="conditional" select="0"/>
244 <!-- pick up info title -->
245 <xsl:apply-templates select="(title|info/title)[1]"/>
246 <xsl:apply-templates select="node()[not(self::title) and not(self::info)]"/>
250 <xsl:template match="refsection/title|refsection/info/title">
251 <!-- the ID is output in the block.object call for refsect1 -->
252 <xsl:variable name="level" select="count(ancestor-or-self::refsection)"/>
253 <xsl:variable name="refsynopsisdiv">
254 <xsl:text>0</xsl:text>
255 <xsl:if test="ancestor::refsynopsisdiv">1</xsl:if>
257 <xsl:variable name="hlevel">
259 <xsl:when test="$level+$refsynopsisdiv > 5">6</xsl:when>
261 <xsl:value-of select="$level+1+$refsynopsisdiv"/>
265 <xsl:element name="h{$hlevel}">
266 <xsl:apply-templates/>
270 <xsl:template match="refsect1/title|refsect1/info/title">
271 <!-- the ID is output in the block.object call for refsect1 -->
273 <xsl:apply-templates/>
277 <xsl:template match="refsect2/title|refsect2/info/title">
278 <!-- the ID is output in the block.object call for refsect2 -->
280 <xsl:apply-templates/>
284 <xsl:template match="refsect3/title|refsect3/info/title">
285 <!-- the ID is output in the block.object call for refsect3 -->
287 <xsl:apply-templates/>
291 <xsl:template match="refsectioninfo|refsection/info"></xsl:template>
292 <xsl:template match="refsect1info|refsect1/info"></xsl:template>
293 <xsl:template match="refsect2info|refsect2/info"></xsl:template>
294 <xsl:template match="refsect3info|refsect3/info"></xsl:template>
297 <!-- ==================================================================== -->