subs: remove --utf8 and --unicode, simplify code
[mplayer.git] / DOCS / xml / xsl / ldp-html-common.xsl
blobf51405db27af9027188427e709763eec5bfe4113
1 <?xml version='1.0'?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 version='1.0'
4 xmlns="http://www.w3.org/TR/xhtml1/transitional"
5 exclude-result-prefixes="#default">
7 <!-- $Id -->
9 <!-- Experimental stylesheet by Dan York
10 This is an attempt to replicate the customizations done in ldp.dsl
11 Each customization in ldp.dsl is listed in the order in which it
12 appears (in ldp.dsl) with the corresponding XSLT template or setting
13 below it. Where there is no XSLT code below an item, that particular
14 customization of ldp.dsl is not yet supported here. Some additional
15 options and features have been added and are noted as not being in
16 ldp.dsl. The work on this stylesheet began 5 Jul 2001. -->
18 <!-- Note that this file, 'ldp-html-common.xsl', is NOT intended to be
19 called directly. Instead, you should call either of two stylesheets:
20 'ldp-html.xsl' or 'ldp-html-chunk.xsl'. The former generates a SINGLE
21 HTML file, while the latter performs "chunking" to generate MULTIPLE
22 HTML files. Both of those files import the appropriate Norman Walsh
23 stylesheet and then import this customization layer. -->
25 <!-- NOT IN LDP.DSL - This stylesheet supports the additional use of the
26 "role" and "condition" attributes to the <author> tag. The XSLT template
27 is listed later in the stylesheet, but the text lables are listed
28 here in order to make localization of the stylesheet easier. Note
29 that spaces *are* significant in the value, so you should have a
30 space after the colon. -->
32 <xsl:variable name="maintainerlabel">Maintainer: </xsl:variable>
33 <xsl:variable name="authorlabel">Author: </xsl:variable>
36 <!-- NOT IN LDP.DSL
37 Creates header content in all generated HTML files -->
39 <xsl:template name="user.head.content">
40 <xsl:param name="node" select="."/>
41 <meta name="generator" content="Experimental LDP.XSL $Revision$"/>
42 <xsl:text>
43 </xsl:text>
44 <xsl:comment> Generated by LDP XSLT customization layer
45 based on Norman Walsh's DocBook XSL stylesheets.
46 More information at http://www.linuxdoc.org/ </xsl:comment>
47 <xsl:text>
48 </xsl:text>
50 </xsl:template>
52 <!-- declare-characteristic preserve-sdata?
53 No longer appears necessary as it is a JadeTex issue. -->
55 <!-- generate-legalnotice-link?
56 Not currently supported in Norm's XSL stylesheets. Logged
57 at SourceForge as a bug. -->
59 <!-- Should graphics be used for admonitions (notes, warnings)? 0 or 1 -->
60 <xsl:param name="admon.graphics" select="0"/>
62 <!-- If using admon graphics (1 above), what is path to graphics?
63 Should be the path relative to your document and MUST end with
64 a trailing slash. Also, this parameter needs to be on a
65 single line. -->
66 <xsl:param name="admon.graphics.path">images/</xsl:param>
69 <!-- Make funcsynopsis look pretty -->
70 <xsl:param name="funcsynopsis.decoration" select="1" doc:type="boolean"/>
72 <!-- Extension for HTML files -->
73 <xsl:param name="html.ext" select="'.html'"/>
75 <!-- Generate TOCs for book, article, part -->
76 <xsl:param name="generate.book.toc" select="1" doc:type="boolean"/>
77 <xsl:param name="generate.article.toc" select="1" doc:type="boolean"/>
78 <xsl:param name="generate.part.toc" select="1" doc:type="boolean"/>
80 <!-- generate-book-titlepage -->
82 <!-- generate-article-titlepage -->
84 <!-- Equivalent to chunk-skip-first-element-list - forces TOC on separate page
85 If 0, first sect is on page for chapter or article -->
86 <xsl:param name="chunk.first.sections" select="'1'"/>
89 <!-- NOT IN LDP.DSL -->
90 <!-- Create chunks for top-level sections. If 0, chunks will only be
91 created for chapters/appendixes, and NOT for sectx elements -->
92 <xsl:param name="chunk.sections" select="'1'"/>
94 <!-- list-element-list - NO LONGER NEEDED - bug fix -->
96 <!-- Filename for the root chunk -->
97 <xsl:param name="root.filename" select="'index'"/>
99 <!-- shade-verbatim
100 I have created a function below that shades the verbatim sections.
101 logic would need to be added to check if this is set.
102 Norm has added parameters to his 1.44 stylesheets that support
103 shading verbatim sections. However, it looks like it requires
104 an attribute to a table to have verbatim shading. Needs to be
105 explored further. -->
107 <!-- When chunking, use id attribute as filename? 0 or 1 -->
108 <xsl:param name="use.id.as.filename" select="1"/>
110 <!-- graphic-extensions - NO LONGER NEEDED?? -->
112 <!-- default graphic filename extension -->
113 <xsl:param name="graphic.default.extension" select="'.gif'" doc:type="string"/>
115 <!-- Should chapters be labeled? 0 or 1 -->
116 <xsl:param name="chapter.autolabel" select="1"/>
118 <!-- Should sections be labeled? 0 or 1 -->
119 <xsl:param name="section.autolabel" select="1"/>
121 <!-- Related to section labels, should those labels include the chapter
122 number in them (i.e., 1.1, 1.2, 1.3, 1.4 )-->
123 <xsl:param name="section.label.includes.component.label" select="1" doc:type="boolean"/>
125 <!-- To what depth (in sections) should the TOC go? -->
126 <xsl:param name="toc.section.depth" select="2"/>
128 <!-- Custom 'emphasis' template to allow 'role="strong"' to
129 also produce a bold item. -->
130 <xsl:template match="emphasis">
131 <xsl:choose>
132 <xsl:when test="(@role='strong') or (@role='bold')">
133 <xsl:call-template name="inline.boldseq"/>
134 </xsl:when>
135 <xsl:otherwise>
136 <xsl:call-template name="inline.italicseq"/>
137 </xsl:otherwise>
138 </xsl:choose>
139 </xsl:template>
141 <!-- book-titlepage-recto-elements
142 article-titlepage-recto-elements
143 article-titlepage-recto-mode
144 article-title
146 - Customizing these elements (for instance, to list what is on the
147 title page) involves writing a layer for html/titlepage.templates.xml and the
148 other files html/titlepage.xsl and html/titlepage.templates.xsl - Norm
149 is doing something funky here and I haven't fully figured it out. -->
151 <!-- The remainder of ldp.dsl deals with changing the foreground and
152 background colors of verbatim elements although in reading through the
153 DSSSL it doesn't look like it actually changed the foreground colors.
154 The changing of the background shading can be done at two locations
155 (one numbered, one not) in the template below. -->
157 <!-- Custom template for programlisting, screen and synopsis to generate a gray
158 background to the item. -->
159 <xsl:template match="programlisting|screen|synopsis">
160 <xsl:param name="suppress-numbers" select="'0'"/>
161 <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
162 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
164 <xsl:if test="@id">
165 <a href="{$id}"/>
166 </xsl:if>
168 <xsl:choose>
169 <xsl:when test="$suppress-numbers = '0'
170 and @linenumbering = 'numbered'
171 and $use.extensions != '0'
172 and $linenumbering.extension != '0'">
173 <xsl:variable name="rtf">
174 <xsl:apply-templates/>
175 </xsl:variable>
176 <!-- Change the color bacground color in the line below. -->
177 <table border="0" bgcolor="#E0E0E0" width="90%">
178 <tr><td>
179 <pre class="{name(.)}">
180 <xsl:call-template name="number.rtf.lines">
181 <xsl:with-param name="rtf" select="$rtf"/>
182 </xsl:call-template>
183 </pre>
184 </td></tr></table>
185 </xsl:when>
186 <xsl:otherwise>
187 <!-- Change the color bacground color in the line below. -->
188 <table border="0" bgcolor="#E0E0E0" width="90%">
189 <tr><td>
190 <pre class="{name(.)}">
191 <xsl:apply-templates/>
192 </pre>
193 </td></tr></table>
194 </xsl:otherwise>
195 </xsl:choose>
196 </xsl:template>
198 <!-- NOT IN LDP.DSL. Custom template to allow Maintainer to be a role in
199 the Author element. It also checks for a "condition" attribute
200 to the <author> element. If it finds the condition attribute, it
201 copies VERBATIM the value of the attribute to be in front of the
202 word Author or Maintainer. This is done to allow maximum flexibility.
203 Note that an <xsl:text> element was necessary to put the space
204 between the condition and the word Author or Maintainer. -->
206 <xsl:template match="author" mode="titlepage.mode">
207 <h3 class="{name(.)}">
208 <!-- If there is a condition attribute, print it VERBATIM first -->
209 <xsl:if test="@condition"><i><xsl:value-of select="@condition"/></i>
210 <xsl:text> </xsl:text></xsl:if>
211 <!-- Test to see if there is a role. If maintainer, print that. If not,
212 assume it is an author. -->
213 <xsl:choose>
214 <xsl:when test="@role='maintainer'">
215 <i><xsl:value-of select="$maintainerlabel"/></i>
216 </xsl:when>
217 <xsl:otherwise>
218 <i><xsl:value-of select="$authorlabel"/></i>
219 </xsl:otherwise>
220 </xsl:choose>
221 <xsl:call-template name="person.name"/>
222 </h3>
223 <xsl:apply-templates mode="titlepage.mode" select="./contrib"/>
224 <xsl:apply-templates mode="titlepage.mode" select="./affiliation"/>
225 </xsl:template>
228 </xsl:stylesheet>