| 1 |
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 |
<!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.79.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"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="idp2102"></a>XSL User Stylesheet</h2></div></div></div><div class="toc"><dl class="toc"><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, |
| 3 |
and/or to override some of the dblatex XSL templates. The user stylesheet is |
| 4 |
specified by using the option |
| 5 |
<code class="option">-p <em class="replaceable"><code>custom.xsl</code></em></code>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sec-param-stylesheet"></a>Changing the XSL parameter values</h3></div></div></div><p> |
| 6 |
The parameters can be stored in a user defined XSL stylesheet. An example of |
| 7 |
configuration stylesheet is given with this manual: |
| 8 |
</p><pre class="programlisting"><?xml version='1.0' encoding="iso-8859-1"?> |
| 9 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'> |
| 10 |
|
| 11 |
<!-- Target Database set by the command line |
| 12 |
|
| 13 |
<xsl:param name="target.database.document">olinkdb.xml</xsl:param> |
| 14 |
--> |
| 15 |
|
| 16 |
<!-- Use the Bob Stayton's Tip related to olinking --> |
| 17 |
<xsl:param name="current.docid" select="/*/@id"/> |
| 18 |
|
| 19 |
<!-- Use the literal scaling feature --> |
| 20 |
<xsl:param name="literal.extensions">scale.by.width</xsl:param> |
| 21 |
|
| 22 |
<!-- We want the TOC links in the titles, and in blue. --> |
| 23 |
<xsl:param name="latex.hyperparam">colorlinks,linkcolor=blue,pdfstartview=FitH</xsl:param> |
| 24 |
|
| 25 |
<!-- Put the dblatex logo --> |
| 26 |
<xsl:param name="doc.publisher.show">1</xsl:param> |
| 27 |
|
| 28 |
<!-- Show the list of examples too --> |
| 29 |
<xsl:param name="doc.lot.show">figure,table,example</xsl:param> |
| 30 |
|
| 31 |
<!-- DocBook like description --> |
| 32 |
<xsl:param name="term.breakline">1</xsl:param> |
| 33 |
|
| 34 |
<!-- Manpage titles not numbered --> |
| 35 |
<xsl:param name="refentry.numbered">0</xsl:param> |
| 36 |
|
| 37 |
<xsl:template match="parameter"> |
| 38 |
<xsl:variable name="name" select="."/> |
| 39 |
<xsl:variable name="target" select="key('id',$name)[1]"/> |
| 40 |
|
| 41 |
<xsl:choose> |
| 42 |
<xsl:when test="count($target) &gt; 0"> |
| 43 |
<!-- Hot link to the parameter refentry --> |
| 44 |
<xsl:call-template name="hyperlink.markup"> |
| 45 |
<xsl:with-param name="linkend" select="$name"/> |
| 46 |
<xsl:with-param name="text"> |
| 47 |
<xsl:apply-imports/> |
| 48 |
</xsl:with-param> |
| 49 |
</xsl:call-template> |
| 50 |
<!-- Index entry for this parameter --> |
| 51 |
<xsl:text>\index{Parameters!</xsl:text> |
| 52 |
<xsl:value-of select="$name"/> |
| 53 |
<xsl:text>}</xsl:text> |
| 54 |
</xsl:when> |
| 55 |
<xsl:otherwise> |
| 56 |
<!-- |
| 57 |
<xsl:message>No reference for parameter: '<xsl:value-of |
| 58 |
select="$name"/>'</xsl:message> |
| 59 |
--> |
| 60 |
<xsl:apply-imports/> |
| 61 |
</xsl:otherwise> |
| 62 |
</xsl:choose> |
| 63 |
</xsl:template> |
| 64 |
|
| 65 |
<xsl:template match="sgmltag[@class='xmlpi']"> |
| 66 |
<xsl:variable name="name" select="normalize-space(.)"/> |
| 67 |
<xsl:variable name="nameref" select="concat('pi-',translate($name,' ','_'))"/> |
| 68 |
<xsl:variable name="target" select="key('id',$nameref)[1]"/> |
| 69 |
|
| 70 |
<xsl:choose> |
| 71 |
<xsl:when test="count($target) &gt; 0"> |
| 72 |
<!-- Hot link to the parameter refentry --> |
| 73 |
<xsl:call-template name="hyperlink.markup"> |
| 74 |
<xsl:with-param name="linkend" select="$nameref"/> |
| 75 |
<xsl:with-param name="text"> |
| 76 |
<xsl:apply-imports/> |
| 77 |
</xsl:with-param> |
| 78 |
</xsl:call-template> |
| 79 |
<!-- Index entry for this parameter --> |
| 80 |
<xsl:text>\index{Processing Instructions!</xsl:text> |
| 81 |
<xsl:value-of select="$name"/> |
| 82 |
<xsl:text>}</xsl:text> |
| 83 |
</xsl:when> |
| 84 |
<xsl:otherwise> |
| 85 |
<!-- |
| 86 |
<xsl:message>No reference for parameter: '<xsl:value-of |
| 87 |
select="$name"/>'</xsl:message> |
| 88 |
--> |
| 89 |
<xsl:apply-imports/> |
| 90 |
</xsl:otherwise> |
| 91 |
</xsl:choose> |
| 92 |
</xsl:template> |
| 93 |
|
| 94 |
</xsl:stylesheet> |
| 95 |
</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sec-custom-stylesheet"></a>Overriding some templates</h3></div></div></div><p> |
| 96 |
You can directly put the overriding templates in your XSL stylesheet, but do not |
| 97 |
try to import the default dblatex stylesheets in it: it is automatically done by |
| 98 |
the tool. So, just focus on the template to override and dblatex will ensure |
| 99 |
that your definitions will get precedence over the dblatex ones. |
| 100 |
</p><p> |
| 101 |
You can of course split your templates in several files, and import each of |
| 102 |
them in the main user stylesheet by calling <code class="literal">xsl:import</code>. |
| 103 |
</p><div class="example"><a id="idp2116"></a><p class="title"><strong>Example 4.2. Overriding templates</strong></p><div class="example-contents"><pre class="programlisting"> |
| 104 |
<?xml version='1.0' encoding="iso-8859-1"?> |
| 105 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'> |
| 106 |
|
| 107 |
<!-- Let's import our own XSL to override the default behaviour. --> |
| 108 |
<xsl:import href="mystyle.xsl"/> |
| 109 |
|
| 110 |
<!-- Let's patch directly a template here --> |
| 111 |
<xsl:template match="article" mode="docinfo"> |
| 112 |
<xsl:apply-imports/> |
| 113 |
<xsl:text>\let\mymacro=\DBKrelease</xsl:text> |
| 114 |
</xsl:template> |
| 115 |
|
| 116 |
</xsl:stylesheet> |
| 117 |
</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> |