Docbook - Page Setup

By xngo on June 18, 2019

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">
 
    <!-- Output characteristics. Note: string value has to be put between single quote. -->
    <xsl:param name="paper.type" select="'A4'"/> <!-- standard paper size -->
    <xsl:param name="draft.mode"  select="'yes'"/><!-- yes = draft -->
    <xsl:param name="draft.watermark.image" select="concat($DocBookRootDir,'images/draft.png')"/>
    <xsl:param name="page.orientation" select="'landscape'"/>
 
    <!-- Page margin spacing -->
    <xsl:variable name="SpacingWidth">0.1in</xsl:variable>
    <xsl:param name= "page.margin.top"><xsl:value-of select="$SpacingWidth"/></xsl:param>
    <xsl:param name= "page.margin.bottom"><xsl:value-of select="$SpacingWidth"/></xsl:param>
    <xsl:param name="page.margin.inner">
        <xsl:choose>
            <xsl:when test="$double.sided != 0"><xsl:value-of select="$SpacingWidth"/></xsl:when>
            <xsl:otherwise><xsl:value-of select="$SpacingWidth"/></xsl:otherwise>
        </xsl:choose>
    </xsl:param>
    <xsl:param name="page.margin.outer">
        <xsl:choose>
            <xsl:when test="$double.sided != 0"><xsl:value-of select="$SpacingWidth"/></xsl:when>
            <xsl:otherwise><xsl:value-of select="$SpacingWidth"/></xsl:otherwise>
        </xsl:choose>
    </xsl:param>
 
<!-- Doesn't work yet.
<xsl:param name="page.width">
  <xsl:choose>
      <xsl:when test="$page.orientation = 'portrait'">
          <xsl:value-of select="$page.width.portrait"></xsl:value-of>
      </xsl:when>
      <xsl:otherwise>
          <xsl:value-of select="$page.height.portrait"></xsl:value-of>
      </xsl:otherwise>
  </xsl:choose>
</xsl:param>
-->
 
</xsl:stylesheet>

Reference

  • http://www.sagehill.net/docbookxsl/PrintOutput.html#TopBotMargins

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.