Moving docs tree to docs-xml to make room for generated docs in the release tarball.
[amitay/samba.git] / docs-xml / xslt / db2latex-xsl / xsl / verbatim.mod.xsl
1 <?xml version='1.0'?>
2 <!DOCTYPE xsl:stylesheet [ <!ENTITY % xsldoc.ent SYSTEM "./xsldoc.ent"> %xsldoc.ent; ]>
3 <!--############################################################################# 
4 |       $Id: verbatim.mod.xsl,v 1.16 2004/01/31 11:53:14 j-devenish Exp $
5 |- #############################################################################
6 |       $Author: j-devenish $
7 + ############################################################################## -->
8
9 <xsl:stylesheet
10         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11         xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
12         exclude-result-prefixes="doc" version='1.0'>
13
14         <doc:reference id="verbatim" xmlns="">
15                 <referenceinfo>
16                         <releaseinfo role="meta">
17                                 $Id: verbatim.mod.xsl,v 1.16 2004/01/31 11:53:14 j-devenish Exp $
18                         </releaseinfo>
19                         <authorgroup>
20                                 &ramon;
21                                 &james;
22                         </authorgroup>
23                         <copyright>
24                                 <year>2000</year><year>2001</year><year>2002</year><year>2003</year><year>2004</year>
25                                 <holder>Ramon Casellas</holder>
26                         </copyright>
27                         <revhistory>
28                                 <doc:revision rcasver="1.12">&rev_2003_05;</doc:revision>
29                         </revhistory>
30                 </referenceinfo>
31                 <title>Verbatim <filename>verbatim.mod.xsl</filename></title>
32                 <partintro>
33                         <para>
34                         
35                         
36                         
37                         </para>
38                 </partintro>
39         </doc:reference>
40
41         <doc:template xmlns="">
42                 <refpurpose> Auxiliary template to output verbatim &LaTeX; code in verbatim mode </refpurpose>
43                 <doc:description>
44                         <para>Typeset verbatim, monospace text in which whitespace is significant.</para>
45                 </doc:description>
46                 <doc:variables>
47                         <itemizedlist>
48                                 <listitem><simpara><xref linkend="param.latex.use.fancyvrb"/></simpara></listitem>
49                         </itemizedlist>
50                 </doc:variables>
51                 <doc:notes>
52                         <para>This template is called by a number of element-related templates.</para>
53                         <para> Takes into account whether the user is using fancyvrb or not. It allows
54                         veratim line numbering and other fancy stuff. </para>
55                         <para> In order to use a small or large font, you may also want to use 
56                         implement <xref linkend="template.latex.fancyvrb.options"/>.
57                         </para>
58                         <!--
59                         the <literal>role</literal> attribute: </para>
60         <screen><![CDATA[
61 <programlisting role="small">
62 </programlisting>
63 <programlisting role="large">
64 </programlisting>
65 ]]></screen>
66 -->
67                                 <para>
68                                         This template will apply further templates using the
69                                         <literal>latex.verbatim</literal> mode.
70                                 </para>
71                         <warning>
72                                 <para>
73                                         This doesn't work inside <doc:db basename="table">tables</doc:db>.
74                                         Also, if the element appears within a <doc:db>varlistentry</doc:db>,
75                                         some &LaTeX; code will be emitted so that the verbatim environment
76                                         starts on a new line.
77                                 </para>
78                         </warning>
79                 </doc:notes>
80                 <doc:seealso>
81                         <itemizedlist>
82                                 <listitem><simpara><xref linkend="template.latex.fancyvrb.options"/></simpara></listitem>
83                                 <listitem><simpara><xref linkend="template.text()-latex.verbatim"/></simpara></listitem>
84                         </itemizedlist>
85                 </doc:seealso>
86         </doc:template>
87         <xsl:template name="verbatim.apply.templates">
88                 <xsl:if test="ancestor::varlistentry">
89                         <!-- start the environment on a new line -->
90                         <xsl:text>\null{}</xsl:text>
91                 </xsl:if>
92                 <xsl:choose>
93                         <xsl:when test="ancestor::entry">
94                                 <xsl:message>Problem with <xsl:value-of select="local-name(.)"/> inside table entries.</xsl:message>
95                                 <xsl:text>\texttt{</xsl:text>
96                                 <xsl:apply-templates mode="latex.verbatim"/>
97                                 <xsl:text>}</xsl:text>
98                         </xsl:when>
99                         <xsl:when test="$latex.use.fancyvrb='1'">
100                                 <xsl:variable name="not_monospaced" select="local-name(.)='literallayout' and @format!='monospaced'"/>
101                                 <xsl:text>&#10;\begin{Verbatim}[</xsl:text>
102                                 <xsl:if test="@linenumbering='numbered'">
103                                         <xsl:text>,numbers=left</xsl:text>
104                                 </xsl:if>
105                                 <xsl:if test="$not_monospaced">
106                                         <xsl:text>,fontfamily=default</xsl:text>
107                                 </xsl:if>
108                                 <xsl:call-template name="latex.fancyvrb.options"/>
109                                 <xsl:text>]&#10;</xsl:text>
110                                 <xsl:choose>
111                                         <xsl:when test="$not_monospaced">
112                                                 <!-- Needs to be changed to cope with regular characterset! -->
113                                                 <xsl:apply-templates mode="latex.verbatim"/>
114                                         </xsl:when>
115                                         <xsl:otherwise>
116                                                 <xsl:apply-templates mode="latex.verbatim"/>
117                                         </xsl:otherwise>
118                                 </xsl:choose>
119                                 <xsl:text>&#10;\end{Verbatim}&#10;</xsl:text>
120                         </xsl:when>
121                         <xsl:otherwise>
122                                 <xsl:text>&#10;\begin{verbatim}&#10;</xsl:text>
123                                 <xsl:apply-templates mode="latex.verbatim"/>
124                                 <xsl:text>&#10;\end{verbatim}&#10;</xsl:text>
125                         </xsl:otherwise>
126                 </xsl:choose>
127         </xsl:template>
128
129         <doc:template xmlns="">
130                 <refpurpose> Process <quote>verbatim</quote> environment where whitespace is significant </refpurpose>
131                 <doc:description>
132                         <para>
133
134                         Calls <xref linkend="template.verbatim.apply.templates"/>.
135
136                         </para>
137                 </doc:description>
138                 <doc:variables>
139                         <variablelist>
140                                 <varlistentry>
141                                         <term><xref linkend="param.latex.trim.verbatim"/></term>
142                                         <listitem><simpara>
143                                                 See <xref linkend="text()-latex.verbatim"/>.
144                                                 <!-- note: that is not a valid ID! -->
145                                         </simpara></listitem>
146                                 </varlistentry>
147                         </variablelist>
148                 </doc:variables>
149                 <doc:samples>
150                         <simplelist type='inline'>
151                                 &test_article;
152                                 &test_bind;
153                                 &test_book;
154                                 &test_ddh;
155                                 &test_program;
156                         </simplelist>
157                 </doc:samples>
158         </doc:template>
159         <xsl:template match="address|screen|programlisting|literallayout">
160                 <xsl:call-template name="verbatim.apply.templates"/>
161         </xsl:template>
162
163         <xsl:template name="next.is.verbatim">
164                 <xsl:param name="object" select="following-sibling::*[1]"/>
165                 <xsl:value-of select="count($object[self::address or self::screen or self::programlisting or self::literallayout])"/>
166         </xsl:template>
167
168         <doc:template xmlns="">
169                 <refpurpose>Process <doc:db>literal</doc:db> elements</refpurpose>
170                 <doc:description>
171                         <para>
172                         
173                         Applies templates in the <quote>template.latex.verbatim</quote>
174                         mode within a &LaTeX; <function condition="latex">verb</function>
175                         command.
176                         
177                         </para>
178                 </doc:description>
179                 <doc:variables>
180                         &no_var;
181                 </doc:variables>
182         </doc:template>
183         <xsl:template match="literal" mode="latex.verbatim">
184                 <xsl:text>{\verb </xsl:text>
185                 <xsl:apply-templates mode="latex.verbatim"/>
186                 <xsl:text>}</xsl:text>
187         </xsl:template>
188
189 </xsl:stylesheet>