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

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

Added LFS XSL Stylesheets.

  • Property mode set to 100644
File size: 8.4 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<!-- The generate.html.title template is currently used for generating HTML -->
17<!-- "title" attributes for some inline elements only, but not for any -->
18<!-- block elements. It is called in eleven places in the inline.xsl -->
19<!-- file. But it's called by all the inline.* templates (e.g., -->
20<!-- inline.boldseq), which in turn are called by other (element) -->
21<!-- templates, so it results, currently, in supporting generation of the -->
22<!-- HTML "title" attribute for a total of about 92 elements. -->
23<!-- You can use mode="html.title.attribute" to get a title for -->
24<!-- an element specified by a param, including targets of cross references. -->
25<xsl:template name="generate.html.title">
26 <xsl:apply-templates select="." mode="html.title.attribute"/>
27</xsl:template>
28
29<!-- Generate a title attribute for the context node -->
30<xsl:template match="*" mode="html.title.attribute">
31 <xsl:variable name="is.title">
32 <xsl:call-template name="gentext.template.exists">
33 <xsl:with-param name="context" select="'title'"/>
34 <xsl:with-param name="name" select="local-name(.)"/>
35 <xsl:with-param name="lang">
36 <xsl:call-template name="l10n.language"/>
37 </xsl:with-param>
38 </xsl:call-template>
39 </xsl:variable>
40
41 <xsl:variable name="is.title-numbered">
42 <xsl:call-template name="gentext.template.exists">
43 <xsl:with-param name="context" select="'title-numbered'"/>
44 <xsl:with-param name="name" select="local-name(.)"/>
45 <xsl:with-param name="lang">
46 <xsl:call-template name="l10n.language"/>
47 </xsl:with-param>
48 </xsl:call-template>
49 </xsl:variable>
50
51 <xsl:variable name="is.title-unnumbered">
52 <xsl:call-template name="gentext.template.exists">
53 <xsl:with-param name="context" select="'title-unnumbered'"/>
54 <xsl:with-param name="name" select="local-name(.)"/>
55 <xsl:with-param name="lang">
56 <xsl:call-template name="l10n.language"/>
57 </xsl:with-param>
58 </xsl:call-template>
59 </xsl:variable>
60
61 <xsl:variable name="gentext.title">
62 <xsl:if test="$is.title != 0 or $is.title-numbered != 0 or $is.title-unnumbered != 0">
63 <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
64 </xsl:if>
65 </xsl:variable>
66
67 <xsl:choose>
68 <xsl:when test="string-length($gentext.title) != 0">
69 <xsl:attribute name="title">
70 <xsl:value-of select="$gentext.title"/>
71 </xsl:attribute>
72 </xsl:when>
73 <!-- Fall back to alt if available -->
74 <xsl:when test="alt">
75 <xsl:attribute name="title">
76 <xsl:value-of select="normalize-space(alt)"/>
77 </xsl:attribute>
78 </xsl:when>
79 </xsl:choose>
80
81</xsl:template>
82
83<xsl:template name="dir">
84 <xsl:param name="inherit" select="0"/>
85
86 <xsl:variable name="dir">
87 <xsl:choose>
88 <xsl:when test="@dir">
89 <xsl:value-of select="@dir"/>
90 </xsl:when>
91 <xsl:when test="$inherit != 0">
92 <xsl:value-of select="ancestor::*/@dir[1]"/>
93 </xsl:when>
94 </xsl:choose>
95 </xsl:variable>
96
97 <xsl:if test="$dir != ''">
98 <xsl:attribute name="dir">
99 <xsl:value-of select="$dir"/>
100 </xsl:attribute>
101 </xsl:if>
102</xsl:template>
103
104<xsl:template name="anchor">
105 <xsl:param name="node" select="."/>
106 <xsl:param name="conditional" select="1"/>
107 <xsl:variable name="id">
108 <xsl:call-template name="object.id">
109 <xsl:with-param name="object" select="$node"/>
110 </xsl:call-template>
111 </xsl:variable>
112 <xsl:if test="$conditional = 0 or $node/@id or $node/@xml:id">
113 <a id="{$id}"/>
114 </xsl:if>
115</xsl:template>
116
117<xsl:template name="href.target.uri">
118 <xsl:param name="context" select="."/>
119 <xsl:param name="object" select="."/>
120 <xsl:text>#</xsl:text>
121 <xsl:call-template name="object.id">
122 <xsl:with-param name="object" select="$object"/>
123 </xsl:call-template>
124</xsl:template>
125
126<xsl:template name="href.target">
127 <xsl:param name="context" select="."/>
128 <xsl:param name="object" select="."/>
129 <xsl:text>#</xsl:text>
130 <xsl:call-template name="object.id">
131 <xsl:with-param name="object" select="$object"/>
132 </xsl:call-template>
133</xsl:template>
134
135<xsl:template name="href.target.with.base.dir">
136 <xsl:param name="context" select="."/>
137 <xsl:param name="object" select="."/>
138 <xsl:if test="$manifest.in.base.dir = 0">
139 <xsl:value-of select="$base.dir"/>
140 </xsl:if>
141 <xsl:call-template name="href.target">
142 <xsl:with-param name="context" select="$context"/>
143 <xsl:with-param name="object" select="$object"/>
144 </xsl:call-template>
145</xsl:template>
146
147<xsl:template name="dingbat">
148 <xsl:param name="dingbat">bullet</xsl:param>
149 <xsl:call-template name="dingbat.characters">
150 <xsl:with-param name="dingbat" select="$dingbat"/>
151 </xsl:call-template>
152</xsl:template>
153
154<xsl:template name="dingbat.characters">
155 <!-- now that I'm using the real serializer, all that dingbat malarky -->
156 <!-- isn't necessary anymore... -->
157 <xsl:param name="dingbat">bullet</xsl:param>
158 <xsl:choose>
159 <xsl:when test="$dingbat='bullet'">&#8226;</xsl:when>
160 <xsl:when test="$dingbat='copyright'">&#169;</xsl:when>
161 <xsl:when test="$dingbat='trademark'">&#8482;</xsl:when>
162 <xsl:when test="$dingbat='trade'">&#8482;</xsl:when>
163 <xsl:when test="$dingbat='registered'">&#174;</xsl:when>
164 <xsl:when test="$dingbat='service'">(SM)</xsl:when>
165 <xsl:when test="$dingbat='nbsp'">&#160;</xsl:when>
166 <xsl:when test="$dingbat='ldquo'">&#8220;</xsl:when>
167 <xsl:when test="$dingbat='rdquo'">&#8221;</xsl:when>
168 <xsl:when test="$dingbat='lsquo'">&#8216;</xsl:when>
169 <xsl:when test="$dingbat='rsquo'">&#8217;</xsl:when>
170 <xsl:when test="$dingbat='em-dash'">&#8212;</xsl:when>
171 <xsl:when test="$dingbat='mdash'">&#8212;</xsl:when>
172 <xsl:when test="$dingbat='en-dash'">&#8211;</xsl:when>
173 <xsl:when test="$dingbat='ndash'">&#8211;</xsl:when>
174 <xsl:otherwise>
175 <xsl:text>&#8226;</xsl:text>
176 </xsl:otherwise>
177 </xsl:choose>
178</xsl:template>
179
180<xsl:template name="id.warning">
181 <xsl:if test="$id.warnings != 0 and not(@id) and not(@xml:id) and parent::*">
182 <xsl:variable name="title">
183 <xsl:choose>
184 <xsl:when test="title">
185 <xsl:value-of select="title[1]"/>
186 </xsl:when>
187 <xsl:when test="substring(local-name(*[1]), string-length(local-name(*[1])-3) = 'info') and *[1]/title">
188 <xsl:value-of select="*[1]/title[1]"/>
189 </xsl:when>
190 <xsl:when test="refmeta/refentrytitle">
191 <xsl:value-of select="refmeta/refentrytitle"/>
192 </xsl:when>
193 <xsl:when test="refnamediv/refname">
194 <xsl:value-of select="refnamediv/refname[1]"/>
195 </xsl:when>
196 </xsl:choose>
197 </xsl:variable>
198
199 <xsl:message>
200 <xsl:text>ID recommended on </xsl:text>
201 <xsl:value-of select="local-name(.)"/>
202 <xsl:if test="$title != ''">
203 <xsl:text>: </xsl:text>
204 <xsl:choose>
205 <xsl:when test="string-length($title) &gt; 40">
206 <xsl:value-of select="substring($title,1,40)"/>
207 <xsl:text>...</xsl:text>
208 </xsl:when>
209 <xsl:otherwise>
210 <xsl:value-of select="$title"/>
211 </xsl:otherwise>
212 </xsl:choose>
213 </xsl:if>
214 </xsl:message>
215 </xsl:if>
216</xsl:template>
217
218<xsl:template match="*" mode="class.attribute">
219 <xsl:param name="class" select="local-name(.)"/>
220 <!-- permit customization of class attributes -->
221 <!-- Use element name by default -->
222 <xsl:attribute name="class">
223 <xsl:apply-templates select="." mode="class.value">
224 <xsl:with-param name="class" select="$class"/>
225 </xsl:apply-templates>
226 </xsl:attribute>
227</xsl:template>
228
229<xsl:template match="*" mode="class.value">
230 <xsl:param name="class" select="local-name(.)"/>
231 <!-- permit customization of class value only -->
232 <!-- Use element name by default -->
233 <xsl:value-of select="$class"/>
234</xsl:template>
235
236</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.