PageRenderTime 117ms CodeModel.GetById 96ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/build-support/trunk/users-guide.xsl

#
Extensible Stylesheet Language Transformations | 419 lines | 367 code | 52 blank | 0 comment | 0 complexity | b2500b5232a071a5f7463f05821e582e MD5 | raw file
  1<?xml version='1.0'?>
  2<!-- :folding=explicit: -->
  3<!-- You should use this XSL stylesheet to create plugin documentation.
  4
  5     If you want all output in a single HTML file, specify the path to
  6     your DocBook-XSL "html/docbook.xsl" file in the <xsl:import>
  7     statement below. If you want each chapter to have its own file,
  8     specify the path to your "html/chunk.xsl".
  9
 10	 This stylesheet assumes the user's guide XML source is in a
 11	 subdirectory of the plugin's main dir (e.g., "docs/users-guide.xml").
 12-->
 13
 14<xsl:stylesheet
 15	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 16	version="1.0"
 17	xmlns="http://www.w3.org/TR/xhtml1/transitional"
 18	xmlns:date="http://exslt.org/dates-and-times"
 19	extension-element-prefixes="date"
 20	exclude-result-prefixes="#default">
 21
 22	<xsl:import href="file:///@docs.style.sheet@" />
 23
 24	<!-- chunk by chapters instead of sections by setting chunk.section.depth to 0
 25	     instead of the default 1 -->
 26	<xsl:param name="chunk.section.depth" select="1"/>
 27	
 28	<!-- Swing HTML control doesn't support &ldquo; and &rdquo; -->
 29	<xsl:template match="quote">&quot;<xsl:apply-templates/>&quot;</xsl:template>
 30
 31	<xsl:template match="guibutton">
 32		<xsl:call-template name="inline.boldseq"/>
 33	</xsl:template>
 34
 35	<xsl:template match="guiicon">
 36		<xsl:call-template name="inline.boldseq"/>
 37	</xsl:template>
 38
 39	<xsl:template match="guilabel">
 40		<xsl:call-template name="inline.boldseq"/>
 41	</xsl:template>
 42
 43	<xsl:template match="guimenu">
 44		<xsl:call-template name="inline.boldseq"/>
 45	</xsl:template>
 46
 47	<xsl:template match="guimenuitem">
 48		<xsl:call-template name="inline.boldseq"/>
 49	</xsl:template>
 50
 51	<xsl:template match="guisubmenu">
 52		<xsl:call-template name="inline.boldseq"/>
 53	</xsl:template>
 54
 55	<xsl:template match="image">
 56		<p>
 57			<center>
 58				<img src="{src}" />
 59			</center>
 60		</p>
 61	</xsl:template>
 62
 63	<xsl:template match="br">
 64		<br />
 65	</xsl:template>
 66
 67	<xsl:param name="toc.list.type">ul</xsl:param>
 68	<xsl:param name="use.id.as.filename">1</xsl:param>
 69	<xsl:param name="shade.verbatim">1</xsl:param>
 70
 71	<xsl:param name="funcsynopsis.style">ansi</xsl:param>
 72	<xsl:template match="void">
 73		<xsl:apply-templates/>
 74	</xsl:template>
 75
 76
 77	<xsl:param name="chunk.first.sections">1</xsl:param>
 78
 79	<xsl:template match="*" mode="object.title.markup.textonly">
 80		<xsl:variable name="title">
 81			<xsl:apply-templates select="." mode="title.markup"/>
 82		</xsl:variable>
 83  <!-- used to get the html title of the page -->
 84		<xsl:value-of select="$title"/>
 85	</xsl:template>
 86
 87<!-- {{{ TOC generation -->
 88	<xsl:template match="/">
 89		<xsl:call-template name="toc"/>
 90	</xsl:template>
 91
 92	<xsl:template name="toc">
 93		<xsl:apply-templates/>
 94		<xsl:call-template name="write.chunk">
 95			<xsl:with-param name="filename" select="'toc.xml'"/>
 96			<xsl:with-param name="method" select="'xml'"/>
 97			<xsl:with-param name="indent" select="'yes'"/>
 98			<xsl:with-param name="content">
 99				<xsl:call-template name="toc.content"/>
100			</xsl:with-param>
101		</xsl:call-template>
102	</xsl:template>
103
104	<xsl:template name="toc.content">
105		<TOC>
106			<xsl:apply-templates select="." mode="my.toc"/>
107		</TOC>
108	</xsl:template>
109
110	<xsl:template match="set" mode="my.toc">
111		<ENTRY>
112			<xsl:attribute name="HREF">
113				<xsl:call-template name="href.target">
114					<xsl:with-param name="object" select="."/>
115				</xsl:call-template>
116			</xsl:attribute>
117			<TITLE>
118				<xsl:apply-templates mode="title.markup" select="."/>
119			</TITLE>
120			<xsl:apply-templates select="book" mode="my.toc"/>
121		</ENTRY>
122	</xsl:template>
123
124	<xsl:template match="book" mode="my.toc">
125		<ENTRY>
126			<xsl:attribute name="HREF">
127				<xsl:call-template name="href.target">
128					<xsl:with-param name="object" select="."/>
129				</xsl:call-template>
130			</xsl:attribute>
131			<TITLE>
132				<xsl:apply-templates mode="title.markup" select="."/>
133			</TITLE>
134			<xsl:apply-templates select="part|reference|preface|chapter|appendix|article|colophon" mode="my.toc"/>
135		</ENTRY>
136	</xsl:template>
137
138	<xsl:template match="part|reference|preface|chapter|appendix|article" mode="my.toc">
139		<ENTRY>
140			<xsl:attribute name="HREF">
141				<xsl:call-template name="href.target">
142					<xsl:with-param name="object" select="."/>
143				</xsl:call-template>
144			</xsl:attribute>
145			<TITLE>
146				<xsl:apply-templates mode="title.markup" select="."/>
147			</TITLE>
148			<xsl:apply-templates select="preface|chapter|appendix|refentry|section|sect1" mode="my.toc"/>
149		</ENTRY>
150	</xsl:template>
151
152	<xsl:template match="section" mode="my.toc">
153		<ENTRY>
154			<xsl:attribute name="HREF">
155				<xsl:call-template name="href.target">
156					<xsl:with-param name="object" select="."/>
157				</xsl:call-template>
158			</xsl:attribute>
159			<TITLE>
160				<xsl:apply-templates mode="title.markup" select="."/>
161			</TITLE>
162			<xsl:apply-templates select="section" mode="my.toc"/>
163		</ENTRY>
164	</xsl:template>
165
166	<xsl:template match="sect1" mode="my.toc">
167		<ENTRY>
168			<xsl:attribute name="HREF">
169				<xsl:call-template name="href.target">
170					<xsl:with-param name="object" select="."/>
171				</xsl:call-template>
172			</xsl:attribute>
173			<TITLE>
174				<xsl:apply-templates mode="title.markup" select="."/>
175			</TITLE>
176			<xsl:apply-templates select="sect2" mode="my.toc"/>
177		</ENTRY>
178	</xsl:template>
179
180	<xsl:template match="sect2" mode="my.toc">
181		<ENTRY>
182			<xsl:attribute name="HREF">
183				<xsl:call-template name="href.target">
184					<xsl:with-param name="object" select="."/>
185				</xsl:call-template>
186			</xsl:attribute>
187			<TITLE>
188				<xsl:apply-templates mode="title.markup" select="."/>
189			</TITLE>
190			<xsl:apply-templates select="sect3" mode="my.toc"/>
191		</ENTRY>
192	</xsl:template>
193
194	<xsl:template match="sect3" mode="my.toc">
195		<ENTRY>
196			<xsl:attribute name="HREF">
197				<xsl:call-template name="href.target">
198					<xsl:with-param name="object" select="."/>
199				</xsl:call-template>
200			</xsl:attribute>
201			<TITLE>
202				<xsl:apply-templates mode="title.markup" select="."/>
203			</TITLE>
204			<xsl:apply-templates select="sect4" mode="my.toc"/>
205		</ENTRY>
206	</xsl:template>
207
208	<xsl:template match="sect4" mode="my.toc">
209		<ENTRY>
210			<xsl:attribute name="HREF">
211				<xsl:call-template name="href.target">
212					<xsl:with-param name="object" select="."/>
213				</xsl:call-template>
214			</xsl:attribute>
215			<TITLE>
216				<xsl:apply-templates mode="title.markup" select="."/>
217			</TITLE>
218			<xsl:apply-templates select="sect5" mode="my.toc"/>
219		</ENTRY>
220	</xsl:template>
221
222	<xsl:template match="sect5|colophon" mode="my.toc">
223		<ENTRY>
224			<xsl:attribute name="HREF">
225				<xsl:call-template name="href.target">
226					<xsl:with-param name="object" select="."/>
227				</xsl:call-template>
228			</xsl:attribute>
229			<TITLE>
230				<xsl:apply-templates mode="title.markup" select="."/>
231			</TITLE>
232		</ENTRY>
233	</xsl:template>
234
235<!-- }}} -->
236
237<!-- {{{ Dale's gorgeous HTMl template -->
238
239	<!-- title banner, from docbook/html/titlepage.templates.xsl -->
240	<xsl:template name="article.titlepage.recto">
241		<xsl:call-template name="article-or-book.titlepage.recto"/>
242	</xsl:template>
243	
244	<xsl:template name="book.titlepage.recto">
245		<xsl:call-template name="article-or-book.titlepage.recto"/>
246	</xsl:template>
247
248	<xsl:template name="article-or-book.titlepage.recto">
249		<table summary="Header" cellspacing="0" border="0" width="100%" cols="2">
250			<tr width="100%"  bgcolor="#CCCCFF">
251				<!-- left cell : title, copyright -->
252				<td valign="TOP">
253					<xsl:choose>
254						<xsl:when test="bookinfo/title">
255							<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="bookinfo/title"/>
256						</xsl:when>
257						<xsl:when test="articleinfo/title">
258							<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/title"/>
259						</xsl:when>
260						<xsl:when test="artheader/title">
261							<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/title"/>
262						</xsl:when>
263						<xsl:when test="info/title">
264							<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/title"/>
265						</xsl:when>
266						<xsl:when test="title">
267							<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="title"/>
268						</xsl:when>
269					</xsl:choose>
270					
271					<!-- maybe the copyright notice should go on another line... -->
272					<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/copyright"/>
273					<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="bookinfo/copyright"/>
274					<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/copyright"/>
275					<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/copyright"/>
276				</td>
277				<!-- right cell : version, generation date and authors -->
278				<td valign="TOP" align="RIGHT">
279					<font size="-1">
280						<p>
281							<strong>
282							<!-- release -->
283								<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/releaseinfo"/>
284								<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="bookinfo/releaseinfo"/>
285								<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/releaseinfo"/>
286								<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/releaseinfo"/>
287
288								<!-- compute release date automatically -->
289								<xsl:text> (</xsl:text>
290								<xsl:value-of select="concat(date:month-name(),' ',date:day-in-month(), ' ', date:year())"/>
291								<xsl:text>)</xsl:text>
292							</strong>
293						</p>
294
295						<!-- hackish list of authors -->
296						<xsl:for-each select="//author">
297							<p>
298								<xsl:apply-templates select="."/>
299							</p>
300						</xsl:for-each>
301					</font>
302				</td>
303			</tr>
304		</table>
305
306		<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/legalnotice"/>
307		<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/legalnotice"/>
308		<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/legalnotice"/>
309		
310		<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/revhistory"/>
311		<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/revhistory"/>
312		<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/revhistory"/>
313		
314		<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="articleinfo/abstract"/>
315		<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="artheader/abstract"/>
316		<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="info/abstract"/>
317	</xsl:template>
318
319	<xsl:template match="title" mode="article.titlepage.recto.auto.mode">
320		<strong>
321			<font size="+2">
322				<xsl:value-of select="."/>
323			</font>
324		</strong>
325	</xsl:template>
326	<xsl:template match="releaseinfo" mode="article.titlepage.recto.auto.mode">
327		<xsl:apply-templates/>
328	</xsl:template>
329
330	<!--  whole line white on blue banner for the legal notice
331	     overrides docbook-xsl/html/titlepage.xsl
332	     disabled because I prefer a standard legal notice title
333	 -->
334	<!--<xsl:template match="legalnotice/title" mode="titlepage.mode">
335		<xsl:call-template name="section.heading">
336			<xsl:with-param name="section" select="parent::*"/>
337			<xsl:with-param name="allow-anchors" select="0"/>
338			<xsl:with-param name="title" select="string(.)"/>
339		</xsl:call-template>
340	</xsl:template>-->
341
342	<!-- whole line white on blue banner for each (sub)section
343	     overrides docbook-xsl/html/sections.xsl
344	  -->
345	<xsl:template name="section.heading">
346		<xsl:param name="section" select="."/>
347		<xsl:param name="level" select="1"/>
348		<xsl:param name="allow-anchors" select="1"/>
349		<xsl:param name="title"/>
350		<xsl:param name="class" select="'title'"/>
351
352		<xsl:variable name="id">
353			<xsl:choose>
354      <!-- Make sure the subtitle doesn't get the same id as the title -->
355				<xsl:when test="self::subtitle">
356					<xsl:call-template name="object.id">
357						<xsl:with-param name="object" select="."/>
358					</xsl:call-template>
359				</xsl:when>
360      <!-- if title is in an *info wrapper, get the grandparent -->
361				<xsl:when test="contains(local-name(..), 'info')">
362					<xsl:call-template name="object.id">
363						<xsl:with-param name="object" select="../.."/>
364					</xsl:call-template>
365				</xsl:when>
366				<xsl:otherwise>
367					<xsl:call-template name="object.id">
368						<xsl:with-param name="object" select=".."/>
369					</xsl:call-template>
370				</xsl:otherwise>
371			</xsl:choose>
372		</xsl:variable>
373
374		<table summary="{.}" border="0" cellspacing="0" cellpadding="0" width="100%">
375			<tr align="CENTER" width="100%">
376				<td bgcolor="#7FB2FF" width="100%">
377					<strong>
378						<font color="#FFFFFF" size="+1">
379							<span>
380								<xsl:if test="$allow-anchors != 0 and $generate.id.attributes = 0">
381									<xsl:call-template name="anchor">
382										<xsl:with-param name="node" select="$section"/>
383										<xsl:with-param name="conditional" select="0"/>
384									</xsl:call-template>
385								</xsl:if>
386								<xsl:if test="$generate.id.attributes != 0 and not(local-name(.) = 'appendix')">
387									<xsl:attribute name="id">
388										<xsl:value-of select="$id"/>
389									</xsl:attribute>
390								</xsl:if>
391								<xsl:copy-of select="$title"/>
392							</span>
393						</font>
394					</strong>
395				</td>
396			</tr>
397		</table>
398	</xsl:template>
399	
400<!-- for chapter titles,
401     overrides docbook-xsl/html/component.xsl
402  -->
403<xsl:template name="component.title">
404  <xsl:param name="node" select="."/>
405
406   <xsl:call-template name="section.heading">
407   	<xsl:with-param name="title">
408      <xsl:apply-templates select="$node" mode="object.title.markup">
409    	  <xsl:with-param name="allow-anchors" select="1"/>
410      </xsl:apply-templates>
411    </xsl:with-param>
412    <xsl:with-param name="section" select="$node"/>
413    </xsl:call-template>
414    
415</xsl:template>
416
417
418<!-- }}} -->
419</xsl:stylesheet>