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