Imported Upstream version 1.77.1
[platform/upstream/docbook-xsl.git] / xhtml-1_1 / refentry.xsl
1 <?xml version="1.0" encoding="ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
5
6 <!-- ********************************************************************
7      $Id: refentry.xsl 9297 2012-04-22 03:56:16Z bobstayton $
8      ********************************************************************
9
10      This file is part of the XSL DocBook Stylesheet distribution.
11      See ../README or http://docbook.sf.net/release/xsl/current/ for
12      copyright and other information.
13
14      ******************************************************************** -->
15
16 <!-- ==================================================================== -->
17
18 <xsl:template match="reference">
19   <xsl:call-template name="id.warning"/>
20
21   <div>
22     <xsl:call-template name="common.html.attributes">
23       <xsl:with-param name="inherit" select="1"/>
24     </xsl:call-template>
25     <xsl:call-template name="id.attribute">
26       <xsl:with-param name="conditional" select="0"/>
27     </xsl:call-template>
28
29     <xsl:call-template name="reference.titlepage"/>
30
31     <xsl:variable name="toc.params">
32       <xsl:call-template name="find.path.params">
33         <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
34       </xsl:call-template>
35     </xsl:variable>
36
37     <xsl:if test="not(partintro) and contains($toc.params, 'toc')">
38       <xsl:call-template name="division.toc"/>
39     </xsl:if>
40     <xsl:apply-templates/>
41   </div>
42 </xsl:template>
43
44 <xsl:template match="reference" mode="division.number">
45   <xsl:number from="book" count="reference" format="I."/>
46 </xsl:template>
47
48 <xsl:template match="reference/docinfo"/>
49 <xsl:template match="reference/referenceinfo"/>
50 <xsl:template match="reference/title"/>
51 <xsl:template match="reference/subtitle"/>
52 <xsl:template match="reference/titleabbrev"/>
53
54 <!-- ==================================================================== -->
55
56 <xsl:template name="refentry.title">
57   <xsl:param name="node" select="."/>
58   <xsl:variable name="refmeta" select="$node//refmeta"/>
59   <xsl:variable name="refentrytitle" select="$refmeta//refentrytitle"/>
60   <xsl:variable name="refnamediv" select="$node//refnamediv"/>
61   <xsl:variable name="refname" select="$refnamediv//refname"/>
62   <xsl:variable name="refdesc" select="$refnamediv//refdescriptor"/>
63   <xsl:variable name="title">
64     <xsl:choose>
65       <xsl:when test="$refentrytitle">
66         <xsl:apply-templates select="$refentrytitle[1]" mode="title"/>
67       </xsl:when>
68       <xsl:when test="$refdesc">
69         <xsl:apply-templates select="$refdesc[1]" mode="title"/>
70       </xsl:when>
71       <xsl:when test="$refname">
72         <xsl:apply-templates select="$refname[1]" mode="title"/>
73       </xsl:when>
74       <xsl:otherwise/>
75     </xsl:choose>
76   </xsl:variable>
77
78   <h1 class="title">
79     <xsl:copy-of select="$title"/>
80   </h1>
81 </xsl:template>
82
83 <xsl:template match="refentry">
84   <xsl:call-template name="id.warning"/>
85
86   <div>
87     <xsl:call-template name="common.html.attributes">
88       <xsl:with-param name="inherit" select="1"/>
89     </xsl:call-template>
90     <xsl:call-template name="id.attribute">
91       <xsl:with-param name="conditional" select="0"/>
92     </xsl:call-template>
93     <xsl:if test="$refentry.separator != 0 and preceding-sibling::refentry">
94       <div class="refentry.separator">
95         <hr/>
96       </div>
97     </xsl:if>
98     <xsl:call-template name="anchor">
99       <xsl:with-param name="conditional" select="0"/>
100     </xsl:call-template>
101     <xsl:call-template name="refentry.titlepage"/>
102     <xsl:apply-templates/>
103     <xsl:call-template name="process.footnotes"/>
104   </div>
105 </xsl:template>
106
107 <xsl:template match="refentry/docinfo|refentry/refentryinfo"/>
108 <xsl:template match="refentry/info"/>
109
110 <xsl:template match="refentrytitle|refname|refdescriptor" mode="title">
111   <xsl:apply-templates/>
112 </xsl:template>
113
114 <xsl:template match="refmeta">
115 </xsl:template>
116
117 <xsl:template match="manvolnum">
118   <xsl:if test="$refentry.xref.manvolnum != 0">
119     <xsl:text>(</xsl:text>
120     <xsl:apply-templates/>
121     <xsl:text>)</xsl:text>
122   </xsl:if>
123 </xsl:template>
124
125 <xsl:template match="refmiscinfo">
126 </xsl:template>
127
128 <xsl:template match="refentrytitle">
129   <xsl:call-template name="inline.charseq"/>
130 </xsl:template>
131
132 <xsl:template match="refnamediv">
133   <div>
134     <xsl:call-template name="common.html.attributes">
135       <xsl:with-param name="inherit" select="1"/>
136     </xsl:call-template>
137     <xsl:call-template name="id.attribute"/>
138     <xsl:call-template name="anchor"/>
139
140     <xsl:choose>
141       <xsl:when test="preceding-sibling::refnamediv">
142         <!-- no title on secondary refnamedivs! -->
143       </xsl:when>
144       <xsl:when test="$refentry.generate.name != 0">
145         <h2>
146           <xsl:call-template name="gentext">
147             <xsl:with-param name="key" select="'RefName'"/>
148           </xsl:call-template>
149         </h2>
150       </xsl:when>
151       <xsl:when test="$refentry.generate.title != 0">
152         <h2>
153           <xsl:choose>
154             <xsl:when test="../refmeta/refentrytitle">
155               <xsl:apply-templates select="../refmeta/refentrytitle"/>
156             </xsl:when>
157             <xsl:otherwise>
158               <xsl:apply-templates select="refname[1]"/>
159             </xsl:otherwise>
160           </xsl:choose>
161         </h2>
162       </xsl:when>
163     </xsl:choose>
164
165     <p>
166       <xsl:apply-templates/>
167     </p>
168   </div>
169 </xsl:template>
170
171 <xsl:template match="refname">
172   <xsl:if test="not(preceding-sibling::refdescriptor)">
173     <xsl:apply-templates/>
174     <xsl:if test="following-sibling::refname">
175       <xsl:text>, </xsl:text>
176     </xsl:if>
177   </xsl:if>
178 </xsl:template>
179
180 <xsl:template match="refpurpose">
181   <xsl:if test="node()">
182     <xsl:text> </xsl:text>
183     <xsl:call-template name="dingbat">
184       <xsl:with-param name="dingbat">em-dash</xsl:with-param>
185     </xsl:call-template>
186     <xsl:text> </xsl:text>
187     <xsl:apply-templates/>
188   </xsl:if>
189 </xsl:template>
190
191 <xsl:template match="refdescriptor">
192   <xsl:apply-templates/>
193 </xsl:template>
194
195 <xsl:template match="refclass">
196   <xsl:if test="$refclass.suppress = 0">
197   <strong xmlns:xslo="http://www.w3.org/1999/XSL/Transform">
198     <xsl:if test="@role">
199       <xsl:value-of select="@role"/>
200       <xsl:text>: </xsl:text>
201     </xsl:if>
202     <xsl:apply-templates/>
203   </strong>
204   </xsl:if>
205 </xsl:template>
206
207 <xsl:template match="refsynopsisdiv">
208   <div>
209     <xsl:call-template name="common.html.attributes">
210       <xsl:with-param name="inherit" select="1"/>
211     </xsl:call-template>
212     <xsl:call-template name="id.attribute"/>
213     <xsl:call-template name="anchor"/>
214     <h2>
215       <xsl:choose>
216         <xsl:when test="refsynopsisdiv/title|title">
217           <xsl:apply-templates select="(refsynopsisdiv/title|title)[1]" mode="titlepage.mode"/>
218         </xsl:when>
219         <xsl:otherwise>
220           <xsl:call-template name="gentext">
221             <xsl:with-param name="key" select="'RefSynopsisDiv'"/>
222           </xsl:call-template>
223         </xsl:otherwise>
224       </xsl:choose>
225     </h2>
226     <xsl:apply-templates/>
227   </div>
228 </xsl:template>
229
230 <xsl:template match="refsynopsisdivinfo"/>
231
232 <xsl:template match="refsynopsisdiv/title">
233 </xsl:template>
234
235 <xsl:template match="refsynopsisdiv/title" mode="titlepage.mode">
236   <xsl:apply-templates/>
237 </xsl:template>
238
239 <xsl:template match="refsection|refsect1|refsect2|refsect3">
240   <div>
241     <xsl:call-template name="common.html.attributes">
242       <xsl:with-param name="inherit" select="1"/>
243     </xsl:call-template>
244     <xsl:call-template name="id.attribute">
245       <xsl:with-param name="conditional" select="0"/>
246     </xsl:call-template>
247     <xsl:call-template name="anchor">
248       <xsl:with-param name="conditional" select="0"/>
249     </xsl:call-template>
250     <!-- pick up info title -->
251     <xsl:apply-templates select="(title|info/title)[1]"/>
252     <xsl:apply-templates select="node()[not(self::title) and not(self::info)]"/>
253   </div>
254 </xsl:template>
255
256 <xsl:template match="refsection/title|refsection/info/title">
257   <!-- the ID is output in the block.object call for refsect1 -->
258   <xsl:variable name="level" select="count(ancestor-or-self::refsection)"/>
259   <xsl:variable name="refsynopsisdiv">
260     <xsl:text>0</xsl:text>
261     <xsl:if test="ancestor::refsynopsisdiv">1</xsl:if>
262   </xsl:variable>
263   <xsl:variable name="hlevel">
264     <xsl:choose>
265       <xsl:when test="$level+$refsynopsisdiv &gt; 5">6</xsl:when>
266       <xsl:otherwise>
267         <xsl:value-of select="$level+1+$refsynopsisdiv"/>
268       </xsl:otherwise>
269     </xsl:choose>
270   </xsl:variable>
271   <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
272     <xsl:apply-templates/>
273   </xsl:element>
274 </xsl:template>
275
276 <xsl:template match="refsect1/title|refsect1/info/title">
277   <!-- the ID is output in the block.object call for refsect1 -->
278   <h2>
279     <xsl:apply-templates/>
280   </h2>
281 </xsl:template>
282
283 <xsl:template match="refsect2/title|refsect2/info/title">
284   <!-- the ID is output in the block.object call for refsect2 -->
285   <h3>
286     <xsl:apply-templates/>
287   </h3>
288 </xsl:template>
289
290 <xsl:template match="refsect3/title|refsect3/info/title">
291   <!-- the ID is output in the block.object call for refsect3 -->
292   <h4>
293     <xsl:apply-templates/>
294   </h4>
295 </xsl:template>
296
297 <xsl:template match="refsectioninfo|refsection/info"/>
298 <xsl:template match="refsect1info|refsect1/info"/>
299 <xsl:template match="refsect2info|refsect2/info"/>
300 <xsl:template match="refsect3info|refsect3/info"/>
301
302
303 <!-- ==================================================================== -->
304
305 </xsl:stylesheet>