2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
xmlns:fo="http://www.w3.org/1999/XSL/Format"
4
xmlns:sverb="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Verbatim"
5
xmlns:xverb="com.nwalsh.xalan.Verbatim"
6
xmlns:lxslt="http://xml.apache.org/xslt"
7
exclude-result-prefixes="sverb xverb lxslt"
10
<!-- ********************************************************************
11
$Id: callout.xsl 6910 2007-06-28 23:23:30Z xmldoc $
12
********************************************************************
14
This file is part of the XSL DocBook Stylesheet distribution.
15
See ../README or http://docbook.sf.net/release/xsl/current/ for
16
copyright and other information.
18
******************************************************************** -->
20
<lxslt:component prefix="xverb"
21
functions="insertCallouts"/>
23
<xsl:template match="programlistingco|screenco">
24
<xsl:variable name="verbatim" select="programlisting|screen"/>
25
<xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
28
<xsl:when test="$use.extensions != '0'
29
and $callouts.extension != '0'">
30
<xsl:variable name="rtf">
31
<xsl:apply-templates select="$verbatim">
32
<xsl:with-param name="suppress-numbers" select="'1'"/>
33
</xsl:apply-templates>
36
<xsl:variable name="rtf-with-callouts">
38
<xsl:when test="contains($vendor, 'SAXON ')">
39
<xsl:copy-of select="sverb:insertCallouts(areaspec,$rtf)"/>
41
<xsl:when test="contains($vendor, 'Apache Software Foundation')">
42
<xsl:copy-of select="xverb:insertCallouts(areaspec,$rtf)"/>
45
<xsl:message terminate="yes">
46
<xsl:text>Don't know how to do callouts with </xsl:text>
47
<xsl:value-of select="$vendor"/>
54
<xsl:when test="$verbatim/@linenumbering = 'numbered'
55
and $linenumbering.extension != '0'">
56
<xsl:call-template name="number.rtf.lines">
57
<xsl:with-param name="rtf" select="$rtf-with-callouts"/>
58
<xsl:with-param name="pi.context"
59
select="programlisting|screen"/>
61
<xsl:apply-templates select="calloutlist"/>
64
<xsl:copy-of select="$rtf-with-callouts"/>
65
<xsl:apply-templates select="calloutlist"/>
70
<xsl:apply-templates/>
75
<xsl:template match="areaspec|areaset|area">
78
<xsl:template match="areaset" mode="conumber">
79
<xsl:number count="area|areaset" format="1"/>
82
<xsl:template match="area" mode="conumber">
83
<xsl:number count="area|areaset" format="1"/>
86
<xsl:template match="co">
88
<xsl:call-template name="anchor"/>
89
<xsl:apply-templates select="." mode="callout-bug"/>
93
<xsl:template match="coref">
94
<!-- tricky; this relies on the fact that we can process the "co" that's -->
95
<!-- "over there" as if it were "right here" -->
97
<xsl:variable name="co" select="key('id', @linkend)"/>
99
<xsl:when test="not($co)">
101
<xsl:text>Error: coref link is broken: </xsl:text>
102
<xsl:value-of select="@linkend"/>
105
<xsl:when test="local-name($co) != 'co'">
107
<xsl:text>Error: coref doesn't point to a co: </xsl:text>
108
<xsl:value-of select="@linkend"/>
113
<xsl:call-template name="anchor"/>
114
<xsl:apply-templates select="$co" mode="callout-bug"/>
120
<xsl:template match="co" mode="callout-bug">
121
<xsl:call-template name="callout-bug">
122
<xsl:with-param name="conum">
123
<xsl:number count="co"
125
from="programlisting|screen|literallayout|synopsis"
131
<xsl:template name="callout-bug">
132
<xsl:param name="conum" select='1'/>
135
<!-- Draw callouts as images -->
136
<xsl:when test="$callout.graphics != '0'
137
and $conum <= $callout.graphics.number.limit">
138
<xsl:variable name="filename"
139
select="concat($callout.graphics.path, $conum,
140
$callout.graphics.extension)"/>
142
<fo:external-graphic content-width="{$callout.icon.size}"
143
width="{$callout.icon.size}">
144
<xsl:attribute name="src">
146
<xsl:when test="$passivetex.extensions != 0
147
or $fop.extensions != 0
148
or $arbortext.extensions != 0">
149
<xsl:value-of select="$filename"/>
152
<xsl:text>url(</xsl:text>
153
<xsl:value-of select="$filename"/>
154
<xsl:text>)</xsl:text>
158
</fo:external-graphic>
161
<xsl:when test="$callout.unicode != 0
162
and $conum <= $callout.unicode.number.limit">
163
<xsl:variable name="comarkup">
165
<xsl:when test="$callout.unicode.start.character = 10102">
167
<xsl:when test="$conum = 1">❶</xsl:when>
168
<xsl:when test="$conum = 2">❷</xsl:when>
169
<xsl:when test="$conum = 3">❸</xsl:when>
170
<xsl:when test="$conum = 4">❹</xsl:when>
171
<xsl:when test="$conum = 5">❺</xsl:when>
172
<xsl:when test="$conum = 6">❻</xsl:when>
173
<xsl:when test="$conum = 7">❼</xsl:when>
174
<xsl:when test="$conum = 8">❽</xsl:when>
175
<xsl:when test="$conum = 9">❾</xsl:when>
176
<xsl:when test="$conum = 10">❿</xsl:when>
181
<xsl:text>Don't know how to generate Unicode callouts </xsl:text>
182
<xsl:text>when $callout.unicode.start.character is </xsl:text>
183
<xsl:value-of select="$callout.unicode.start.character"/>
185
<fo:inline background-color="#404040"
188
padding-bottom="0.1em"
189
padding-start="0.2em"
191
baseline-shift="0.1em"
192
font-family="{$body.fontset}"
195
<xsl:value-of select="$conum"/>
202
<xsl:when test="$callout.unicode.font != ''">
203
<fo:inline font-family="{$callout.unicode.font}">
204
<xsl:copy-of select="$comarkup"/>
208
<xsl:copy-of select="$comarkup"/>
213
<!-- Most safe: draw a dark gray square with a white number inside -->
215
<fo:inline background-color="#404040"
218
padding-bottom="0.1em"
219
padding-start="0.2em"
221
baseline-shift="0.1em"
222
font-family="{$body.fontset}"
225
<xsl:value-of select="$conum"/>