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

Last change on this file since 3378 was 3378, checked in by Nicklas Nordborg, 16 years ago

Render <command> tags in monospace font.

  • Property svn:eol-style set to native
File size: 7.8 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">.gif</xsl:param>
52<xsl:param name="admon.style">margin-left: 2em; margin-right: 2em;</xsl:param>
53<xsl:param name="admonition.title.properties">text-align: left</xsl:param>
54
55<xsl:param name="keep.relative.image.uris" select="false"/>
56<xsl:param name="use.id.as.filename" select="1"/>
57
58<xsl:param name="chunker.output.encoding">utf-8</xsl:param>
59<xsl:param name="chunker.output.indent">yes</xsl:param>
60<xsl:param name="chunker.message.nofilename">1</xsl:param>
61
62<!-- (MM20040315) base.dir and root.filename are coming from the ant-build-docbook.xml -->
63<xsl:param name="base.dir">@base.dir@/</xsl:param>
64<xsl:param name="root.filename">@root.filename@</xsl:param>
65
66<!-- doc.revision and doc.last.modified -->
67<xsl:param name="doc.revision">@doc.revision@</xsl:param>
68<xsl:param name="doc.last.modified">@doc.last.modified@</xsl:param>
69<xsl:param name="base.version">@base.version@</xsl:param>
70
71<!-- convert url-only references to a format that is wrappable -->
72
73<xsl:template match="ulink" name="ulink">
74  <xsl:choose>
75  <xsl:when test="count(child::node())=0">
76  <a>
77      <xsl:if test="@id">
78        <xsl:attribute name="name">
79          <xsl:value-of select="@id"/>
80        </xsl:attribute>
81      </xsl:if>
82      <xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
83      <xsl:if test="$ulink.target != ''">
84        <xsl:attribute name="target">
85          <xsl:value-of select="$ulink.target"/>
86        </xsl:attribute>
87      </xsl:if> 
88    <xsl:if test="count(child::node())=0">
89        <xsl:call-template name="insertInvisibleBreaks">
90            <xsl:with-param name="url" select="@url" />
91            <xsl:with-param name="breakat" select="translate(@url, '/-_:', '____')" />
92        </xsl:call-template>
93    </xsl:if>
94  </a>
95  </xsl:when>
96  <xsl:otherwise>
97  <xsl:apply-imports/>
98  </xsl:otherwise>
99  </xsl:choose>
100</xsl:template> 
101
102<xsl:template name="insertInvisibleBreaks">
103    <xsl:param name="url" />
104    <xsl:param name="breakat" />
105    <!-- <xsl:message><xsl:value-of select="concat('param:', $url, $breakat)" /></xsl:message> -->
106    <xsl:choose>
107        <xsl:when test="contains($breakat, '_')">
108            <xsl:value-of select="substring($url, 1, string-length(substring-before($breakat, '_'))+1)" /><wbr/>
109            <xsl:call-template name="insertInvisibleBreaks">
110                <xsl:with-param name="url" select="substring($url, string-length(substring-before($breakat, '_'))+2)"/>
111                <xsl:with-param name="breakat" select="substring($breakat, string-length(substring-before($breakat, '_'))+2)"/>
112            </xsl:call-template>
113        </xsl:when>
114        <xsl:otherwise>
115            <xsl:value-of select="$url" />
116        </xsl:otherwise>
117    </xsl:choose>
118</xsl:template>
119
120<!-- Base specific templates -->
121
122<xsl:template match="helptext">
123  <xsl:choose>
124    <xsl:when test="@webonly = '0'"> 
125      <xsl:apply-templates />
126    </xsl:when>
127  </xsl:choose>
128</xsl:template>
129
130<xsl:template match="seeother|other">
131</xsl:template>
132
133<xsl:template match="nohelp">
134  <xsl:apply-templates />
135</xsl:template>
136
137<xsl:template match="command">
138  <xsl:call-template name="inline.monoseq"/>
139</xsl:template>
140
141<xsl:template name="user.footer.navigation">
142  <div 
143    class="navfooter"
144    align="left">
145    <p>
146    <i>
147      <xsl:if test="$doc.revision" >
148        Version: <xsl:value-of select="$base.version"/> (build #<xsl:value-of select="$doc.revision"/>)<br/>
149      </xsl:if>
150      <xsl:if test="$doc.last.modified" >
151        Book last modified: <xsl:value-of select="$doc.last.modified" />
152      </xsl:if>
153    </i></p>
154  </div>
155</xsl:template>
156
157  <xsl:template name="convertpath">
158    <xsl:param name="path" select="''" />
159    <xsl:choose>
160      <xsl:when test="contains($path, '/')">
161        <xsl:text>../</xsl:text>
162        <xsl:call-template name="convertpath">
163          <xsl:with-param name="path" select="substring-after($path, '/')" />
164        </xsl:call-template>
165      </xsl:when>
166    </xsl:choose>
167  </xsl:template>
168
169  <xsl:template name="pathtorootdir">
170    <xsl:variable name="dir">
171      <xsl:call-template name="dbhtml-dir">
172        <xsl:with-param name="context" select="." />
173      </xsl:call-template>
174    </xsl:variable>
175    <xsl:call-template name="convertpath">
176      <xsl:with-param name="path" select="$dir" />
177    </xsl:call-template>
178  </xsl:template>
179
180  <xsl:template name="output.html.stylesheets">
181    <xsl:param name="stylesheets" select="''" />
182    <xsl:variable name="pathtorootdir">
183      <xsl:call-template name="pathtorootdir" />
184    </xsl:variable>
185    <xsl:choose>
186      <xsl:when test="contains($stylesheets, ' ')">
187        <link rel="stylesheet"
188          href="{substring-before(concat($pathtorootdir, $stylesheets), ' ')}">
189          <xsl:if test="$html.stylesheet.type != ''">
190            <xsl:attribute name="type">
191              <xsl:value-of select="$html.stylesheet.type" />
192            </xsl:attribute>
193          </xsl:if>
194        </link>
195        <xsl:call-template name="output.html.stylesheets">
196          <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')" />
197        </xsl:call-template>
198      </xsl:when>
199      <xsl:when test="$stylesheets != ''">
200        <link rel="stylesheet" href="{concat($pathtorootdir,$stylesheets)}">
201          <xsl:if test="$html.stylesheet.type != ''">
202            <xsl:attribute name="type">
203              <xsl:value-of select="$html.stylesheet.type" />
204            </xsl:attribute>
205          </xsl:if>
206        </link>
207      </xsl:when>
208    </xsl:choose>
209  </xsl:template>
210 
211  <xsl:template name="admon.graphic">
212    <xsl:param name="node" select="." />
213    <xsl:variable name="pathtorootdir">
214      <xsl:call-template name="pathtorootdir"/>
215    </xsl:variable>
216    <xsl:value-of select="concat($pathtorootdir, $admon.graphics.path)" />
217    <xsl:choose>
218      <xsl:when test="local-name($node)='note'">note</xsl:when>
219      <xsl:when test="local-name($node)='warning'">warning</xsl:when>
220      <xsl:when test="local-name($node)='caution'">caution</xsl:when>
221      <xsl:when test="local-name($node)='tip'">tip</xsl:when>
222      <xsl:when test="local-name($node)='important'">important</xsl:when>
223      <xsl:otherwise>note</xsl:otherwise>
224    </xsl:choose>
225    <xsl:value-of select="$admon.graphics.extension" />
226  </xsl:template>
227
228</xsl:stylesheet>
229
230
Note: See TracBrowser for help on using the repository browser.