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 + ############################################################################## -->
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'
>
14 <doc:reference id=
"verbatim" xmlns=
"">
16 <releaseinfo role=
"meta">
17 $Id: verbatim.mod.xsl,v
1.16 2004/
01/
31 11:
53:
14 j-devenish Exp $
24 <year>2000</year><year>2001</year><year>2002</year><year>2003</year><year>2004</year>
25 <holder>Ramon Casellas
</holder>
28 <doc:revision rcasver=
"1.12">&rev_2003_05;</doc:revision>
31 <title>Verbatim
<filename>verbatim.mod.xsl
</filename></title>
41 <doc:template xmlns=
"">
42 <refpurpose> Auxiliary template to output verbatim
&LaTeX; code in verbatim mode
</refpurpose>
44 <para>Typeset verbatim, monospace text in which whitespace is significant.
</para>
48 <listitem><simpara><xref linkend=
"param.latex.use.fancyvrb"/></simpara></listitem>
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"/>.
59 the <literal>role</literal> attribute: </para>
61 <programlisting role="small">
63 <programlisting role="large">
68 This template will apply further templates using the
69 <literal>latex.verbatim
</literal> mode.
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
82 <listitem><simpara><xref linkend=
"template.latex.fancyvrb.options"/></simpara></listitem>
83 <listitem><simpara><xref linkend=
"template.text()-latex.verbatim"/></simpara></listitem>
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>
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>
99 <xsl:when test=
"$latex.use.fancyvrb='1'">
100 <xsl:variable name=
"not_monospaced" select=
"local-name(.)='literallayout' and @format!='monospaced'"/>
101 <xsl:text> \begin{Verbatim}[
</xsl:text>
102 <xsl:if test=
"@linenumbering='numbered'">
103 <xsl:text>,numbers=left
</xsl:text>
105 <xsl:if test=
"$not_monospaced">
106 <xsl:text>,fontfamily=default
</xsl:text>
108 <xsl:call-template name=
"latex.fancyvrb.options"/>
109 <xsl:text>]
</xsl:text>
111 <xsl:when test=
"$not_monospaced">
112 <!-- Needs to be changed to cope with regular characterset! -->
113 <xsl:apply-templates mode=
"latex.verbatim"/>
116 <xsl:apply-templates mode=
"latex.verbatim"/>
119 <xsl:text> \end{Verbatim}
</xsl:text>
122 <xsl:text> \begin{verbatim}
</xsl:text>
123 <xsl:apply-templates mode=
"latex.verbatim"/>
124 <xsl:text> \end{verbatim}
</xsl:text>
129 <doc:template xmlns=
"">
130 <refpurpose> Process
<quote>verbatim
</quote> environment where whitespace is significant
</refpurpose>
134 Calls
<xref linkend=
"template.verbatim.apply.templates"/>.
141 <term><xref linkend=
"param.latex.trim.verbatim"/></term>
143 See
<xref linkend=
"text()-latex.verbatim"/>.
144 <!-- note: that is not a valid ID! -->
145 </simpara></listitem>
150 <simplelist type='inline'
>
159 <xsl:template match=
"address|screen|programlisting|literallayout">
160 <xsl:call-template name=
"verbatim.apply.templates"/>
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])"/>
168 <doc:template xmlns=
"">
169 <refpurpose>Process
<doc:db>literal
</doc:db> elements
</refpurpose>
173 Applies templates in the
<quote>template.latex.verbatim
</quote>
174 mode within a
&LaTeX; <function condition=
"latex">verb
</function>
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>