]> git.evergreen-ils.org Git - working/Evergreen.git/blob - stylesheets/evergreen_docbook_files/docbook-xsl-1.75.2/html/callout.xsl
Evergreen Version Fix to reflect the new EG releases 2.0.10 and 1.6.1.9
[working/Evergreen.git] / stylesheets / evergreen_docbook_files / docbook-xsl-1.75.2 / html / callout.xsl
1 <?xml version='1.0'?>
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"
7                 version='1.0'>
8
9 <!-- ********************************************************************
10      $Id: callout.xsl 8421 2009-05-04 07:49:49Z bobstayton $
11      ********************************************************************
12
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.
16
17      ******************************************************************** -->
18
19 <lxslt:component prefix="xverb"
20                  functions="insertCallouts"/>
21
22 <xsl:template match="programlistingco|screenco">
23   <xsl:variable name="verbatim" select="programlisting|screen"/>
24
25   <xsl:choose>
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>
32       </xsl:variable>
33
34       <xsl:variable name="rtf-with-callouts">
35         <xsl:choose>
36           <xsl:when test="function-available('sverb:insertCallouts')">
37             <xsl:copy-of select="sverb:insertCallouts(areaspec,$rtf)"/>
38           </xsl:when>
39           <xsl:when test="function-available('xverb:insertCallouts')">
40             <xsl:copy-of select="xverb:insertCallouts(areaspec,$rtf)"/>
41           </xsl:when>
42           <xsl:otherwise>
43             <xsl:message terminate="yes">
44               <xsl:text>No insertCallouts function is available.</xsl:text>
45             </xsl:message>
46           </xsl:otherwise>
47         </xsl:choose>
48       </xsl:variable>
49
50       <xsl:choose>
51         <xsl:when test="$verbatim/@linenumbering = 'numbered'
52                         and $linenumbering.extension != '0'">
53           <div>
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"/>
59             </xsl:call-template>
60             <xsl:apply-templates select="calloutlist"/>
61           </div>
62         </xsl:when>
63         <xsl:otherwise>
64           <div>
65             <xsl:call-template name="common.html.attributes"/>
66             <xsl:copy-of select="$rtf-with-callouts"/>
67             <xsl:apply-templates select="calloutlist"/>
68           </div>
69         </xsl:otherwise>
70       </xsl:choose>
71     </xsl:when>
72     <xsl:otherwise>
73       <div>
74         <xsl:apply-templates select="." mode="common.html.attributes"/>
75         <xsl:apply-templates/>
76       </div>
77     </xsl:otherwise>
78   </xsl:choose>
79 </xsl:template>
80
81 <xsl:template match="areaspec|areaset|area">
82 </xsl:template>
83
84 <xsl:template match="areaset" mode="conumber">
85   <xsl:number count="area|areaset" format="1"/>
86 </xsl:template>
87
88 <xsl:template match="area" mode="conumber">
89   <xsl:number count="area|areaset" format="1"/>
90 </xsl:template>
91
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]"/>
96   <xsl:choose>
97     <xsl:when test="$target">
98       <a>
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]"/>
103           </xsl:attribute>
104         </xsl:if>
105         <xsl:attribute name="href">
106           <xsl:call-template name="href.target">
107             <xsl:with-param name="object" select="$target"/>
108           </xsl:call-template>
109         </xsl:attribute>
110         <xsl:apply-templates select="." mode="callout-bug"/>
111       </a>
112     </xsl:when>
113     <xsl:otherwise>
114       <xsl:call-template name="anchor"/>
115       <xsl:apply-templates select="." mode="callout-bug"/>
116     </xsl:otherwise>
117   </xsl:choose>
118 </xsl:template>
119
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" -->
123
124   <xsl:variable name="co" select="key('id', @linkend)"/>
125   <xsl:choose>
126     <xsl:when test="not($co)">
127       <xsl:message>
128         <xsl:text>Error: coref link is broken: </xsl:text>
129         <xsl:value-of select="@linkend"/>
130       </xsl:message>
131     </xsl:when>
132     <xsl:when test="local-name($co) != 'co'">
133       <xsl:message>
134         <xsl:text>Error: coref doesn't point to a co: </xsl:text>
135         <xsl:value-of select="@linkend"/>
136       </xsl:message>
137     </xsl:when>
138     <xsl:otherwise>
139       <xsl:apply-templates select="$co"/>
140     </xsl:otherwise>
141   </xsl:choose>
142 </xsl:template>
143
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"
148                   level="any"
149                   from="programlisting|screen|literallayout|synopsis"
150                   format="1"/>
151     </xsl:with-param>
152   </xsl:call-template>
153 </xsl:template>
154
155 <xsl:template name="callout-bug">
156   <xsl:param name="conum" select='1'/>
157
158   <xsl:choose>
159     <xsl:when test="$callout.graphics != 0
160                     and $conum &lt;= $callout.graphics.number.limit">
161       <img src="{$callout.graphics.path}{$conum}{$callout.graphics.extension}"
162            alt="{$conum}" border="0"/>
163     </xsl:when>
164     <xsl:when test="$callout.unicode != 0
165                     and $conum &lt;= $callout.unicode.number.limit">
166       <xsl:choose>
167         <xsl:when test="$callout.unicode.start.character = 10102">
168           <xsl:choose>
169             <xsl:when test="$conum = 1">&#10102;</xsl:when>
170             <xsl:when test="$conum = 2">&#10103;</xsl:when>
171             <xsl:when test="$conum = 3">&#10104;</xsl:when>
172             <xsl:when test="$conum = 4">&#10105;</xsl:when>
173             <xsl:when test="$conum = 5">&#10106;</xsl:when>
174             <xsl:when test="$conum = 6">&#10107;</xsl:when>
175             <xsl:when test="$conum = 7">&#10108;</xsl:when>
176             <xsl:when test="$conum = 8">&#10109;</xsl:when>
177             <xsl:when test="$conum = 9">&#10110;</xsl:when>
178             <xsl:when test="$conum = 10">&#10111;</xsl:when>
179           </xsl:choose>
180         </xsl:when>
181         <xsl:otherwise>
182           <xsl:message>
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"/>
186           </xsl:message>
187           <xsl:text>(</xsl:text>
188           <xsl:value-of select="$conum"/>
189           <xsl:text>)</xsl:text>
190         </xsl:otherwise>
191       </xsl:choose>
192     </xsl:when>
193     <xsl:otherwise>
194       <xsl:text>(</xsl:text>
195       <xsl:value-of select="$conum"/>
196       <xsl:text>)</xsl:text>
197     </xsl:otherwise>
198   </xsl:choose>
199 </xsl:template>
200
201 </xsl:stylesheet>