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

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

Updated DocBook?-XSL code to version 1.73.2

  • Property mode set to 100644
File size: 17.7 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:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook" xmlns:exsl="http://exslt.org/common" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="db ng exsl" version="1.0">
5
6<xsl:output method="xml" encoding="UTF-8" indent="no" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
7
8<!-- ********************************************************************
9     $Id$
10     ********************************************************************
11
12     This file is part of the XSL DocBook Stylesheet distribution.
13     See ../README or http://docbook.sf.net/release/xsl/current/ for
14     copyright and other information.
15
16     ******************************************************************** -->
17
18<!-- ==================================================================== -->
19
20<xsl:include href="../VERSION"/>
21<xsl:include href="param.xsl"/>
22<xsl:include href="../lib/lib.xsl"/>
23<xsl:include href="../common/l10n.xsl"/>
24<xsl:include href="../common/common.xsl"/>
25<xsl:include href="../common/utility.xsl"/>
26<xsl:include href="../common/labels.xsl"/>
27<xsl:include href="../common/titles.xsl"/>
28<xsl:include href="../common/subtitles.xsl"/>
29<xsl:include href="../common/gentext.xsl"/>
30<xsl:include href="../common/targets.xsl"/>
31<xsl:include href="../common/olink.xsl"/>
32<xsl:include href="../common/pi.xsl"/>
33<xsl:include href="autotoc.xsl"/>
34<xsl:include href="autoidx.xsl"/>
35<xsl:include href="lists.xsl"/>
36<xsl:include href="callout.xsl"/>
37<xsl:include href="verbatim.xsl"/>
38<xsl:include href="graphics.xsl"/>
39<xsl:include href="xref.xsl"/>
40<xsl:include href="formal.xsl"/>
41<xsl:include href="table.xsl"/>
42<xsl:include href="htmltbl.xsl"/>
43<xsl:include href="sections.xsl"/>
44<xsl:include href="inline.xsl"/>
45<xsl:include href="footnote.xsl"/>
46<xsl:include href="html.xsl"/>
47<xsl:include href="info.xsl"/>
48<xsl:include href="keywords.xsl"/>
49<xsl:include href="division.xsl"/>
50<xsl:include href="toc.xsl"/>
51<xsl:include href="index.xsl"/>
52<xsl:include href="refentry.xsl"/>
53<xsl:include href="math.xsl"/>
54<xsl:include href="admon.xsl"/>
55<xsl:include href="component.xsl"/>
56<xsl:include href="biblio.xsl"/>
57<xsl:include href="biblio-iso690.xsl"/>
58<xsl:include href="glossary.xsl"/>
59<xsl:include href="block.xsl"/>
60<xsl:include href="task.xsl"/>
61<xsl:include href="qandaset.xsl"/>
62<xsl:include href="synop.xsl"/>
63<xsl:include href="titlepage.xsl"/>
64<xsl:include href="titlepage.templates.xsl"/>
65<xsl:include href="pi.xsl"/>
66<xsl:include href="ebnf.xsl"/>
67<xsl:include href="chunker.xsl"/>
68<xsl:include href="html-rtf.xsl"/>
69<xsl:include href="annotations.xsl"/>
70<xsl:include href="../common/stripns.xsl"/>
71
72<xsl:param name="stylesheet.result.type" select="'xhtml'"/>
73<xsl:param name="htmlhelp.output" select="0"/>
74
75<!-- ==================================================================== -->
76
77<xsl:key name="id" match="*" use="@id|@xml:id"/>
78<xsl:key name="gid" match="*" use="generate-id()"/>
79
80<!-- ==================================================================== -->
81
82<xsl:template match="*">
83  <xsl:message>
84    <xsl:text>Element </xsl:text>
85    <xsl:value-of select="local-name(.)"/>
86    <xsl:text> in namespace '</xsl:text>
87    <xsl:value-of select="namespace-uri(.)"/>
88    <xsl:text>' encountered</xsl:text>
89    <xsl:if test="parent::*">
90      <xsl:text> in </xsl:text>
91      <xsl:value-of select="name(parent::*)"/>
92    </xsl:if>
93    <xsl:text>, but no template matches.</xsl:text>
94  </xsl:message>
95
96  <span style="color: red">
97    <xsl:text>&lt;</xsl:text>
98    <xsl:value-of select="name(.)"/>
99    <xsl:text>&gt;</xsl:text>
100    <xsl:apply-templates/>
101    <xsl:text>&lt;/</xsl:text>
102    <xsl:value-of select="name(.)"/>
103    <xsl:text>&gt;</xsl:text>
104  </span>
105</xsl:template>
106
107<xsl:template match="text()">
108  <xsl:value-of select="."/>
109</xsl:template>
110
111<xsl:template name="body.attributes">
112<!-- no apply-templates; make it empty -->
113</xsl:template>
114
115<xsl:template name="head.content">
116  <xsl:param name="node" select="."/>
117  <xsl:param name="title">
118    <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
119  </xsl:param>
120
121  <title>
122    <xsl:copy-of select="$title"/>
123  </title>
124
125  <xsl:if test="$html.stylesheet != ''">
126    <xsl:call-template name="output.html.stylesheets">
127      <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
128    </xsl:call-template>
129  </xsl:if>
130
131  <xsl:if test="$link.mailto.url != ''">
132    <link rev="made" href="{$link.mailto.url}"/>
133  </xsl:if>
134
135  <xsl:if test="$html.base != ''">
136    <base href="{$html.base}"/>
137  </xsl:if>
138
139  <meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/>
140
141  <xsl:if test="$generate.meta.abstract != 0">
142    <xsl:variable name="info" select="(articleinfo                                       |bookinfo                                       |prefaceinfo                                       |chapterinfo                                       |appendixinfo                                       |sectioninfo                                       |sect1info                                       |sect2info                                       |sect3info                                       |sect4info                                       |sect5info                                       |referenceinfo                                       |refentryinfo                                       |partinfo                                       |info                                       |docinfo)[1]"/>
143    <xsl:if test="$info and $info/abstract">
144      <meta name="description">
145        <xsl:attribute name="content">
146          <xsl:for-each select="$info/abstract[1]/*">
147            <xsl:value-of select="normalize-space(.)"/>
148            <xsl:if test="position() &lt; last()">
149              <xsl:text> </xsl:text>
150            </xsl:if>
151          </xsl:for-each>
152        </xsl:attribute>
153      </meta>
154    </xsl:if>
155  </xsl:if>
156
157  <xsl:if test="($draft.mode = 'yes' or                 ($draft.mode = 'maybe' and                 ancestor-or-self::*[@status][1]/@status = 'draft'))                 and $draft.watermark.image != ''">
158    <style type="text/css"><xsl:text>
159body { background-image: url('</xsl:text>
160<xsl:value-of select="$draft.watermark.image"/><xsl:text>');
161       background-repeat: no-repeat;
162       background-position: top left;
163       /* The following properties make the watermark "fixed" on the page. */
164       /* I think that's just a bit too distracting for the reader... */
165       /* background-attachment: fixed; */
166       /* background-position: center center; */
167     }</xsl:text>
168    </style>
169  </xsl:if>
170  <xsl:apply-templates select="." mode="head.keywords.content"/>
171</xsl:template>
172
173<xsl:template name="output.html.stylesheets">
174  <xsl:param name="stylesheets" select="''"/>
175
176  <xsl:choose>
177    <xsl:when test="contains($stylesheets, ' ')">
178      <link rel="stylesheet" href="{substring-before($stylesheets, ' ')}">
179        <xsl:if test="$html.stylesheet.type != ''">
180          <xsl:attribute name="type">
181            <xsl:value-of select="$html.stylesheet.type"/>
182          </xsl:attribute>
183        </xsl:if>
184      </link>
185      <xsl:call-template name="output.html.stylesheets">
186        <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
187      </xsl:call-template>
188    </xsl:when>
189    <xsl:when test="$stylesheets != ''">
190      <link rel="stylesheet" href="{$stylesheets}">
191        <xsl:if test="$html.stylesheet.type != ''">
192          <xsl:attribute name="type">
193            <xsl:value-of select="$html.stylesheet.type"/>
194          </xsl:attribute>
195        </xsl:if>
196      </link>
197    </xsl:when>
198  </xsl:choose>
199</xsl:template>
200
201<!-- ============================================================ -->
202
203<xsl:template match="*" mode="head.keywords.content">
204  <xsl:apply-templates select="chapterinfo/keywordset" mode="html.header"/>
205  <xsl:apply-templates select="appendixinfo/keywordset" mode="html.header"/>
206  <xsl:apply-templates select="prefaceinfo/keywordset" mode="html.header"/>
207  <xsl:apply-templates select="bookinfo/keywordset" mode="html.header"/>
208  <xsl:apply-templates select="setinfo/keywordset" mode="html.header"/>
209  <xsl:apply-templates select="articleinfo/keywordset" mode="html.header"/>
210  <xsl:apply-templates select="artheader/keywordset" mode="html.header"/>
211  <xsl:apply-templates select="sect1info/keywordset" mode="html.header"/>
212  <xsl:apply-templates select="sect2info/keywordset" mode="html.header"/>
213  <xsl:apply-templates select="sect3info/keywordset" mode="html.header"/>
214  <xsl:apply-templates select="sect4info/keywordset" mode="html.header"/>
215  <xsl:apply-templates select="sect5info/keywordset" mode="html.header"/>
216  <xsl:apply-templates select="sectioninfo/keywordset" mode="html.header"/>
217  <xsl:apply-templates select="refsect1info/keywordset" mode="html.header"/>
218  <xsl:apply-templates select="refsect2info/keywordset" mode="html.header"/>
219  <xsl:apply-templates select="refsect3info/keywordset" mode="html.header"/>
220  <xsl:apply-templates select="bibliographyinfo/keywordset" mode="html.header"/>
221  <xsl:apply-templates select="glossaryinfo/keywordset" mode="html.header"/>
222  <xsl:apply-templates select="indexinfo/keywordset" mode="html.header"/>
223  <xsl:apply-templates select="refentryinfo/keywordset" mode="html.header"/>
224  <xsl:apply-templates select="partinfo/keywordset" mode="html.header"/>
225  <xsl:apply-templates select="referenceinfo/keywordset" mode="html.header"/>
226  <xsl:apply-templates select="docinfo/keywordset" mode="html.header"/>
227  <xsl:apply-templates select="info/keywordset" mode="html.header"/>
228
229  <xsl:if test="$inherit.keywords != 0                 and parent::*">
230    <xsl:apply-templates select="parent::*" mode="head.keywords.content"/>
231  </xsl:if>
232</xsl:template>
233
234<!-- ============================================================ -->
235
236<xsl:template name="system.head.content">
237  <xsl:param name="node" select="."/>
238
239  <!-- FIXME: When chunking, only the annotations actually used
240              in this chunk should be referenced. I don't think it
241              does any harm to reference them all, but it adds
242              unnecessary bloat to each chunk. -->
243  <xsl:if test="$annotation.support != 0 and //annotation">
244    <xsl:call-template name="add.annotation.links"/>
245    <script type="text/javascript">
246      <xsl:text>
247// Create PopupWindow objects</xsl:text>
248      <xsl:for-each select="//annotation">
249        <xsl:text>
250var popup_</xsl:text>
251        <xsl:value-of select="generate-id(.)"/>
252        <xsl:text> = new PopupWindow("popup-</xsl:text>
253        <xsl:value-of select="generate-id(.)"/>
254        <xsl:text>");
255</xsl:text>
256        <xsl:text>popup_</xsl:text>
257        <xsl:value-of select="generate-id(.)"/>
258        <xsl:text>.offsetY = 15;
259</xsl:text>
260        <xsl:text>popup_</xsl:text>
261        <xsl:value-of select="generate-id(.)"/>
262        <xsl:text>.autoHide();
263</xsl:text>
264      </xsl:for-each>
265    </script>
266
267    <style type="text/css">
268      <xsl:value-of select="$annotation.css"/>
269    </style>
270  </xsl:if>
271
272  <!-- system.head.content is like user.head.content, except that
273       it is called before head.content. This is important because it
274       means, for example, that <style> elements output by system.head.content
275       have a lower CSS precedence than the users stylesheet. -->
276</xsl:template>
277
278<!-- ============================================================ -->
279
280<xsl:template name="user.preroot">
281  <!-- Pre-root output, can be used to output comments and PIs. -->
282  <!-- This must not output any element content! -->
283</xsl:template>
284
285<xsl:template name="user.head.content">
286  <xsl:param name="node" select="."/>
287</xsl:template>
288
289<xsl:template name="user.header.navigation">
290  <xsl:param name="node" select="."/>
291</xsl:template>
292
293<xsl:template name="user.header.content">
294  <xsl:param name="node" select="."/>
295</xsl:template>
296
297<xsl:template name="user.footer.content">
298  <xsl:param name="node" select="."/>
299</xsl:template>
300
301<xsl:template name="user.footer.navigation">
302  <xsl:param name="node" select="."/>
303</xsl:template>
304
305<xsl:template match="/">
306  <!-- * Get a title for current doc so that we let the user -->
307  <!-- * know what document we are processing at this point. -->
308  <xsl:variable name="doc.title">
309    <xsl:call-template name="get.doc.title"/>
310  </xsl:variable>
311  <xsl:choose>
312    <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
313         toss the namespace and continue.  Use the docbook5 namespaced
314         stylesheets for DocBook5 if you don't want to use this feature.-->
315    <!-- include extra test for Xalan quirk -->
316    <xsl:when test="(function-available('exsl:node-set') or                      contains(system-property('xsl:vendor'),                        'Apache Software Foundation'))                     and (*/self::ng:* or */self::db:*)">
317      <xsl:call-template name="log.message">
318        <xsl:with-param name="level">Note</xsl:with-param>
319        <xsl:with-param name="source" select="$doc.title"/>
320        <xsl:with-param name="context-desc">
321          <xsl:text>namesp. cut</xsl:text>
322        </xsl:with-param>
323        <xsl:with-param name="message">
324          <xsl:text>stripped namespace before processing</xsl:text>
325        </xsl:with-param>
326      </xsl:call-template>
327      <xsl:variable name="nons">
328        <xsl:apply-templates mode="stripNS"/>
329      </xsl:variable>
330      <!--
331      <xsl:message>Saving stripped document.</xsl:message>
332      <xsl:call-template name="write.chunk">
333        <xsl:with-param name="filename" select="'/tmp/stripped.xml'"/>
334        <xsl:with-param name="method" select="'xml'"/>
335        <xsl:with-param name="content">
336          <xsl:copy-of select="exsl:node-set($nons)"/>
337        </xsl:with-param>
338      </xsl:call-template>
339      -->
340      <xsl:call-template name="log.message">
341        <xsl:with-param name="level">Note</xsl:with-param>
342        <xsl:with-param name="source" select="$doc.title"/>
343        <xsl:with-param name="context-desc">
344          <xsl:text>namesp. cut</xsl:text>
345        </xsl:with-param>
346        <xsl:with-param name="message">
347          <xsl:text>processing stripped document</xsl:text>
348        </xsl:with-param>
349      </xsl:call-template>
350      <xsl:apply-templates select="exsl:node-set($nons)"/>
351    </xsl:when>
352    <!-- Can't process unless namespace removed -->
353    <xsl:when test="*/self::ng:* or */self::db:*">
354      <xsl:message terminate="yes">
355        <xsl:text>Unable to strip the namespace from DB5 document,</xsl:text>
356        <xsl:text> cannot proceed.</xsl:text>
357      </xsl:message>
358    </xsl:when>
359    <xsl:otherwise>
360      <xsl:choose>
361        <xsl:when test="$rootid != ''">
362          <xsl:choose>
363            <xsl:when test="count(key('id',$rootid)) = 0">
364              <xsl:message terminate="yes">
365                <xsl:text>ID '</xsl:text>
366                <xsl:value-of select="$rootid"/>
367                <xsl:text>' not found in document.</xsl:text>
368              </xsl:message>
369            </xsl:when>
370            <xsl:otherwise>
371              <xsl:if test="$collect.xref.targets = 'yes' or                             $collect.xref.targets = 'only'">
372                <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/>
373              </xsl:if>
374              <xsl:if test="$collect.xref.targets != 'only'">
375                <xsl:apply-templates select="key('id',$rootid)" mode="process.root"/>
376                <xsl:if test="$tex.math.in.alt != ''">
377                  <xsl:apply-templates select="key('id',$rootid)" mode="collect.tex.math"/>
378                </xsl:if>
379              </xsl:if>
380            </xsl:otherwise>
381          </xsl:choose>
382        </xsl:when>
383        <xsl:otherwise>
384          <xsl:if test="$collect.xref.targets = 'yes' or                         $collect.xref.targets = 'only'">
385            <xsl:apply-templates select="/" mode="collect.targets"/>
386          </xsl:if>
387          <xsl:if test="$collect.xref.targets != 'only'">
388            <xsl:apply-templates select="/" mode="process.root"/>
389            <xsl:if test="$tex.math.in.alt != ''">
390              <xsl:apply-templates select="/" mode="collect.tex.math"/>
391            </xsl:if>
392          </xsl:if>
393        </xsl:otherwise>
394      </xsl:choose>
395    </xsl:otherwise>
396  </xsl:choose>
397</xsl:template>
398
399<xsl:template match="*" mode="process.root">
400  <xsl:variable name="doc" select="self::*"/>
401
402  <xsl:call-template name="user.preroot"/>
403  <xsl:call-template name="root.messages"/>
404
405  <html>
406    <head>
407      <xsl:call-template name="system.head.content">
408        <xsl:with-param name="node" select="$doc"/>
409      </xsl:call-template>
410      <xsl:call-template name="head.content">
411        <xsl:with-param name="node" select="$doc"/>
412      </xsl:call-template>
413      <xsl:call-template name="user.head.content">
414        <xsl:with-param name="node" select="$doc"/>
415      </xsl:call-template>
416    </head>
417    <body>
418      <xsl:call-template name="body.attributes"/>
419      <xsl:call-template name="user.header.content">
420        <xsl:with-param name="node" select="$doc"/>
421      </xsl:call-template>
422      <xsl:apply-templates select="."/>
423      <xsl:call-template name="user.footer.content">
424        <xsl:with-param name="node" select="$doc"/>
425      </xsl:call-template>
426    </body>
427  </html>
428  <xsl:value-of select="$html.append"/>
429</xsl:template>
430
431<xsl:template name="root.messages">
432  <!-- redefine this any way you'd like to output messages -->
433  <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
434</xsl:template>
435
436<!-- ==================================================================== -->
437
438<xsl:template name="chunk">
439  <xsl:param name="node" select="."/>
440
441  <!-- The default is that we are not chunking... -->
442  <xsl:text>0</xsl:text>
443</xsl:template>
444
445<!-- ==================================================================== -->
446
447</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.