blob: a5bb09099aa6754ddddedd61b8454989c8b9c0a3 (
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
|
<?xml version='1.0'?>
<!--#############################################################################
| $Id: verbatim.mod.xsl,v 1.1 2003/04/30 21:39:49 ab Exp $
|- #############################################################################
| $Author: ab $
|
| PURPOSE:
+ ############################################################################## -->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
exclude-result-prefixes="doc" version='1.0'>
<!--############################################################################# -->
<!-- DOCUMENTATION -->
<doc:reference id="verbatim" xmlns="">
<referenceinfo>
<releaseinfo role="meta">
$Id: verbatim.mod.xsl,v 1.1 2003/04/30 21:39:49 ab Exp $
</releaseinfo>
<authorgroup>
<author> <firstname>Ramon</firstname> <surname>Casellas</surname> </author>
<author> <firstname>James</firstname> <surname>Devenish</surname> </author>
</authorgroup>
<copyright>
<year>2000</year> <year>2001</year> <year>2002</year> <year>2003</year>
<holder>Ramon Casellas</holder>
</copyright>
</referenceinfo>
<title>Verbatim <filename>verbatim.mod.xsl</filename></title>
<partintro>
<section><title>Introduction</title>
<para></para>
</section>
</partintro>
</doc:reference>
<!--############################################################################# -->
<!--############################################################################# -->
<!-- DOCUMENTATION -->
<doc:template match="literal" xmlns="">
<refpurpose>Template for <sgmltag>literal</sgmltag></refpurpose>
<refdescription>
Template for literal template
</refdescription>
</doc:template>
<!--############################################################################# -->
<xsl:template match="literal" mode="latex.verbatim">
<xsl:text>{\verb </xsl:text>
<xsl:apply-templates mode="latex.verbatim"/>
<xsl:text>}</xsl:text>
</xsl:template>
<!--############################################################################# -->
<!-- DOCUMENTATION -->
<doc:template name="verbatim.apply.templates" xmlns="">
<refpurpose> Auxiliary template to output verbatim LaTeX code in verbatim mode </refpurpose>
<refdescription>
<para> Takes into account whether the user is using fancyvrb or not. It allows
veratim line numbering and other fancy stuff. </para>
<para> In order to use a small or large font, you may also wanto to use
the <literal>role</literal> attribute : </para>
<screen><![CDATA[
<programlisting role="small">
</programlisting>
<programlisting role="large">
</programlisting>
]]></screen>
</refdescription>
</doc:template>
<!--############################################################################# -->
<xsl:template name="verbatim.apply.templates">
<xsl:choose>
<xsl:when test="ancestor::entry">
<xsl:message>Problem with <xsl:value-of select="local-name(.)"/> inside table entries.</xsl:message>
<xsl:text>\texttt{</xsl:text>
<xsl:apply-templates mode="latex.verbatim"/>
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:when test="$latex.use.fancyvrb='1'">
<xsl:variable name="not_monospaced" select="local-name(.)='literallayout' and @format!='monospaced'"/>
<xsl:text> \begin{Verbatim}[</xsl:text>
<xsl:if test="@linenumbering='numbered'">
<xsl:text>,numbers=left</xsl:text>
</xsl:if>
<xsl:if test="$not_monospaced">
<xsl:text>,fontfamily=default</xsl:text>
</xsl:if>
<xsl:if test="@role">
<xsl:choose>
<xsl:when test="@role='small'">
<xsl:text>,fontsize=\small</xsl:text>
</xsl:when>
<xsl:when test="@role='large'">
<xsl:text>,fontsize=\large</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:if>
<xsl:text>] </xsl:text>
<xsl:choose>
<xsl:when test="$not_monospaced">
<!-- Needs to be changed to cope with regular characterset! -->
<xsl:apply-templates mode="latex.verbatim"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="latex.verbatim"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text> \end{Verbatim} </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> \begin{verbatim} </xsl:text>
<xsl:apply-templates mode="latex.verbatim"/>
<xsl:text> \end{verbatim} </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="address">
<xsl:call-template name="verbatim.apply.templates"/>
</xsl:template>
<doc:template name="verbatim" match="screen|programlisting|literallayout" xmlns="">
<refpurpose>Environments in which whitespace is significant</refpurpose>
<refdescription>
<itemizedlist>
<title>Known Bugs</title>
<listitem><simpara>Templates are not applied within programlistings.</simpara></listitem>
</itemizedlist>
</refdescription>
</doc:template>
<xsl:template match="screen|programlisting|literallayout">
<xsl:call-template name="verbatim.apply.templates"/>
</xsl:template>
</xsl:stylesheet>
|