source: trunk/lib/docbook/custom-styles/docbook/plain/xsl/customized.chunked.xsl @ 7544

Last change on this file since 7544 was 7544, checked in by Nicklas Nordborg, 4 years ago

References #2131: Add support for installing multiple authentication managers

Added support for CSS syntax in the documentation.

  • Property svn:eol-style set to native
File size: 13.3 KB
Line 
1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                xmlns:fo="http://www.w3.org/1999/XSL/Format"
4                xmlns:date="http://exslt.org/dates-and-times"
5                exclude-result-prefixes="date"
6                version='1.0'>
7
8<xsl:import href="../../../lib/docbook/docbook/xsl/html/chunk.xsl" />
9
10<!-- (MM20040315) xsl parameters moved from ant-build-docbook.xml to here -->
11<xsl:param name="table.borders.with.css" select="1"/>
12<xsl:param name="html.stylesheet">css/docbook.css</xsl:param>
13<xsl:param name="html.stylesheet.type">text/css</xsl:param>       
14<xsl:param name="section.label.includes.component.label" select="1" />         
15<xsl:param name="section.autolabel" select="1" />
16<xsl:param name="section.autolabel.max.depth" select="2" />
17<xsl:param name="chunk.first.sections" select="1" />
18<xsl:param name="chunk.section.depth" select="2" />
19<xsl:param name="chunk.fast" select="1" />
20<xsl:param name="toc.max.depth" select="4"/>
21<xsl:param name="toc.section.depth" select="3" />
22<xsl:param name="generate.section.toc.level" select="1" />
23<xsl:param name="generate.toc">
24appendix  toc,title
25article/appendix  nop
26article   toc,title
27book      toc,title
28chapter   toc,title
29part      toc,title
30preface   toc,title
31qandadiv  toc
32qandaset  toc
33reference toc,title
34sect1     toc
35sect2     toc
36sect3     toc
37sect4     toc
38sect5     toc
39section   toc
40set       toc,title
41</xsl:param>
42<!-- Turn off image scaling when generating HTML output -->
43<xsl:param name="make.graphic.viewport" select="0"/>
44<xsl:param name="ignore.image.scaling" select="1"/>
45
46<xsl:param name="callout.graphics" select="1" />
47<xsl:param name="callout.graphics.path">gfx/admonitions/callouts/</xsl:param>
48<xsl:param name="callout.graphics.extension">.gif</xsl:param>
49<xsl:param name="admon.graphics" select="1"/>
50<xsl:param name="admon.graphics.path">gfx/admonitions/</xsl:param>
51<xsl:param name="admon.graphics.extension">.png</xsl:param>
52<xsl:param name="admon.style"></xsl:param>
53<xsl:param name="admonition.title.properties">text-align: left</xsl:param>
54<!-- xsl:param name="menuchoice.menu.separator">&#9658;</xsl:param-->
55<xsl:param name="menuchoice.menu.separator"></xsl:param>
56
57<xsl:param name="keep.relative.image.uris" select="false"/>
58<xsl:param name="use.id.as.filename" select="1"/>
59
60<!--  path to javadoc root as seen from docbook root -->
61<xsl:param name="javadoc.root.path">../api/</xsl:param>
62
63<xsl:param name="chunker.output.encoding">utf-8</xsl:param>
64<xsl:param name="chunker.output.doctype-public">-//W3C//DTD HTML 4.01 Transitional//EN</xsl:param>
65<xsl:param name="chunker.output.doctype-system">http://www.w3.org/TR/html4/loose.dtd</xsl:param>
66<xsl:param name="chunker.output.indent">yes</xsl:param>
67<xsl:param name="chunker.message.nofilename">1</xsl:param>
68
69<!-- (MM20040315) base.dir and root.filename are coming from the ant-build-docbook.xml -->
70<xsl:param name="base.dir">@base.dir@/</xsl:param>
71<xsl:param name="root.filename">@root.filename@</xsl:param>
72
73<!-- doc.revision and doc.last.modified -->
74<xsl:param name="doc.revision">@doc.revision@</xsl:param>
75<xsl:param name="doc.last.modified">@doc.last.modified@</xsl:param>
76<xsl:param name="base.version">@base.version@</xsl:param>
77
78<!-- convert url-only references to a format that is wrappable -->
79
80<xsl:template match="ulink" name="ulink">
81  <xsl:choose>
82  <xsl:when test="count(child::node())=0">
83  <a>
84      <xsl:if test="@id">
85        <xsl:attribute name="name">
86          <xsl:value-of select="@id"/>
87        </xsl:attribute>
88      </xsl:if>
89      <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
90      <xsl:if test="$ulink.target != ''">
91        <xsl:attribute name="target">
92          <xsl:value-of select="$ulink.target"/>
93        </xsl:attribute>
94      </xsl:if> 
95    <xsl:if test="count(child::node())=0">
96        <xsl:call-template name="insertInvisibleBreaks">
97            <xsl:with-param name="url" select="@url" />
98            <xsl:with-param name="breakat" select="translate(@url, '/-_:', '____')" />
99        </xsl:call-template>
100    </xsl:if>
101  </a>
102  </xsl:when>
103  <xsl:otherwise>
104  <xsl:apply-imports/>
105  </xsl:otherwise>
106  </xsl:choose>
107</xsl:template> 
108
109<xsl:template name="insertInvisibleBreaks">
110    <xsl:param name="url" />
111    <xsl:param name="breakat" />
112    <!-- <xsl:message><xsl:value-of select="concat('param:', $url, $breakat)" /></xsl:message> -->
113    <xsl:choose>
114        <xsl:when test="contains($breakat, '_')">
115            <xsl:value-of select="substring($url, 1, string-length(substring-before($breakat, '_'))+1)" /><wbr/>
116            <xsl:call-template name="insertInvisibleBreaks">
117                <xsl:with-param name="url" select="substring($url, string-length(substring-before($breakat, '_'))+2)"/>
118                <xsl:with-param name="breakat" select="substring($breakat, string-length(substring-before($breakat, '_'))+2)"/>
119            </xsl:call-template>
120        </xsl:when>
121        <xsl:otherwise>
122            <xsl:value-of select="$url" />
123        </xsl:otherwise>
124    </xsl:choose>
125</xsl:template>
126
127<!-- Base specific templates -->
128
129<xsl:template match="helptext">
130  <xsl:choose>
131    <xsl:when test="@webonly = '0'"> 
132      <xsl:apply-templates />
133    </xsl:when>
134  </xsl:choose>
135</xsl:template>
136
137<xsl:template match="seeother|other">
138</xsl:template>
139
140<xsl:template match="nohelp">
141  <xsl:apply-templates />
142</xsl:template>
143
144<xsl:template match="command">
145  <xsl:call-template name="inline.monoseq"/>
146</xsl:template>
147
148<xsl:template name="script">
149  <xsl:param name="src"></xsl:param>
150  <script>
151    <xsl:attribute name="language">JavaScript</xsl:attribute>
152    <xsl:attribute name="type">text/javascript</xsl:attribute>
153    <xsl:attribute name="src"><xsl:value-of select="$src" /></xsl:attribute>
154  </script>
155</xsl:template>
156
157<xsl:template name="user.head.content">
158  <xsl:variable name="pathtorootdir">
159    <xsl:call-template name="pathtorootdir" />
160  </xsl:variable>
161  <link rel="stylesheet"
162    type="text/css"
163    href="{concat($pathtorootdir, 'css/SyntaxHighlighter.css')}">
164  </link>
165  <xsl:call-template name="script">
166    <xsl:with-param name="src" select="concat($pathtorootdir, 'script/shCore.js')" />
167  </xsl:call-template>
168  <xsl:call-template name="script">
169    <xsl:with-param name="src" select="concat($pathtorootdir, 'script/shBrushJava.js')" />
170  </xsl:call-template>
171  <xsl:call-template name="script">
172    <xsl:with-param name="src" select="concat($pathtorootdir, 'script/shBrushXml.js')" />
173  </xsl:call-template>
174  <xsl:call-template name="script">
175    <xsl:with-param name="src" select="concat($pathtorootdir, 'script/shBrushSql.js')" />
176  </xsl:call-template>
177  <xsl:call-template name="script">
178    <xsl:with-param name="src" select="concat($pathtorootdir, 'script/shBrushJScript.js')" />
179  </xsl:call-template>
180  <xsl:call-template name="script">
181    <xsl:with-param name="src" select="concat($pathtorootdir, 'script/shBrushCss.js')" />
182  </xsl:call-template>
183</xsl:template>
184
185<xsl:template name="body.attributes">
186  <xsl:attribute name="onLoad">dp.SyntaxHighlighter.HighlightAll('pre', 'programlisting', null, false);</xsl:attribute>
187</xsl:template>
188
189<xsl:template name="user.footer.navigation">
190  <table width="100%" border="0" cellspacing="0" cellpadding="0">
191  <tr valign="bottom"><td>
192  <div 
193    class="navfooter"
194    align="left">
195    <i>
196      <xsl:if test="$doc.revision" >
197        Version: <xsl:value-of select="$base.version"/> (build #<xsl:value-of select="$doc.revision"/>);
198      </xsl:if>
199      <xsl:if test="$doc.last.modified" >
200        Last modified: <xsl:value-of select="$doc.last.modified" />;
201      </xsl:if>
202    </i>
203  </div>
204  </td>
205  <td>
206    <div class="navfooter" align="right">
207    <i>
208    Syntax coloring provided by <a href="http://alexgorbatchev.com/SyntaxHighlighter/">dp.SyntaxHighlighter</a>
209    </i>
210    </div>
211  </td>
212  </tr>
213  </table>
214</xsl:template>
215
216  <xsl:template name="convertpath">
217    <xsl:param name="path" select="''" />
218    <xsl:choose>
219      <xsl:when test="contains($path, '/')">
220        <xsl:text>../</xsl:text>
221        <xsl:call-template name="convertpath">
222          <xsl:with-param name="path" select="substring-after($path, '/')" />
223        </xsl:call-template>
224      </xsl:when>
225    </xsl:choose>
226  </xsl:template>
227
228  <xsl:template name="pathtorootdir">
229    <xsl:variable name="dir">
230      <xsl:call-template name="dbhtml-dir">
231        <xsl:with-param name="context" select="." />
232      </xsl:call-template>
233    </xsl:variable>
234    <xsl:call-template name="convertpath">
235      <xsl:with-param name="path" select="$dir" />
236    </xsl:call-template>
237  </xsl:template>
238
239  <xsl:template name="output.html.stylesheets">
240    <xsl:param name="stylesheets" select="''" />
241    <xsl:variable name="pathtorootdir">
242      <xsl:call-template name="pathtorootdir" />
243    </xsl:variable>
244    <xsl:choose>
245      <xsl:when test="contains($stylesheets, ' ')">
246        <link rel="stylesheet"
247          href="{substring-before(concat($pathtorootdir, $stylesheets), ' ')}">
248          <xsl:if test="$html.stylesheet.type != ''">
249            <xsl:attribute name="type">
250              <xsl:value-of select="$html.stylesheet.type" />
251            </xsl:attribute>
252          </xsl:if>
253        </link>
254        <xsl:call-template name="output.html.stylesheets">
255          <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')" />
256        </xsl:call-template>
257      </xsl:when>
258      <xsl:when test="$stylesheets != ''">
259        <link rel="stylesheet" href="{concat($pathtorootdir,$stylesheets)}">
260          <xsl:if test="$html.stylesheet.type != ''">
261            <xsl:attribute name="type">
262              <xsl:value-of select="$html.stylesheet.type" />
263            </xsl:attribute>
264          </xsl:if>
265        </link>
266      </xsl:when>
267    </xsl:choose>
268  </xsl:template>
269 
270  <xsl:template name="admon.graphic">
271    <xsl:param name="node" select="." />
272    <xsl:variable name="pathtorootdir">
273      <xsl:call-template name="pathtorootdir"/>
274    </xsl:variable>
275    <xsl:value-of select="concat($pathtorootdir, $admon.graphics.path)" />
276    <xsl:choose>
277      <xsl:when test="local-name($node)='note'">note</xsl:when>
278      <xsl:when test="local-name($node)='warning'">warning</xsl:when>
279      <xsl:when test="local-name($node)='caution'">caution</xsl:when>
280      <xsl:when test="local-name($node)='tip'">tip</xsl:when>
281      <xsl:when test="local-name($node)='important'">important</xsl:when>
282      <xsl:otherwise>note</xsl:otherwise>
283    </xsl:choose>
284    <xsl:value-of select="$admon.graphics.extension" />
285  </xsl:template>
286 
287  <xsl:template match="*" mode="admon.graphic.width">
288    <xsl:param name="node" select="."/>
289    <xsl:text>32</xsl:text>
290  </xsl:template>
291 
292  <xsl:template match="note|warning|tip|important|caution" mode="class.attribute">
293    <xsl:param name="class" select="local-name(.)"/>
294    <!-- permit customization of class attributes -->
295    <!-- Use element name by default -->
296    <xsl:attribute name="class">
297      <xsl:value-of select="concat('admonition ', $class)"/>
298    </xsl:attribute>
299  </xsl:template>
300 
301  <xsl:template match="classname">
302    <xsl:call-template name="inline.monoseq"/>
303    <xsl:call-template name="linkToJavadoc" />
304  </xsl:template>
305 
306  <xsl:template match="interfacename">
307    <xsl:call-template name="inline.monoseq"/>
308    <xsl:call-template name="linkToJavadoc" />
309  </xsl:template>
310 
311  <xsl:template name="linkToJavadoc">
312    <xsl:if test = "@docapi != ''">
313        <xsl:variable name="cleanClassName">
314          <xsl:choose>
315            <xsl:when test="starts-with(., @docapi)">
316              <xsl:value-of select="substring-after(., concat(@docapi, '.'))" />
317            </xsl:when>
318            <xsl:otherwise>
319              <xsl:value-of select="." />
320            </xsl:otherwise>
321          </xsl:choose>                     
322        </xsl:variable>
323       
324        <xsl:variable name="fullClassName">
325            <xsl:value-of select="concat(@docapi, '.', $cleanClassName)"/>
326        </xsl:variable>
327
328      <xsl:variable name="classPath">
329        <xsl:call-template name="replaceCharsInString">
330          <xsl:with-param name="stringIn" select="$fullClassName"/>
331          <xsl:with-param name="charsIn" select="'.'" />
332          <xsl:with-param name="charsOut" select="'/'" />
333        </xsl:call-template>
334        </xsl:variable>
335       
336        <xsl:variable name="pathtorootdir">
337          <xsl:call-template name="pathtorootdir" />
338        </xsl:variable>
339       
340      <a>
341        <xsl:attribute name="href">
342          <xsl:value-of select="concat($pathtorootdir, $javadoc.root.path, $classPath, '.html')" />
343        </xsl:attribute>
344        <xsl:attribute name="title">
345          <xsl:value-of select="concat('Javadoc for ', $fullClassName)" />
346        </xsl:attribute>
347        <img>
348          <xsl:attribute name="src">
349          <xsl:value-of select="concat($pathtorootdir, $admon.graphics.path, 'docapi.gif')"/>
350          </xsl:attribute> 
351          <xsl:attribute name="style">padding-left: 4px;</xsl:attribute>
352          <xsl:attribute name="border">0</xsl:attribute>
353        </img>
354      </a>
355    </xsl:if> 
356  </xsl:template>
357 
358  <xsl:template name="replaceCharsInString">
359      <xsl:param name="stringIn"/>
360      <xsl:param name="charsIn"/>
361      <xsl:param name="charsOut"/>
362      <xsl:choose>
363      <xsl:when test="contains($stringIn,$charsIn)">
364          <xsl:value-of select="concat(substring-before($stringIn,$charsIn),$charsOut)"/>
365          <xsl:call-template name="replaceCharsInString">
366            <xsl:with-param name="stringIn" select="substring-after($stringIn,$charsIn)"/>
367            <xsl:with-param name="charsIn" select="$charsIn"/>
368            <xsl:with-param name="charsOut" select="$charsOut"/>
369          </xsl:call-template>
370      </xsl:when>
371      <xsl:otherwise>
372          <xsl:value-of select="$stringIn"/>
373        </xsl:otherwise>
374      </xsl:choose>
375  </xsl:template>
376
377  <xsl:template match="lastmodified">
378    <xsl:value-of select="$doc.last.modified"/> 
379  </xsl:template>
380 
381  <xsl:template match="baseversion">
382    <xsl:value-of select="$base.version"/> 
383  </xsl:template>
384
385</xsl:stylesheet>
386
387
Note: See TracBrowser for help on using the repository browser.