Blame docs/xhtml/manual/ch04s04.html

Packit 0f19cf
Packit 0f19cf
Packit 0f19cf
<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>

XSL User Stylesheet

You can provide your own XSL stylesheet to set some of the XSL parameters,

Packit 0f19cf
  and/or to override some of the dblatex XSL templates. The user stylesheet is
Packit 0f19cf
  specified by using the option
Packit 0f19cf
  -p custom.xsl.

Changing the XSL parameter values

Packit 0f19cf
   The parameters can be stored in a user defined XSL stylesheet. An example of
Packit 0f19cf
   configuration stylesheet is given with this manual:
Packit 0f19cf
  

<?xml version='1.0' encoding="iso-8859-1"?>
Packit 0f19cf
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
Packit 0f19cf
Packit 0f19cf
<!-- Target Database set by the command line
Packit 0f19cf
Packit 0f19cf
<xsl:param name="target.database.document">olinkdb.xml</xsl:param>
Packit 0f19cf
-->
Packit 0f19cf
Packit 0f19cf
<!-- Use the Bob Stayton's Tip related to olinking -->
Packit 0f19cf
<xsl:param name="current.docid" select="/*/@id"/>
Packit 0f19cf
Packit 0f19cf
<!-- Use the literal scaling feature -->
Packit 0f19cf
<xsl:param name="literal.extensions">scale.by.width</xsl:param>
Packit 0f19cf
Packit 0f19cf
<!-- We want the TOC links in the titles, and in blue. -->
Packit 0f19cf
<xsl:param name="latex.hyperparam">colorlinks,linkcolor=blue,pdfstartview=FitH</xsl:param>
Packit 0f19cf
Packit 0f19cf
<!-- Put the dblatex logo -->
Packit 0f19cf
<xsl:param name="doc.publisher.show">1</xsl:param>
Packit 0f19cf
Packit 0f19cf
<!-- Show the list of examples too -->
Packit 0f19cf
<xsl:param name="doc.lot.show">figure,table,example</xsl:param>
Packit 0f19cf
Packit 0f19cf
<!-- DocBook like description -->
Packit 0f19cf
<xsl:param name="term.breakline">1</xsl:param>
Packit 0f19cf
Packit 0f19cf
<!-- Manpage titles not numbered -->
Packit 0f19cf
<xsl:param name="refentry.numbered">0</xsl:param>
Packit 0f19cf
Packit 0f19cf
<xsl:template match="parameter">
Packit 0f19cf
  <xsl:variable name="name" select="."/>
Packit 0f19cf
  <xsl:variable name="target" select="key('id',$name)[1]"/>
Packit 0f19cf
Packit 0f19cf
  <xsl:choose>
Packit 0f19cf
  <xsl:when test="count($target) &gt; 0">
Packit 0f19cf
    <!-- Hot link to the parameter refentry -->
Packit 0f19cf
    <xsl:call-template name="hyperlink.markup">
Packit 0f19cf
      <xsl:with-param name="linkend" select="$name"/>
Packit 0f19cf
      <xsl:with-param name="text">
Packit 0f19cf
        <xsl:apply-imports/>
Packit 0f19cf
      </xsl:with-param>
Packit 0f19cf
    </xsl:call-template>
Packit 0f19cf
    <!-- Index entry for this parameter -->
Packit 0f19cf
    <xsl:text>\index{Parameters!</xsl:text>
Packit 0f19cf
    <xsl:value-of select="$name"/>
Packit 0f19cf
    <xsl:text>}</xsl:text>
Packit 0f19cf
  </xsl:when>
Packit 0f19cf
  <xsl:otherwise>
Packit 0f19cf
    <!--
Packit 0f19cf
    <xsl:message>No reference for parameter: '<xsl:value-of
Packit 0f19cf
    select="$name"/>'</xsl:message>
Packit 0f19cf
    -->
Packit 0f19cf
    <xsl:apply-imports/>
Packit 0f19cf
  </xsl:otherwise>
Packit 0f19cf
  </xsl:choose>
Packit 0f19cf
</xsl:template>
Packit 0f19cf
Packit 0f19cf
<xsl:template match="sgmltag[@class='xmlpi']">
Packit 0f19cf
  <xsl:variable name="name" select="normalize-space(.)"/>
Packit 0f19cf
  <xsl:variable name="nameref" select="concat('pi-',translate($name,' ','_'))"/>
Packit 0f19cf
  <xsl:variable name="target" select="key('id',$nameref)[1]"/>
Packit 0f19cf
Packit 0f19cf
  <xsl:choose>
Packit 0f19cf
  <xsl:when test="count($target) &gt; 0">
Packit 0f19cf
    <!-- Hot link to the parameter refentry -->
Packit 0f19cf
    <xsl:call-template name="hyperlink.markup">
Packit 0f19cf
      <xsl:with-param name="linkend" select="$nameref"/>
Packit 0f19cf
      <xsl:with-param name="text">
Packit 0f19cf
        <xsl:apply-imports/>
Packit 0f19cf
      </xsl:with-param>
Packit 0f19cf
    </xsl:call-template>
Packit 0f19cf
    <!-- Index entry for this parameter -->
Packit 0f19cf
    <xsl:text>\index{Processing Instructions!</xsl:text>
Packit 0f19cf
    <xsl:value-of select="$name"/>
Packit 0f19cf
    <xsl:text>}</xsl:text>
Packit 0f19cf
  </xsl:when>
Packit 0f19cf
  <xsl:otherwise>
Packit 0f19cf
    <!--
Packit 0f19cf
    <xsl:message>No reference for parameter: '<xsl:value-of
Packit 0f19cf
    select="$name"/>'</xsl:message>
Packit 0f19cf
    -->
Packit 0f19cf
    <xsl:apply-imports/>
Packit 0f19cf
  </xsl:otherwise>
Packit 0f19cf
  </xsl:choose>
Packit 0f19cf
</xsl:template>
Packit 0f19cf
Packit 0f19cf
</xsl:stylesheet>
Packit 0f19cf

Overriding some templates

Packit 0f19cf
   You can directly put the overriding templates in your XSL stylesheet, but do not
Packit 0f19cf
   try to import the default dblatex stylesheets in it: it is automatically done by
Packit 0f19cf
   the tool. So, just focus on the template to override and dblatex will ensure
Packit 0f19cf
   that your definitions will get precedence over the dblatex ones.
Packit 0f19cf
  

Packit 0f19cf
  You can of course split your templates in several files, and import each of
Packit 0f19cf
  them in the main user stylesheet by calling xsl:import.
Packit 0f19cf
  

Example 4.2. Overriding templates

Packit 0f19cf
<?xml version='1.0' encoding="iso-8859-1"?>
Packit 0f19cf
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
Packit 0f19cf
 
Packit 0f19cf
<!-- Let's import our own XSL to override the default behaviour. -->
Packit 0f19cf
<xsl:import href="mystyle.xsl"/>
Packit 0f19cf
Packit 0f19cf
<!-- Let's patch directly a template here -->
Packit 0f19cf
<xsl:template match="article" mode="docinfo">
Packit 0f19cf
  <xsl:apply-imports/>
Packit 0f19cf
  <xsl:text>\let\mymacro=\DBKrelease</xsl:text>
Packit 0f19cf
</xsl:template>
Packit 0f19cf
Packit 0f19cf
</xsl:stylesheet>
Packit 0f19cf
  
</body></html>