source: stylesheets/lfs-xsl/xhtml/lfs-sections.xsl@ 027e027

12.1 ken/TL2024 lazarus plabs/newcss rahul/power-profiles-daemon trunk xry111/llvm18
Last change on this file since 027e027 was 027e027, checked in by Pierre Labastie <pierre.labastie@…>, 5 months ago

Fix webkit bug: output title before div

in the templates we already have in lfs-sections.xsl

  • Property mode set to 100644
File size: 6.9 KB
Line 
1<?xml version='1.0' encoding='UTF-8'?>
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 how preface, chapter, and sections are handled -->
8
9 <!-- Chunk the first top-level section? 1 = yes, 0 = no
10 If preface and chapters TOC are generated, this must be 1. -->
11 <xsl:param name="chunk.first.sections" select="1"/>
12
13 <!-- preface:
14 Output non sect1 child elements before the TOC
15 Output title outside of the <div> because we want to be able to
16 use it at a fixed position -->
17 <!-- The original template is in {docbook-xsl}/xhtml/components.xsl -->
18 <xsl:template match="preface">
19 <xsl:call-template name="id.warning"/>
20 <xsl:call-template name="preface.titlepage"/>
21 <xsl:call-template name="component.separator"/>
22 <div>
23 <xsl:apply-templates select="." mode="class.attribute"/>
24 <xsl:call-template name="dir">
25 <xsl:with-param name="inherit" select="1"/>
26 </xsl:call-template>
27 <xsl:call-template name="language.attribute"/>
28 <xsl:if test="$generate.id.attributes != 0">
29 <xsl:attribute name="id">
30 <xsl:call-template name="object.id"/>
31 </xsl:attribute>
32 </xsl:if>
33 <xsl:apply-templates/>
34 <xsl:variable name="toc.params">
35 <xsl:call-template name="find.path.params">
36 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
37 </xsl:call-template>
38 </xsl:variable>
39 <xsl:if test="contains($toc.params, 'toc')">
40 <xsl:call-template name="component.toc">
41 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
42 </xsl:call-template>
43 <xsl:call-template name="component.toc.separator"/>
44 </xsl:if>
45 <xsl:call-template name="process.footnotes"/>
46 </div>
47 </xsl:template>
48
49 <!-- chapter:
50 Output non sect1 child elements before the TOC
51 Output title before div to be able to fix the title position -->
52 <!-- The original template is in {docbook-xsl}/xhtml/components.xsl -->
53 <xsl:template match="chapter">
54 <xsl:call-template name="id.warning"/>
55 <xsl:call-template name="chapter.titlepage"/>
56 <xsl:call-template name="component.separator"/>
57 <div>
58 <xsl:apply-templates select="." mode="class.attribute"/>
59 <xsl:call-template name="dir">
60 <xsl:with-param name="inherit" select="1"/>
61 </xsl:call-template>
62 <xsl:call-template name="language.attribute"/>
63 <xsl:if test="$generate.id.attributes != 0">
64 <xsl:attribute name="id">
65 <xsl:call-template name="object.id"/>
66 </xsl:attribute>
67 </xsl:if>
68 <xsl:apply-templates/>
69 <xsl:variable name="toc.params">
70 <xsl:call-template name="find.path.params">
71 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
72 </xsl:call-template>
73 </xsl:variable>
74 <xsl:if test="contains($toc.params, 'toc')">
75 <xsl:call-template name="component.toc">
76 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
77 </xsl:call-template>
78 <xsl:call-template name="component.toc.separator"/>
79 </xsl:if>
80 <xsl:call-template name="process.footnotes"/>
81 </div>
82 </xsl:template>
83
84 <!-- sect1:
85 When there is a role attibute, use it as the class value.
86 Process the SVN keywords found in sect1info as a footnote.
87 Output title before the containing <div> so that the title
88 can be at a fixed position.
89 Removed unused code. -->
90 <!-- The original template is in {docbook-xsl}/xhtml/sections.xsl -->
91 <xsl:template match="sect1">
92 <xsl:call-template name="sect1.titlepage"/>
93 <div>
94 <xsl:choose>
95 <xsl:when test="@role">
96 <xsl:attribute name="class">
97 <xsl:value-of select="@role"/>
98 </xsl:attribute>
99 </xsl:when>
100 <xsl:otherwise>
101 <xsl:apply-templates select="." mode="class.attribute"/>
102 </xsl:otherwise>
103 </xsl:choose>
104 <xsl:call-template name="language.attribute"/>
105 <xsl:apply-templates/>
106 <xsl:apply-templates select="sect1info" mode="svn-keys"/>
107 </div>
108 </xsl:template>
109
110 <!-- sect2:
111 When there is a role attibute, use it as the class value.
112 Removed unused code. -->
113 <!-- The original template is in {docbook-xsl}/xhtml/sections.xsl -->
114 <xsl:template match="sect2">
115 <div>
116 <xsl:choose>
117 <xsl:when test="@role">
118 <xsl:attribute name="class">
119 <xsl:value-of select="@role"/>
120 </xsl:attribute>
121 </xsl:when>
122 <xsl:otherwise>
123 <xsl:attribute name="class">
124 <xsl:value-of select="name(.)"/>
125 </xsl:attribute>
126 </xsl:otherwise>
127 </xsl:choose>
128 <xsl:call-template name="language.attribute"/>
129 <xsl:call-template name="sect2.titlepage"/>
130 <xsl:apply-templates/>
131 </div>
132 </xsl:template>
133
134 <!-- sect3: treat as sect2 (for Python and Perl modules
135 When there is a role attibute, use it as the class value.
136 Removed unused code. -->
137 <!-- The original template is in {docbook-xsl}/xhtml/sections.xsl -->
138 <xsl:template match="sect3">
139 <div>
140 <xsl:choose>
141 <xsl:when test="@role">
142 <xsl:attribute name="class">
143 <xsl:value-of select="@role"/>
144 </xsl:attribute>
145 </xsl:when>
146 <xsl:otherwise>
147 <xsl:attribute name="class">
148 <xsl:value-of select="name(.)"/>
149 </xsl:attribute>
150 </xsl:otherwise>
151 </xsl:choose>
152 <xsl:call-template name="language.attribute"/>
153 <xsl:call-template name="sect3.titlepage"/>
154 <xsl:apply-templates/>
155 </div>
156 </xsl:template>
157
158 <!-- sect1info mode svn-keys:
159 Self-made template to process SVN keywords found in sect1info. -->
160 <xsl:template match="sect1info" mode="svn-keys">
161 <!-- <p class="updated">Last updated --><!-- by
162 <xsl:apply-templates select="othername" mode="svn-keys"/> -->
163 <!-- on
164 <xsl:apply-templates select="date" mode="svn-keys"/>
165 </p> -->
166 </xsl:template>
167
168 <!-- othername mode svn-keys:
169 Self-made template to process the $LastChangedBy SVN keyword. -->
170 <xsl:template match="othername" mode="svn-keys">
171 <xsl:variable name="author">
172 <xsl:value-of select="."/>
173 </xsl:variable>
174 <xsl:variable name="nameonly">
175 <xsl:value-of select="substring($author,16)"/>
176 </xsl:variable>
177 <xsl:value-of select="substring-before($nameonly,'$')"/>
178 </xsl:template>
179
180 <!-- date mode svn-keys:
181 Self-made template to process the $Date SVN keyword. -->
182 <xsl:template match="date" mode="svn-keys">
183 <xsl:variable name="date">
184 <xsl:value-of select="."/>
185 </xsl:variable>
186 <xsl:value-of select="substring($date,7,26)"/>
187 </xsl:template>
188
189</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.