2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:sverb="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Verbatim"
4 xmlns:xverb="xalan://com.nwalsh.xalan.Verbatim"
5 xmlns:lxslt="http://xml.apache.org/xslt"
6 exclude-result-prefixes="sverb xverb lxslt"
9 <!-- ********************************************************************
10 $Id: callout.xsl 8421 2009-05-04 07:49:49Z bobstayton $
11 ********************************************************************
13 This file is part of the XSL DocBook Stylesheet distribution.
14 See ../README or http://docbook.sf.net/release/xsl/current/ for
15 copyright and other information.
17 ******************************************************************** -->
19 <lxslt:component prefix="xverb"
20 functions="insertCallouts"/>
22 <xsl:template match="programlistingco|screenco">
23 <xsl:variable name="verbatim" select="programlisting|screen"/>
26 <xsl:when test="$use.extensions != '0'
27 and $callouts.extension != '0'">
28 <xsl:variable name="rtf">
29 <xsl:apply-templates select="$verbatim">
30 <xsl:with-param name="suppress-numbers" select="'1'"/>
31 </xsl:apply-templates>
34 <xsl:variable name="rtf-with-callouts">
36 <xsl:when test="function-available('sverb:insertCallouts')">
37 <xsl:copy-of select="sverb:insertCallouts(areaspec,$rtf)"/>
39 <xsl:when test="function-available('xverb:insertCallouts')">
40 <xsl:copy-of select="xverb:insertCallouts(areaspec,$rtf)"/>
43 <xsl:message terminate="yes">
44 <xsl:text>No insertCallouts function is available.</xsl:text>
51 <xsl:when test="$verbatim/@linenumbering = 'numbered'
52 and $linenumbering.extension != '0'">
54 <xsl:call-template name="common.html.attributes"/>
55 <xsl:call-template name="number.rtf.lines">
56 <xsl:with-param name="rtf" select="$rtf-with-callouts"/>
57 <xsl:with-param name="pi.context"
58 select="programlisting|screen"/>
60 <xsl:apply-templates select="calloutlist"/>
65 <xsl:call-template name="common.html.attributes"/>
66 <xsl:copy-of select="$rtf-with-callouts"/>
67 <xsl:apply-templates select="calloutlist"/>
74 <xsl:apply-templates select="." mode="common.html.attributes"/>
75 <xsl:apply-templates/>
81 <xsl:template match="areaspec|areaset|area">
84 <xsl:template match="areaset" mode="conumber">
85 <xsl:number count="area|areaset" format="1"/>
88 <xsl:template match="area" mode="conumber">
89 <xsl:number count="area|areaset" format="1"/>
92 <xsl:template match="co" name="co">
93 <!-- Support a single linkend in HTML -->
94 <xsl:variable name="targets" select="key('id', @linkends)"/>
95 <xsl:variable name="target" select="$targets[1]"/>
97 <xsl:when test="$target">
99 <xsl:apply-templates select="." mode="common.html.attributes"/>
100 <xsl:if test="@id or @xml:id">
101 <xsl:attribute name="name">
102 <xsl:value-of select="(@id|@xml:id)[1]"/>
105 <xsl:attribute name="href">
106 <xsl:call-template name="href.target">
107 <xsl:with-param name="object" select="$target"/>
110 <xsl:apply-templates select="." mode="callout-bug"/>
114 <xsl:call-template name="anchor"/>
115 <xsl:apply-templates select="." mode="callout-bug"/>
120 <xsl:template match="coref">
121 <!-- tricky; this relies on the fact that we can process the "co" that's -->
122 <!-- "over there" as if it were "right here" -->
124 <xsl:variable name="co" select="key('id', @linkend)"/>
126 <xsl:when test="not($co)">
128 <xsl:text>Error: coref link is broken: </xsl:text>
129 <xsl:value-of select="@linkend"/>
132 <xsl:when test="local-name($co) != 'co'">
134 <xsl:text>Error: coref doesn't point to a co: </xsl:text>
135 <xsl:value-of select="@linkend"/>
139 <xsl:apply-templates select="$co"/>
144 <xsl:template match="co" mode="callout-bug">
145 <xsl:call-template name="callout-bug">
146 <xsl:with-param name="conum">
147 <xsl:number count="co"
149 from="programlisting|screen|literallayout|synopsis"
155 <xsl:template name="callout-bug">
156 <xsl:param name="conum" select='1'/>
159 <xsl:when test="$callout.graphics != 0
160 and $conum <= $callout.graphics.number.limit">
161 <img src="{$callout.graphics.path}{$conum}{$callout.graphics.extension}"
162 alt="{$conum}" border="0"/>
164 <xsl:when test="$callout.unicode != 0
165 and $conum <= $callout.unicode.number.limit">
167 <xsl:when test="$callout.unicode.start.character = 10102">
169 <xsl:when test="$conum = 1">❶</xsl:when>
170 <xsl:when test="$conum = 2">❷</xsl:when>
171 <xsl:when test="$conum = 3">❸</xsl:when>
172 <xsl:when test="$conum = 4">❹</xsl:when>
173 <xsl:when test="$conum = 5">❺</xsl:when>
174 <xsl:when test="$conum = 6">❻</xsl:when>
175 <xsl:when test="$conum = 7">❼</xsl:when>
176 <xsl:when test="$conum = 8">❽</xsl:when>
177 <xsl:when test="$conum = 9">❾</xsl:when>
178 <xsl:when test="$conum = 10">❿</xsl:when>
183 <xsl:text>Don't know how to generate Unicode callouts </xsl:text>
184 <xsl:text>when $callout.unicode.start.character is </xsl:text>
185 <xsl:value-of select="$callout.unicode.start.character"/>
187 <xsl:text>(</xsl:text>
188 <xsl:value-of select="$conum"/>
189 <xsl:text>)</xsl:text>
194 <xsl:text>(</xsl:text>
195 <xsl:value-of select="$conum"/>
196 <xsl:text>)</xsl:text>