1 <?xml version="1.0" encoding="ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sverb="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Verbatim" xmlns:xverb="xalan://com.nwalsh.xalan.Verbatim" xmlns:lxslt="http://xml.apache.org/xslt" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="sverb xverb lxslt" version="1.0">
6 <!-- ********************************************************************
7 $Id: callout.xsl 8421 2009-05-04 07:49:49Z bobstayton $
8 ********************************************************************
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://docbook.sf.net/release/xsl/current/ for
12 copyright and other information.
14 ******************************************************************** -->
16 <lxslt:component prefix="xverb" functions="insertCallouts"/>
18 <xsl:template match="programlistingco|screenco">
19 <xsl:variable name="verbatim" select="programlisting|screen"/>
22 <xsl:when test="$use.extensions != '0' and $callouts.extension != '0'">
23 <xsl:variable name="rtf">
24 <xsl:apply-templates select="$verbatim">
25 <xsl:with-param name="suppress-numbers" select="'1'"/>
26 </xsl:apply-templates>
29 <xsl:variable name="rtf-with-callouts">
31 <xsl:when test="function-available('sverb:insertCallouts')">
32 <xsl:copy-of select="sverb:insertCallouts(areaspec,$rtf)"/>
34 <xsl:when test="function-available('xverb:insertCallouts')">
35 <xsl:copy-of select="xverb:insertCallouts(areaspec,$rtf)"/>
38 <xsl:message terminate="yes">
39 <xsl:text>No insertCallouts function is available.</xsl:text>
46 <xsl:when test="$verbatim/@linenumbering = 'numbered' and $linenumbering.extension != '0'">
48 <xsl:call-template name="common.html.attributes"/>
49 <xsl:call-template name="number.rtf.lines">
50 <xsl:with-param name="rtf" select="$rtf-with-callouts"/>
51 <xsl:with-param name="pi.context" select="programlisting|screen"/>
53 <xsl:apply-templates select="calloutlist"/>
58 <xsl:call-template name="common.html.attributes"/>
59 <xsl:copy-of select="$rtf-with-callouts"/>
60 <xsl:apply-templates select="calloutlist"/>
67 <xsl:apply-templates select="." mode="common.html.attributes"/>
68 <xsl:apply-templates/>
74 <xsl:template match="areaspec|areaset|area">
77 <xsl:template match="areaset" mode="conumber">
78 <xsl:number count="area|areaset" format="1"/>
81 <xsl:template match="area" mode="conumber">
82 <xsl:number count="area|areaset" format="1"/>
85 <xsl:template match="co" name="co">
86 <!-- Support a single linkend in HTML -->
87 <xsl:variable name="targets" select="key('id', @linkends)"/>
88 <xsl:variable name="target" select="$targets[1]"/>
90 <xsl:when test="$target">
92 <xsl:apply-templates select="." mode="common.html.attributes"/>
93 <xsl:if test="@id or @xml:id">
94 <xsl:attribute name="id">
95 <xsl:value-of select="(@id|@xml:id)[1]"/>
98 <xsl:attribute name="href">
99 <xsl:call-template name="href.target">
100 <xsl:with-param name="object" select="$target"/>
103 <xsl:apply-templates select="." mode="callout-bug"/>
107 <xsl:call-template name="anchor"/>
108 <xsl:apply-templates select="." mode="callout-bug"/>
113 <xsl:template match="coref">
114 <!-- tricky; this relies on the fact that we can process the "co" that's -->
115 <!-- "over there" as if it were "right here" -->
117 <xsl:variable name="co" select="key('id', @linkend)"/>
119 <xsl:when test="not($co)">
121 <xsl:text>Error: coref link is broken: </xsl:text>
122 <xsl:value-of select="@linkend"/>
125 <xsl:when test="local-name($co) != 'co'">
127 <xsl:text>Error: coref doesn't point to a co: </xsl:text>
128 <xsl:value-of select="@linkend"/>
132 <xsl:apply-templates select="$co"/>
137 <xsl:template match="co" mode="callout-bug">
138 <xsl:call-template name="callout-bug">
139 <xsl:with-param name="conum">
140 <xsl:number count="co" level="any" from="programlisting|screen|literallayout|synopsis" format="1"/>
145 <xsl:template name="callout-bug">
146 <xsl:param name="conum" select="1"/>
149 <xsl:when test="$callout.graphics != 0 and $conum <= $callout.graphics.number.limit">
150 <img src="{$callout.graphics.path}{$conum}{$callout.graphics.extension}" alt="{$conum}"/>
152 <xsl:when test="$callout.unicode != 0 and $conum <= $callout.unicode.number.limit">
154 <xsl:when test="$callout.unicode.start.character = 10102">
156 <xsl:when test="$conum = 1">❶</xsl:when>
157 <xsl:when test="$conum = 2">❷</xsl:when>
158 <xsl:when test="$conum = 3">❸</xsl:when>
159 <xsl:when test="$conum = 4">❹</xsl:when>
160 <xsl:when test="$conum = 5">❺</xsl:when>
161 <xsl:when test="$conum = 6">❻</xsl:when>
162 <xsl:when test="$conum = 7">❼</xsl:when>
163 <xsl:when test="$conum = 8">❽</xsl:when>
164 <xsl:when test="$conum = 9">❾</xsl:when>
165 <xsl:when test="$conum = 10">❿</xsl:when>
170 <xsl:text>Don't know how to generate Unicode callouts </xsl:text>
171 <xsl:text>when $callout.unicode.start.character is </xsl:text>
172 <xsl:value-of select="$callout.unicode.start.character"/>
174 <xsl:text>(</xsl:text>
175 <xsl:value-of select="$conum"/>
176 <xsl:text>)</xsl:text>
181 <xsl:text>(</xsl:text>
182 <xsl:value-of select="$conum"/>
183 <xsl:text>)</xsl:text>