source: BOOK/stylesheets/lfs-xsl/xhtml/lfs-titles.xsl@ 2256e5a

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

Added LFS XSL Stylesheets.

  • Property mode set to 100644
File size: 6.6 KB
Line 
1<?xml version='1.0' encoding='ISO-8859-1'?>
2
3<!--
4$LastChangedBy$
5$Date$
6-->
7
8<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9 xmlns="http://www.w3.org/1999/xhtml"
10 version="1.0">
11
12 <!-- This stylesheet controls the h* xhtml tags used for several titles -->
13
14 <!-- preface.titlepage:
15 Uses h1 and removed a lot of unneeded code.
16 No label in preface. -->
17 <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
18 <xsl:template name="preface.titlepage">
19 <h1 class="{name(.)}">
20 <xsl:if test="@id">
21 <a id="{@id}" name="{@id}"/>
22 </xsl:if>
23 <xsl:value-of select="title"/>
24 </h1>
25 </xsl:template>
26
27 <!-- part.titlepage:
28 Uses h1 and removed a lot of unneeded code.
29 When sections are not labeled, we want the part label in TOC
30 but not in titlepage. -->
31 <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
32 <xsl:template name="part.titlepage">
33 <h1 class="{name(.)}">
34 <xsl:if test="@id">
35 <a id="{@id}" name="{@id}"/>
36 </xsl:if>
37 <xsl:if test="$section.autolabel != 0">
38 <xsl:apply-templates select="." mode="label.markup"/>
39 <xsl:text>. </xsl:text>
40 </xsl:if>
41 <xsl:value-of select="title"/>
42 </h1>
43 </xsl:template>
44
45 <!-- partintro.titlepage:
46 Uses h2 and removed a lot of unneeded code. -->
47 <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
48 <xsl:template name="partintro.titlepage">
49 <xsl:if test="title">
50 <h2 class="{name(.)}">
51 <xsl:if test="@id">
52 <a id="{@id}" name="{@id}"/>
53 </xsl:if>
54 <xsl:value-of select="title"/>
55 </h2>
56 </xsl:if>
57 </xsl:template>
58
59 <!-- appendix.titlepage:
60 Uses h1 and removed a lot of unneeded code.
61 When sections are not labeled, we want the appendix label in TOC
62 but not in titlepage. -->
63 <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
64 <xsl:template name="appendix.titlepage">
65 <h1 class="{name(.)}">
66 <xsl:if test="@id">
67 <a id="{@id}" name="{@id}"/>
68 </xsl:if>
69 <xsl:if test="$section.autolabel != 0">
70 <xsl:apply-templates select="." mode="label.markup"/>
71 <xsl:text>. </xsl:text>
72 </xsl:if>
73 <xsl:value-of select="title"/>
74 </h1>
75 </xsl:template>
76
77 <!-- chapter.titlepage:
78 Uses h1 and removed a lot of unneeded code.
79 When sections are not labeled, we want the chapter label in TOC
80 but not in titlepage. -->
81 <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
82 <xsl:template name="chapter.titlepage">
83 <h1 class="{name(.)}">
84 <xsl:if test="@id">
85 <a id="{@id}" name="{@id}"/>
86 </xsl:if>
87 <xsl:if test="$section.autolabel != 0">
88 <xsl:apply-templates select="." mode="label.markup"/>
89 <xsl:text>. </xsl:text>
90 </xsl:if>
91 <xsl:value-of select="title"/>
92 </h1>
93 </xsl:template>
94
95 <!-- sect1.titlepage:
96 Uses h1 and removed a lot of unneeded code. -->
97 <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
98 <xsl:template name="sect1.titlepage">
99 <h1 class="{name(.)}">
100 <xsl:if test="@id">
101 <a id="{@id}" name="{@id}"/>
102 </xsl:if>
103 <xsl:if test="$section.autolabel != 0">
104 <xsl:apply-templates select="." mode="label.markup"/>
105 <xsl:text>. </xsl:text>
106 </xsl:if>
107 <xsl:value-of select="title"/>
108 </h1>
109 </xsl:template>
110
111 <!-- sect2.titlepage:
112 Uses h2 and removed a lot of unneeded code.
113 Skip empty titles.
114 No label in preface. -->
115 <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
116 <xsl:template name="sect2.titlepage">
117 <xsl:choose>
118 <xsl:when test="string-length(title) = 0"/>
119 <xsl:otherwise>
120 <h2 class="{name(.)}">
121 <xsl:if test="@id">
122 <a id="{@id}" name="{@id}"/>
123 </xsl:if>
124 <xsl:if test="not(ancestor::preface) and $section.autolabel != 0">
125 <xsl:apply-templates select="." mode="label.markup"/>
126 <xsl:text>. </xsl:text>
127 </xsl:if>
128 <xsl:value-of select="title"/>
129 </h2>
130 </xsl:otherwise>
131 </xsl:choose>
132 </xsl:template>
133
134 <!-- sect3.titlepage:
135 Uses h3 and removed a lot of unneeded code. -->
136 <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
137 <xsl:template name="sect3.titlepage">
138 <h3 class="{name(.)}">
139 <xsl:if test="@id">
140 <a id="{@id}" name="{@id}"/>
141 </xsl:if>
142 <xsl:if test="$section.autolabel != 0">
143 <xsl:apply-templates select="." mode="label.markup"/>
144 <xsl:text>. </xsl:text>
145 </xsl:if>
146 <xsl:value-of select="title"/>
147 </h3>
148 </xsl:template>
149
150 <!-- dedication.titlepage:
151 Uses h2 and removed a lot of unneeded code. -->
152 <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
153 <xsl:template name="dedication.titlepage">
154 <h2>
155 <xsl:value-of select="title"/>
156 </h2>
157 </xsl:template>
158
159 <!-- bridgehead:
160 We use always renderas attributes and want the output h* level
161 matching the defined sect* level.
162 Create the anchor only if there is an @id. -->
163 <!-- The original template is in {docbook-xsl}/xhtml/sections.xsl -->
164 <xsl:template match="bridgehead">
165 <xsl:variable name="hlevel">
166 <xsl:choose>
167 <xsl:when test="@renderas = 'sect1'">1</xsl:when>
168 <xsl:when test="@renderas = 'sect2'">2</xsl:when>
169 <xsl:when test="@renderas = 'sect3'">3</xsl:when>
170 <xsl:when test="@renderas = 'sect4'">4</xsl:when>
171 <xsl:when test="@renderas = 'sect5'">5</xsl:when>
172 </xsl:choose>
173 </xsl:variable>
174 <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml">
175 <xsl:if test="@id">
176 <a id="{@id}" name="{@id}"/>
177 </xsl:if>
178 <xsl:apply-templates/>
179 </xsl:element>
180 </xsl:template>
181
182 <!-- book.titlepage.verso:
183 Process bookinfo/bibliosource from here. -->
184 <!-- The original template is in {docbook-xsl}/xhtml/titlepage.templates.xsl -->
185 <xsl:template name="book.titlepage.verso">
186 <xsl:apply-templates select="bookinfo/bibliosource"/>
187 </xsl:template>
188
189 <!-- bookinfo/bibliosource:
190 Self-made template to handle bibliosource when inside bookinfo. -->
191 <xsl:template match="bookinfo/bibliosource">
192 <p class="copyright">
193 <xsl:apply-templates/>
194 </p>
195 </xsl:template>
196
197</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.