<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>XSL User Stylesheet</title><link rel="stylesheet" type="text/css" href="manual.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /><link rel="home" href="index.html" title="DocBook to LaTeX Publishing" /><link rel="up" href="sec-custom.html" title="Chapter 4. Customization" /><link rel="prev" href="sec-pi-usage.html" title="Using Processing Instructions" /><link rel="next" href="sec-custom-latex.html" title="Customized LaTeX style" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">XSL User Stylesheet</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sec-pi-usage.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Customization</th><td width="20%" align="right"> <a accesskey="n" href="sec-custom-latex.html">Next</a></td></tr></table><hr /></div><div class="section" title="XSL User Stylesheet"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="idm159016"></a>XSL User Stylesheet</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="ch04s04.html#sec-param-stylesheet">Changing the XSL parameter values</a></span></dt><dt><span class="section"><a href="ch04s04.html#sec-custom-stylesheet">Overriding some templates</a></span></dt></dl></div><p>You can provide your own XSL stylesheet to set some of the XSL parameters,
and/or to override some of the dblatex XSL templates. The user stylesheet is
specified by using the option
<code class="option">-p <em class="replaceable"><code>custom.xsl</code></em></code>.</p><div class="section" title="Changing the XSL parameter values"><div class="titlepage"><div><div><h3 class="title"><a id="sec-param-stylesheet"></a>Changing the XSL parameter values</h3></div></div></div><p>
The parameters can be stored in a user defined XSL stylesheet. An example of
configuration stylesheet is given with this manual:
</p><pre class="programlisting"><?xml version='1.0' encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<!-- Target Database set by the command line
<xsl:param name="target.database.document">olinkdb.xml</xsl:param>
-->
<!-- Use the Bob Stayton's Tip related to olinking -->
<xsl:param name="current.docid" select="/*/@id"/>
<!-- Use the literal scaling feature -->
<xsl:param name="literal.extensions">scale.by.width</xsl:param>
<!-- We want the TOC links in the titles, and in blue. -->
<xsl:param name="latex.hyperparam">colorlinks,linkcolor=blue,pdfstartview=FitH</xsl:param>
<!-- Put the dblatex logo -->
<xsl:param name="doc.publisher.show">1</xsl:param>
<!-- Show the list of examples too -->
<xsl:param name="doc.lot.show">figure,table,example</xsl:param>
<!-- DocBook like description -->
<xsl:param name="term.breakline">1</xsl:param>
<!-- Manpage titles not numbered -->
<xsl:param name="refentry.numbered">0</xsl:param>
<xsl:template match="parameter">
<xsl:variable name="name" select="."/>
<xsl:variable name="target" select="key('id',$name)[1]"/>
<xsl:choose>
<xsl:when test="count($target) &gt; 0">
<!-- Hot link to the parameter refentry -->
<xsl:call-template name="hyperlink.markup">
<xsl:with-param name="linkend" select="$name"/>
<xsl:with-param name="text">
<xsl:apply-imports/>
</xsl:with-param>
</xsl:call-template>
<!-- Index entry for this parameter -->
<xsl:text>\index{Parameters!</xsl:text>
<xsl:value-of select="$name"/>
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:otherwise>
<!--
<xsl:message>No reference for parameter: '<xsl:value-of
select="$name"/>'</xsl:message>
-->
<xsl:apply-imports/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="sgmltag[@class='xmlpi']">
<xsl:variable name="name" select="normalize-space(.)"/>
<xsl:variable name="nameref" select="concat('pi-',translate($name,' ','_'))"/>
<xsl:variable name="target" select="key('id',$nameref)[1]"/>
<xsl:choose>
<xsl:when test="count($target) &gt; 0">
<!-- Hot link to the parameter refentry -->
<xsl:call-template name="hyperlink.markup">
<xsl:with-param name="linkend" select="$nameref"/>
<xsl:with-param name="text">
<xsl:apply-imports/>
</xsl:with-param>
</xsl:call-template>
<!-- Index entry for this parameter -->
<xsl:text>\index{Processing Instructions!</xsl:text>
<xsl:value-of select="$name"/>
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:otherwise>
<!--
<xsl:message>No reference for parameter: '<xsl:value-of
select="$name"/>'</xsl:message>
-->
<xsl:apply-imports/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
</pre></div><div class="section" title="Overriding some templates"><div class="titlepage"><div><div><h3 class="title"><a id="sec-custom-stylesheet"></a>Overriding some templates</h3></div></div></div><p>
You can directly put the overriding templates in your XSL stylesheet, but do not
try to import the default dblatex stylesheets in it: it is automatically done by
the tool. So, just focus on the template to override and dblatex will ensure
that your definitions will get precedence over the dblatex ones.
</p><p>
You can of course split your templates in several files, and import each of
them in the main user stylesheet by calling <code class="literal">xsl:import</code>.
</p><div class="example"><a id="idp2327496"></a><p class="title"><strong>Example 4.2. Overriding templates</strong></p><div class="example-contents"><pre class="programlisting">
<?xml version='1.0' encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<!-- Let's import our own XSL to override the default behaviour. -->
<xsl:import href="mystyle.xsl"/>
<!-- Let's patch directly a template here -->
<xsl:template match="article" mode="docinfo">
<xsl:apply-imports/>
<xsl:text>\let\mymacro=\DBKrelease</xsl:text>
</xsl:template>
</xsl:stylesheet>
</pre></div></div><br class="example-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sec-pi-usage.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sec-custom.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sec-custom-latex.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Using Processing Instructions </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Customized LaTeX style</td></tr></table></div></body></html>