source: BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/refentry.xsl @ f8c4e94

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since f8c4e94 was f8c4e94, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added LFS XSL Stylesheets.

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