summaryrefslogtreecommitdiffstats
path: root/doc/xsl/isc-docbook-latex.xsl.in
blob: 1cfcc99a1f021b2f64e15a6714649554e14a8e0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!--
 - Copyright (C) 2005, 2007  Internet Systems Consortium, Inc. ("ISC")
 -
 - Permission to use, copy, modify, and/or distribute this software for any
 - purpose with or without fee is hereby granted, provided that the above
 - copyright notice and this permission notice appear in all copies.
 -
 - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 - AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 - PERFORMANCE OF THIS SOFTWARE.
-->

<!-- $Id: isc-docbook-latex.xsl.in,v 1.6 2007/06/19 23:47:13 tbox Exp $ -->

<!-- ISC customizations for db2latex generator -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <!-- Import the db2latex stuff -->
  <xsl:import href="@XSLT_DB2LATEX_STYLE@"/>

  <!-- Blank lines between paragraphs, please -->
  <xsl:param name="latex.use.parskip" select="1"/>

  <!-- Least bad current option for constructing tables -->
  <xsl:param name="latex.use.ltxtable" select="1"/>
  <xsl:param name="latex.use.longtable" select="1"/>

  <!-- LaTeX2e documentclass options. -->
  <xsl:param name="latex.documentclass.common"/>
  <xsl:param name="latex.documentclass.book">10pt,twoside,openright</xsl:param>

  <!-- This documentation is in English (or maybe Bad English) -->
  <xsl:param name="latex.babel.language" select="'english'"/>
  <xsl:param name="l10n.gentext.default.language" select="'en'"/>

  <!-- Where to find "admonition" graphics -->
  <xsl:param name="admon.graphics.path" select="'@XSLT_DB2LATEX_ADMONITIONS@'"/>

  <!-- ANSI C function prototypes, please -->
  <xsl:param name="funcsynopsis.style">ansi</xsl:param>

  <!-- Local modifications to db2latex's mapping rules -->
  <xsl:param name="latex.mapping.xml" select="document('isc-docbook-latex-mappings.xml')"/>

  <!-- Patch around db2latex (0.8pre1) bug -->
  <xsl:template match="copyright/year">
    <xsl:apply-templates />
    <xsl:if test="position() != last()">
      <xsl:text>, </xsl:text>
    </xsl:if>
  </xsl:template>

  <!-- Include our copyright generator -->
  <xsl:include href="copyright.xsl"/>

  <!-- Set comment convention for this output format -->
  <xsl:param name="isc.copyright.leader">% </xsl:param>

  <!-- Intercept top level to prepend copyright -->
  <xsl:template match="/">
    <xsl:value-of select="$isc.copyright"/>
    <xsl:apply-imports/>
  </xsl:template>

  <!--
    - Add support for multiple <para/> elements in a table entry.
    - db2latex is already typesetting the table entry as a parbox,
    - so we just have to insert the paragraph breaks.
   -->
  <xsl:template match="tbody/row/entry/para[position() != last()]">
    <xsl:apply-imports/>
    <xsl:text> \par </xsl:text>
  </xsl:template>

  <!-- 
    - Add support for <optional/> in <programlisting/>.
   -->
  <xsl:template match="optional" mode="latex.verbatim">
    <xsl:text>[</xsl:text>
    <xsl:apply-templates mode="latex.verbatim"/>
    <xsl:text>]</xsl:text>
  </xsl:template>

  <!--
    - Customize the title page.  Are we having fun yet?
    -
    - NB: filename of graphic specified without extension.
    - LaTeX includes file.eps, PDFLaTeX includes file.pdf.
    -
    - Spacing and font sizes could probably use some work.
   -->
  <xsl:param name="latex.maketitle">
    <xsl:text>
      \begin{titlepage}
        \null\vfil
        \vskip 60pt
        \begin{center}%
          { %\LARGE
	    \Huge
	    \bfseries
            </xsl:text>
	    <xsl:for-each select="/book/title">
	      <xsl:call-template name="text"/>
	    </xsl:for-each>
            <xsl:text>
            \par}%
          \vskip 3em%
          { %\large
	    \Large
            \lineskip .75em%
            </xsl:text>
	    <xsl:for-each select="/book/bookinfo/releaseinfo[1]">
	      <xsl:call-template name="text"/>
	    </xsl:for-each>
            <xsl:text>
            \par}
          %\vskip 1.5em%
	  \vfil
	  \includegraphics{isc-logo}
        \end{center}\par
        \vfil\null
      \end{titlepage}
    </xsl:text>
    <xsl:text>&#10;</xsl:text>
  </xsl:param>

  <!--
    - More front matter: copyright notice, CVS revision number, table
    - of contents.
   -->
  <xsl:template match="book/bookinfo">
    <xsl:apply-imports/>
    <xsl:text>\begin{center}&#10;</xsl:text>
    <xsl:value-of select="$isc.copyright.text"/>
    <xsl:text>\end{center}&#10;</xsl:text>
    <xsl:for-each select="/book/bookinfo/releaseinfo[position() &gt; 1]">
      <xsl:text>\begin{center}</xsl:text>
      <xsl:call-template name="text"/>
      <xsl:text>\end{center}&#10;</xsl:text>
    </xsl:for-each>
    <xsl:text>\tableofcontents&#10;</xsl:text>
  </xsl:template>

  <!--
    - Try to avoid some weird looking line breaks.
    -
    - This doesn't really work right, so disable for now.
   -->
  <xsl:template match="literal" mode="disabled">
    <xsl:text>\mbox{</xsl:text>
    <xsl:apply-imports/>
    <xsl:text>}</xsl:text>
  </xsl:template>

</xsl:stylesheet>

<!-- 
  - Local variables:
  - mode: sgml
  - End:
 -->