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