source: stylesheets/lfs-xsl/docbook-xsl-1.78.1/html/callout.xsl@ 15c7d39

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 15c7d39 was 15c7d39, checked in by Matthew Burgess <matthew@…>, 11 years ago

Update stylesheets to docbook-xsl-1.78.1.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10355 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 7.9 KB
Line 
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 9305 2012-04-27 21:50:53Z 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="id.attribute"/>
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"/>
60 </xsl:call-template>
61 <xsl:apply-templates select="calloutlist"/>
62 </div>
63 </xsl:when>
64 <xsl:otherwise>
65 <div>
66 <xsl:call-template name="common.html.attributes"/>
67 <xsl:call-template name="id.attribute"/>
68 <xsl:copy-of select="$rtf-with-callouts"/>
69 <xsl:apply-templates select="calloutlist"/>
70 </div>
71 </xsl:otherwise>
72 </xsl:choose>
73 </xsl:when>
74 <xsl:otherwise>
75 <div>
76 <xsl:apply-templates select="." mode="common.html.attributes"/>
77 <xsl:call-template name="id.attribute"/>
78 <xsl:apply-templates/>
79 </div>
80 </xsl:otherwise>
81 </xsl:choose>
82</xsl:template>
83
84<xsl:template match="areaspec|areaset|area">
85</xsl:template>
86
87<xsl:template match="areaset" mode="conumber">
88 <xsl:number count="area|areaset" format="1"/>
89</xsl:template>
90
91<xsl:template match="area" mode="conumber">
92 <xsl:number count="area|areaset" format="1"/>
93</xsl:template>
94
95<xsl:template match="co" name="co">
96 <!-- Support a single linkend in HTML -->
97 <xsl:variable name="targets" select="key('id', @linkends)"/>
98 <xsl:variable name="target" select="$targets[1]"/>
99 <xsl:choose>
100 <xsl:when test="$target">
101 <a>
102 <xsl:apply-templates select="." mode="common.html.attributes"/>
103 <xsl:choose>
104 <xsl:when test="$generate.id.attributes = 0">
105 <!-- force an id attribute here -->
106 <xsl:if test="@id or @xml:id">
107 <xsl:attribute name="name">
108 <xsl:value-of select="(@id|@xml:id)[1]"/>
109 </xsl:attribute>
110 </xsl:if>
111 </xsl:when>
112 <xsl:otherwise>
113 <xsl:call-template name="id.attribute"/>
114 </xsl:otherwise>
115 </xsl:choose>
116 <xsl:attribute name="href">
117 <xsl:call-template name="href.target">
118 <xsl:with-param name="object" select="$target"/>
119 </xsl:call-template>
120 </xsl:attribute>
121 <xsl:apply-templates select="." mode="callout-bug"/>
122 </a>
123 </xsl:when>
124 <xsl:otherwise>
125 <xsl:if test="$generate.id.attributes != 0">
126 <xsl:if test="@id or @xml:id">
127 <span>
128 <xsl:attribute name="id">
129 <xsl:value-of select="(@id|@xml:id)[1]"/>
130 </xsl:attribute>
131 </span>
132 </xsl:if>
133 </xsl:if>
134 <xsl:call-template name="anchor"/>
135 <xsl:apply-templates select="." mode="callout-bug"/>
136 </xsl:otherwise>
137 </xsl:choose>
138</xsl:template>
139
140<xsl:template match="coref">
141 <!-- tricky; this relies on the fact that we can process the "co" that's -->
142 <!-- "over there" as if it were "right here" -->
143
144 <xsl:variable name="co" select="key('id', @linkend)"/>
145 <xsl:choose>
146 <xsl:when test="not($co)">
147 <xsl:message>
148 <xsl:text>Error: coref link is broken: </xsl:text>
149 <xsl:value-of select="@linkend"/>
150 </xsl:message>
151 </xsl:when>
152 <xsl:when test="local-name($co) != 'co'">
153 <xsl:message>
154 <xsl:text>Error: coref doesn't point to a co: </xsl:text>
155 <xsl:value-of select="@linkend"/>
156 </xsl:message>
157 </xsl:when>
158 <xsl:otherwise>
159 <xsl:apply-templates select="$co"/>
160 </xsl:otherwise>
161 </xsl:choose>
162</xsl:template>
163
164<xsl:template match="co" mode="callout-bug">
165 <xsl:call-template name="callout-bug">
166 <xsl:with-param name="conum">
167 <xsl:number count="co"
168 level="any"
169 from="programlisting|screen|literallayout|synopsis"
170 format="1"/>
171 </xsl:with-param>
172 </xsl:call-template>
173</xsl:template>
174
175<xsl:template name="callout-bug">
176 <xsl:param name="conum" select='1'/>
177
178 <xsl:choose>
179 <xsl:when test="$callout.graphics != 0
180 and $conum &lt;= $callout.graphics.number.limit">
181 <!-- Added span to make valid in XHTML 1 -->
182 <span><img src="{$callout.graphics.path}{$conum}{$callout.graphics.extension}"
183 alt="{$conum}" border="0"/></span>
184 </xsl:when>
185 <xsl:when test="$callout.unicode != 0
186 and $conum &lt;= $callout.unicode.number.limit">
187 <xsl:choose>
188 <xsl:when test="$callout.unicode.start.character = 10102">
189 <xsl:choose>
190 <xsl:when test="$conum = 1">&#10102;</xsl:when>
191 <xsl:when test="$conum = 2">&#10103;</xsl:when>
192 <xsl:when test="$conum = 3">&#10104;</xsl:when>
193 <xsl:when test="$conum = 4">&#10105;</xsl:when>
194 <xsl:when test="$conum = 5">&#10106;</xsl:when>
195 <xsl:when test="$conum = 6">&#10107;</xsl:when>
196 <xsl:when test="$conum = 7">&#10108;</xsl:when>
197 <xsl:when test="$conum = 8">&#10109;</xsl:when>
198 <xsl:when test="$conum = 9">&#10110;</xsl:when>
199 <xsl:when test="$conum = 10">&#10111;</xsl:when>
200 </xsl:choose>
201 </xsl:when>
202 <xsl:otherwise>
203 <xsl:message>
204 <xsl:text>Don't know how to generate Unicode callouts </xsl:text>
205 <xsl:text>when $callout.unicode.start.character is </xsl:text>
206 <xsl:value-of select="$callout.unicode.start.character"/>
207 </xsl:message>
208 <xsl:text>(</xsl:text>
209 <xsl:value-of select="$conum"/>
210 <xsl:text>)</xsl:text>
211 </xsl:otherwise>
212 </xsl:choose>
213 </xsl:when>
214 <xsl:otherwise>
215 <xsl:text>(</xsl:text>
216 <xsl:value-of select="$conum"/>
217 <xsl:text>)</xsl:text>
218 </xsl:otherwise>
219 </xsl:choose>
220</xsl:template>
221
222</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.