source: clfs-embedded/BOOK/stylesheets/lfs-xsl/xhtml/lfs-sections.xsl@ ea546c8

Last change on this file since ea546c8 was 9882b55, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added the new lfs-xsl stylesheets.

  • Property mode set to 100644
File size: 5.8 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 how preface, chapter, and sections are handled -->
13
14 <!-- Chunk the first top-level section? 1 = yes, 0 = no
15 If preface and chapters TOC are generated, this must be 1. -->
16 <xsl:param name="chunk.first.sections" select="1"/>
17
18 <!-- preface:
19 Output non sect1 child elements before the TOC -->
20 <!-- The original template is in {docbook-xsl}/xhtml/components.xsl -->
21 <xsl:template match="preface">
22 <xsl:call-template name="id.warning"/>
23 <div>
24 <xsl:apply-templates select="." mode="class.attribute"/>
25 <xsl:call-template name="dir">
26 <xsl:with-param name="inherit" select="1"/>
27 </xsl:call-template>
28 <xsl:call-template name="language.attribute"/>
29 <xsl:if test="$generate.id.attributes != 0">
30 <xsl:attribute name="id">
31 <xsl:call-template name="object.id"/>
32 </xsl:attribute>
33 </xsl:if>
34 <xsl:call-template name="component.separator"/>
35 <xsl:call-template name="preface.titlepage"/>
36 <xsl:apply-templates/>
37 <xsl:variable name="toc.params">
38 <xsl:call-template name="find.path.params">
39 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
40 </xsl:call-template>
41 </xsl:variable>
42 <xsl:if test="contains($toc.params, 'toc')">
43 <xsl:call-template name="component.toc">
44 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
45 </xsl:call-template>
46 <xsl:call-template name="component.toc.separator"/>
47 </xsl:if>
48 <xsl:call-template name="process.footnotes"/>
49 </div>
50 </xsl:template>
51
52 <!-- chapter:
53 Output non sect1 child elements before the TOC -->
54 <!-- The original template is in {docbook-xsl}/xhtml/components.xsl -->
55 <xsl:template match="chapter">
56 <xsl:call-template name="id.warning"/>
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:call-template name="component.separator"/>
69 <xsl:call-template name="chapter.titlepage"/>
70 <xsl:apply-templates/>
71 <xsl:variable name="toc.params">
72 <xsl:call-template name="find.path.params">
73 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
74 </xsl:call-template>
75 </xsl:variable>
76 <xsl:if test="contains($toc.params, 'toc')">
77 <xsl:call-template name="component.toc">
78 <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
79 </xsl:call-template>
80 <xsl:call-template name="component.toc.separator"/>
81 </xsl:if>
82 <xsl:call-template name="process.footnotes"/>
83 </div>
84 </xsl:template>
85
86 <!-- sect1:
87 When there is a role attibute, use it as the class value.
88 Process the SVN keywords found in sect1info as a footnote.
89 Removed unused code. -->
90 <!-- The original template is in {docbook-xsl}/xhtml/sections.xsl -->
91 <xsl:template match="sect1">
92 <div>
93 <xsl:choose>
94 <xsl:when test="@role">
95 <xsl:attribute name="class">
96 <xsl:value-of select="@role"/>
97 </xsl:attribute>
98 </xsl:when>
99 <xsl:otherwise>
100 <xsl:apply-templates select="." mode="class.attribute"/>
101 </xsl:otherwise>
102 </xsl:choose>
103 <xsl:call-template name="language.attribute"/>
104 <xsl:call-template name="sect1.titlepage"/>
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 <!-- sect1info mode svn-keys:
135 Self-made template to process SVN keywords found in sect1info. -->
136 <xsl:template match="sect1info" mode="svn-keys">
137 <p class="updated">Last updated <!-- by
138 <xsl:apply-templates select="othername" mode="svn-keys"/> -->
139 on
140 <xsl:apply-templates select="date" mode="svn-keys"/>
141 </p>
142 </xsl:template>
143
144 <!-- othername mode svn-keys:
145 Self-made template to process the $LastChangedBy SVN keyword. -->
146 <xsl:template match="othername" mode="svn-keys">
147 <xsl:variable name="author">
148 <xsl:value-of select="."/>
149 </xsl:variable>
150 <xsl:variable name="nameonly">
151 <xsl:value-of select="substring($author,16)"/>
152 </xsl:variable>
153 <xsl:value-of select="substring-before($nameonly,'$')"/>
154 </xsl:template>
155
156 <!-- date mode svn-keys:
157 Self-made template to process the $Date SVN keyword. -->
158 <xsl:template match="date" mode="svn-keys">
159 <xsl:variable name="date">
160 <xsl:value-of select="."/>
161 </xsl:variable>
162 <xsl:value-of select="substring($date,7,26)"/>
163 </xsl:template>
164
165</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.