trying to get HEAD building again. If you want the code
[nivanova/samba-autobuild/.git] / docs / docbook / xslt / db2latex / verbatim.mod.xsl
1 <?xml version='1.0'?>
2 <!--############################################################################# 
3 |- #############################################################################
4 |                                                                                                               
5 |   PURPOSE:
6 + ############################################################################## -->
7
8 <xsl:stylesheet 
9     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10     xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
11     exclude-result-prefixes="doc" version='1.0'>
12
13
14     <!--############################################################################# -->
15     <!-- DOCUMENTATION                                                                -->
16     <doc:reference id="verbatim" xmlns="">
17         <referenceinfo>
18             <releaseinfo role="meta">
19             </releaseinfo>
20         <authorgroup>
21             <author> <firstname>Ramon</firstname> <surname>Casellas</surname> </author>
22             <author> <firstname>James</firstname> <surname>Devenish</surname> </author>
23         </authorgroup>
24             <copyright>
25                 <year>2000</year> <year>2001</year> <year>2002</year> <year>2003</year>
26                 <holder>Ramon Casellas</holder>
27             </copyright>
28         </referenceinfo>
29         <title>Verbatim <filename>verbatim.mod.xsl</filename></title>
30         <partintro>
31             <section><title>Introduction</title>
32                 <para></para>
33             </section>
34         </partintro>
35     </doc:reference>
36     <!--############################################################################# -->
37
38
39     <!--############################################################################# -->
40     <!-- DOCUMENTATION                                                                -->
41     <doc:template match="literal" xmlns="">
42         <refpurpose>Template for <sgmltag>literal</sgmltag></refpurpose>
43         <refdescription>
44             Template for literal template
45         </refdescription>
46     </doc:template>
47     <!--############################################################################# -->
48
49     <xsl:template match="literal" mode="latex.verbatim">
50         <xsl:text>{\verb </xsl:text>
51         <xsl:apply-templates mode="latex.verbatim"/>
52         <xsl:text>}</xsl:text>
53     </xsl:template>
54
55
56
57
58
59     <!--############################################################################# -->
60     <!-- DOCUMENTATION                                                                -->
61     <doc:template name="verbatim.apply.templates" xmlns="">
62         <refpurpose> Auxiliary template to output verbatim LaTeX code in verbatim mode </refpurpose>
63         <refdescription>
64         <para> Takes into account whether the user is using fancyvrb or not. It allows
65         veratim line numbering and other fancy stuff. </para>
66         <para> In order to use a small or large font, you may also wanto to use 
67         the <literal>role</literal> attribute : </para>
68         <screen><![CDATA[
69         <programlisting role="small">
70         </programlisting>
71         <programlisting role="large">
72         </programlisting>
73         ]]></screen>
74         </refdescription>
75     </doc:template>
76     <!--############################################################################# -->
77
78         <xsl:template name="verbatim.apply.templates">
79         <xsl:choose>
80                 <xsl:when test="ancestor::entry">
81                         <xsl:message>Problem with <xsl:value-of select="local-name(.)"/> inside table entries.</xsl:message>
82                         <xsl:text>\texttt{</xsl:text>
83                         <xsl:apply-templates mode="latex.verbatim"/>
84                         <xsl:text>}</xsl:text>
85                 </xsl:when>
86                 <xsl:when test="$latex.use.fancyvrb='1'">
87                         <xsl:variable name="not_monospaced" select="local-name(.)='literallayout' and @format!='monospaced'"/>
88                         <xsl:text>&#10;\begin{Verbatim}[</xsl:text>
89                         <xsl:if test="@linenumbering='numbered'">
90                                 <xsl:text>,numbers=left</xsl:text>
91                         </xsl:if>
92                         <xsl:if test="$not_monospaced">
93                                 <xsl:text>,fontfamily=default</xsl:text>
94                         </xsl:if>
95                         <xsl:if test="@role">
96                                 <xsl:choose>
97                                         <xsl:when test="@role='small'">
98                                                 <xsl:text>,fontsize=\small</xsl:text>
99                                         </xsl:when>
100                                         <xsl:when test="@role='large'">
101                                                 <xsl:text>,fontsize=\large</xsl:text>
102                                         </xsl:when>
103                                 </xsl:choose>
104                         </xsl:if>
105                         <xsl:text>]&#10;</xsl:text>
106                         <xsl:choose>
107                                 <xsl:when test="$not_monospaced">
108                                         <!-- Needs to be changed to cope with regular characterset! -->
109                                         <xsl:apply-templates mode="latex.verbatim"/>
110                                 </xsl:when>
111                                 <xsl:otherwise>
112                                         <xsl:apply-templates mode="latex.verbatim"/>
113                                 </xsl:otherwise>
114                         </xsl:choose>
115                         <xsl:text>&#10;\end{Verbatim}&#10;</xsl:text>
116                 </xsl:when>
117                 <xsl:otherwise>
118                         <xsl:text>&#10;\begin{verbatim}&#10;</xsl:text>
119                         <xsl:apply-templates mode="latex.verbatim"/>
120                         <xsl:text>&#10;\end{verbatim}&#10;</xsl:text>
121                 </xsl:otherwise>
122         </xsl:choose>
123         </xsl:template>
124
125
126
127     <xsl:template match="address">
128                 <xsl:call-template name="verbatim.apply.templates"/>
129     </xsl:template>
130
131     <doc:template name="verbatim" match="screen|programlisting|literallayout" xmlns="">
132         <refpurpose>Environments in which whitespace is significant</refpurpose>
133         <refdescription>
134             <itemizedlist>
135                         <title>Known Bugs</title>
136                         <listitem><simpara>Templates are not applied within programlistings.</simpara></listitem>
137                 </itemizedlist>
138         </refdescription>
139     </doc:template>
140         <xsl:template match="screen|programlisting|literallayout">
141                 <xsl:call-template name="verbatim.apply.templates"/>
142         </xsl:template>
143
144 </xsl:stylesheet>