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:suwl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.UnwrapLinks" xmlns:exsl="http://exslt.org/common" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="suwl exsl xlink" version="1.0"> |
---|
5 | |
---|
6 | <!-- ******************************************************************** |
---|
7 | $Id$ |
---|
8 | ******************************************************************** |
---|
9 | |
---|
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. |
---|
13 | |
---|
14 | ******************************************************************** --> |
---|
15 | |
---|
16 | <!-- Use internal variable for olink xlink role for consistency --> |
---|
17 | <xsl:variable name="xolink.role">http://docbook.org/xlink/role/olink</xsl:variable> |
---|
18 | |
---|
19 | <!-- ==================================================================== --> |
---|
20 | |
---|
21 | <xsl:template match="anchor"> |
---|
22 | <xsl:call-template name="anchor"/> |
---|
23 | </xsl:template> |
---|
24 | |
---|
25 | <!-- ==================================================================== --> |
---|
26 | |
---|
27 | <xsl:template match="xref" name="xref"> |
---|
28 | <xsl:param name="xhref" select="@xlink:href"/> |
---|
29 | <!-- is the @xlink:href a local idref link? --> |
---|
30 | <xsl:param name="xlink.idref"> |
---|
31 | <xsl:if test="starts-with($xhref,'#') and (not(contains($xhref,'(')) or starts-with($xhref, '#xpointer(id('))"> |
---|
32 | <xsl:call-template name="xpointer.idref"> |
---|
33 | <xsl:with-param name="xpointer" select="$xhref"/> |
---|
34 | </xsl:call-template> |
---|
35 | </xsl:if> |
---|
36 | </xsl:param> |
---|
37 | <xsl:param name="xlink.targets" select="key('id',$xlink.idref)"/> |
---|
38 | <xsl:param name="linkend.targets" select="key('id',@linkend)"/> |
---|
39 | <xsl:param name="target" select="($xlink.targets | $linkend.targets)[1]"/> |
---|
40 | |
---|
41 | <xsl:variable name="xrefstyle"> |
---|
42 | <xsl:choose> |
---|
43 | <xsl:when test="@role and not(@xrefstyle) and $use.role.as.xrefstyle != 0"> |
---|
44 | <xsl:value-of select="@role"/> |
---|
45 | </xsl:when> |
---|
46 | <xsl:otherwise> |
---|
47 | <xsl:value-of select="@xrefstyle"/> |
---|
48 | </xsl:otherwise> |
---|
49 | </xsl:choose> |
---|
50 | </xsl:variable> |
---|
51 | |
---|
52 | <xsl:call-template name="anchor"/> |
---|
53 | |
---|
54 | <xsl:variable name="content"> |
---|
55 | <xsl:choose> |
---|
56 | |
---|
57 | <xsl:when test="@endterm"> |
---|
58 | <xsl:variable name="etargets" select="key('id',@endterm)"/> |
---|
59 | <xsl:variable name="etarget" select="$etargets[1]"/> |
---|
60 | <xsl:choose> |
---|
61 | <xsl:when test="count($etarget) = 0"> |
---|
62 | <xsl:message> |
---|
63 | <xsl:value-of select="count($etargets)"/> |
---|
64 | <xsl:text>Endterm points to nonexistent ID: </xsl:text> |
---|
65 | <xsl:value-of select="@endterm"/> |
---|
66 | </xsl:message> |
---|
67 | <xsl:text>???</xsl:text> |
---|
68 | </xsl:when> |
---|
69 | <xsl:otherwise> |
---|
70 | <xsl:apply-templates select="$etarget" mode="endterm"/> |
---|
71 | </xsl:otherwise> |
---|
72 | </xsl:choose> |
---|
73 | </xsl:when> |
---|
74 | |
---|
75 | <xsl:when test="$target/@xreflabel"> |
---|
76 | <xsl:call-template name="xref.xreflabel"> |
---|
77 | <xsl:with-param name="target" select="$target"/> |
---|
78 | </xsl:call-template> |
---|
79 | </xsl:when> |
---|
80 | |
---|
81 | <xsl:when test="$target"> |
---|
82 | <xsl:if test="not(parent::citation)"> |
---|
83 | <xsl:apply-templates select="$target" mode="xref-to-prefix"/> |
---|
84 | </xsl:if> |
---|
85 | |
---|
86 | <xsl:apply-templates select="$target" mode="xref-to"> |
---|
87 | <xsl:with-param name="referrer" select="."/> |
---|
88 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
89 | </xsl:apply-templates> |
---|
90 | |
---|
91 | <xsl:if test="not(parent::citation)"> |
---|
92 | <xsl:apply-templates select="$target" mode="xref-to-suffix"/> |
---|
93 | </xsl:if> |
---|
94 | </xsl:when> |
---|
95 | |
---|
96 | <xsl:otherwise> |
---|
97 | <xsl:message> |
---|
98 | <xsl:text>ERROR: xref linking to </xsl:text> |
---|
99 | <xsl:value-of select="@linkend|@xlink:href"/> |
---|
100 | <xsl:text> has no generated link text.</xsl:text> |
---|
101 | </xsl:message> |
---|
102 | <xsl:text>???</xsl:text> |
---|
103 | </xsl:otherwise> |
---|
104 | </xsl:choose> |
---|
105 | </xsl:variable> |
---|
106 | |
---|
107 | <xsl:call-template name="simple.xlink"> |
---|
108 | <xsl:with-param name="content" select="$content"/> |
---|
109 | </xsl:call-template> |
---|
110 | |
---|
111 | </xsl:template> |
---|
112 | |
---|
113 | <!-- ==================================================================== --> |
---|
114 | |
---|
115 | <!-- biblioref handled largely like an xref --> |
---|
116 | <!-- To be done: add support for begin, end, and units attributes --> |
---|
117 | <xsl:template match="biblioref"> |
---|
118 | <xsl:variable name="targets" select="key('id',@linkend)"/> |
---|
119 | <xsl:variable name="target" select="$targets[1]"/> |
---|
120 | <xsl:variable name="refelem" select="local-name($target)"/> |
---|
121 | |
---|
122 | <xsl:call-template name="check.id.unique"> |
---|
123 | <xsl:with-param name="linkend" select="@linkend"/> |
---|
124 | </xsl:call-template> |
---|
125 | |
---|
126 | <xsl:call-template name="anchor"/> |
---|
127 | |
---|
128 | <xsl:choose> |
---|
129 | <xsl:when test="count($target) = 0"> |
---|
130 | <xsl:message> |
---|
131 | <xsl:text>XRef to nonexistent id: </xsl:text> |
---|
132 | <xsl:value-of select="@linkend"/> |
---|
133 | </xsl:message> |
---|
134 | <xsl:text>???</xsl:text> |
---|
135 | </xsl:when> |
---|
136 | |
---|
137 | <xsl:when test="@endterm"> |
---|
138 | <xsl:variable name="href"> |
---|
139 | <xsl:call-template name="href.target"> |
---|
140 | <xsl:with-param name="object" select="$target"/> |
---|
141 | </xsl:call-template> |
---|
142 | </xsl:variable> |
---|
143 | |
---|
144 | <xsl:variable name="etargets" select="key('id',@endterm)"/> |
---|
145 | <xsl:variable name="etarget" select="$etargets[1]"/> |
---|
146 | <xsl:choose> |
---|
147 | <xsl:when test="count($etarget) = 0"> |
---|
148 | <xsl:message> |
---|
149 | <xsl:value-of select="count($etargets)"/> |
---|
150 | <xsl:text>Endterm points to nonexistent ID: </xsl:text> |
---|
151 | <xsl:value-of select="@endterm"/> |
---|
152 | </xsl:message> |
---|
153 | <a href="{$href}"> |
---|
154 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
155 | <xsl:text>???</xsl:text> |
---|
156 | </a> |
---|
157 | </xsl:when> |
---|
158 | <xsl:otherwise> |
---|
159 | <a href="{$href}"> |
---|
160 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
161 | <xsl:apply-templates select="$etarget" mode="endterm"/> |
---|
162 | </a> |
---|
163 | </xsl:otherwise> |
---|
164 | </xsl:choose> |
---|
165 | </xsl:when> |
---|
166 | |
---|
167 | <xsl:when test="$target/@xreflabel"> |
---|
168 | <a> |
---|
169 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
170 | <xsl:attribute name="href"> |
---|
171 | <xsl:call-template name="href.target"> |
---|
172 | <xsl:with-param name="object" select="$target"/> |
---|
173 | </xsl:call-template> |
---|
174 | </xsl:attribute> |
---|
175 | <xsl:call-template name="xref.xreflabel"> |
---|
176 | <xsl:with-param name="target" select="$target"/> |
---|
177 | </xsl:call-template> |
---|
178 | </a> |
---|
179 | </xsl:when> |
---|
180 | |
---|
181 | <xsl:otherwise> |
---|
182 | <xsl:variable name="href"> |
---|
183 | <xsl:call-template name="href.target"> |
---|
184 | <xsl:with-param name="object" select="$target"/> |
---|
185 | </xsl:call-template> |
---|
186 | </xsl:variable> |
---|
187 | |
---|
188 | <xsl:if test="not(parent::citation)"> |
---|
189 | <xsl:apply-templates select="$target" mode="xref-to-prefix"/> |
---|
190 | </xsl:if> |
---|
191 | |
---|
192 | <a href="{$href}"> |
---|
193 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
194 | <xsl:if test="$target/title or $target/*/title"> |
---|
195 | <xsl:attribute name="title"> |
---|
196 | <xsl:apply-templates select="$target" mode="xref-title"/> |
---|
197 | </xsl:attribute> |
---|
198 | </xsl:if> |
---|
199 | <xsl:apply-templates select="$target" mode="xref-to"> |
---|
200 | <xsl:with-param name="referrer" select="."/> |
---|
201 | <xsl:with-param name="xrefstyle"> |
---|
202 | <xsl:choose> |
---|
203 | <xsl:when test="@role and not(@xrefstyle) and $use.role.as.xrefstyle != 0"> |
---|
204 | <xsl:value-of select="@role"/> |
---|
205 | </xsl:when> |
---|
206 | <xsl:otherwise> |
---|
207 | <xsl:value-of select="@xrefstyle"/> |
---|
208 | </xsl:otherwise> |
---|
209 | </xsl:choose> |
---|
210 | </xsl:with-param> |
---|
211 | </xsl:apply-templates> |
---|
212 | </a> |
---|
213 | |
---|
214 | <xsl:if test="not(parent::citation)"> |
---|
215 | <xsl:apply-templates select="$target" mode="xref-to-suffix"/> |
---|
216 | </xsl:if> |
---|
217 | </xsl:otherwise> |
---|
218 | </xsl:choose> |
---|
219 | </xsl:template> |
---|
220 | |
---|
221 | <!-- ==================================================================== --> |
---|
222 | |
---|
223 | <xsl:template match="*" mode="endterm"> |
---|
224 | <!-- Process the children of the endterm element --> |
---|
225 | <xsl:variable name="endterm"> |
---|
226 | <xsl:apply-templates select="child::node()"/> |
---|
227 | </xsl:variable> |
---|
228 | |
---|
229 | <xsl:choose> |
---|
230 | <xsl:when test="function-available('exsl:node-set')"> |
---|
231 | <xsl:apply-templates select="exsl:node-set($endterm)" mode="remove-ids"/> |
---|
232 | </xsl:when> |
---|
233 | <xsl:otherwise> |
---|
234 | <xsl:copy-of select="$endterm"/> |
---|
235 | </xsl:otherwise> |
---|
236 | </xsl:choose> |
---|
237 | </xsl:template> |
---|
238 | |
---|
239 | <xsl:template match="*" mode="remove-ids"> |
---|
240 | <xsl:choose> |
---|
241 | <!-- handle html or xhtml --> |
---|
242 | <xsl:when test="local-name(.) = 'a' and (namespace-uri(.) = '' or namespace-uri(.) = 'http://www.w3.org/1999/xhtml')"> |
---|
243 | <xsl:choose> |
---|
244 | <xsl:when test="(@name and count(@*) = 1) or (@id and count(@*) = 1) or (@xml:id and count(@*) = 1) or (@xml:id and @name and count(@*) = 2) or (@id and @name and count(@*) = 2)"> |
---|
245 | <xsl:message>suppress anchor</xsl:message> |
---|
246 | <!-- suppress the whole thing --> |
---|
247 | </xsl:when> |
---|
248 | <xsl:otherwise> |
---|
249 | <xsl:copy> |
---|
250 | <xsl:for-each select="@*"> |
---|
251 | <xsl:choose> |
---|
252 | <xsl:when test="local-name(.) != 'name' and local-name(.) != 'id'"> |
---|
253 | <xsl:copy/> |
---|
254 | </xsl:when> |
---|
255 | <xsl:otherwise> |
---|
256 | <xsl:message>removing <xsl:value-of select="local-name(.)"/></xsl:message> |
---|
257 | </xsl:otherwise> |
---|
258 | </xsl:choose> |
---|
259 | </xsl:for-each> |
---|
260 | </xsl:copy> |
---|
261 | <xsl:apply-templates mode="remove-ids"/> |
---|
262 | </xsl:otherwise> |
---|
263 | </xsl:choose> |
---|
264 | </xsl:when> |
---|
265 | <xsl:otherwise> |
---|
266 | <xsl:copy> |
---|
267 | <xsl:for-each select="@*"> |
---|
268 | <xsl:choose> |
---|
269 | <xsl:when test="local-name(.) != 'id'"> |
---|
270 | <xsl:copy/> |
---|
271 | </xsl:when> |
---|
272 | <xsl:otherwise> |
---|
273 | <xsl:message>removing <xsl:value-of select="local-name(.)"/></xsl:message> |
---|
274 | </xsl:otherwise> |
---|
275 | </xsl:choose> |
---|
276 | </xsl:for-each> |
---|
277 | <xsl:apply-templates mode="remove-ids"/> |
---|
278 | </xsl:copy> |
---|
279 | </xsl:otherwise> |
---|
280 | </xsl:choose> |
---|
281 | </xsl:template> |
---|
282 | |
---|
283 | <!-- ==================================================================== --> |
---|
284 | |
---|
285 | <xsl:template match="*" mode="xref-to-prefix"/> |
---|
286 | <xsl:template match="*" mode="xref-to-suffix"/> |
---|
287 | |
---|
288 | <xsl:template match="*" mode="xref-to"> |
---|
289 | <xsl:param name="referrer"/> |
---|
290 | <xsl:param name="xrefstyle"/> |
---|
291 | <xsl:param name="verbose" select="1"/> |
---|
292 | |
---|
293 | <xsl:if test="$verbose"> |
---|
294 | <xsl:message> |
---|
295 | <xsl:text>Don't know what gentext to create for xref to: "</xsl:text> |
---|
296 | <xsl:value-of select="name(.)"/> |
---|
297 | <xsl:text>", ("</xsl:text> |
---|
298 | <xsl:value-of select="(@id|@xml:id)[1]"/> |
---|
299 | <xsl:text>")</xsl:text> |
---|
300 | </xsl:message> |
---|
301 | </xsl:if> |
---|
302 | <xsl:text>???</xsl:text> |
---|
303 | </xsl:template> |
---|
304 | |
---|
305 | <xsl:template match="title" mode="xref-to"> |
---|
306 | <xsl:param name="referrer"/> |
---|
307 | <xsl:param name="xrefstyle"/> |
---|
308 | <xsl:param name="verbose" select="1"/> |
---|
309 | |
---|
310 | <!-- if you xref to a title, xref to the parent... --> |
---|
311 | <xsl:choose> |
---|
312 | <!-- FIXME: how reliable is this? --> |
---|
313 | <xsl:when test="contains(local-name(parent::*), 'info')"> |
---|
314 | <xsl:apply-templates select="parent::*[2]" mode="xref-to"> |
---|
315 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
316 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
317 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
318 | </xsl:apply-templates> |
---|
319 | </xsl:when> |
---|
320 | <xsl:otherwise> |
---|
321 | <xsl:apply-templates select="parent::*" mode="xref-to"> |
---|
322 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
323 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
324 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
325 | </xsl:apply-templates> |
---|
326 | </xsl:otherwise> |
---|
327 | </xsl:choose> |
---|
328 | </xsl:template> |
---|
329 | |
---|
330 | <xsl:template match="abstract|authorblurb|personblurb|bibliodiv|bibliomset |biblioset|blockquote|calloutlist|caution|colophon |constraintdef|formalpara|glossdiv|important|indexdiv |itemizedlist|legalnotice|lot|msg|msgexplan|msgmain |msgrel|msgset|msgsub|note|orderedlist|partintro |productionset|qandadiv|refsynopsisdiv|segmentedlist |set|setindex|sidebar|tip|toc|variablelist|warning" mode="xref-to"> |
---|
331 | <xsl:param name="referrer"/> |
---|
332 | <xsl:param name="xrefstyle"/> |
---|
333 | <xsl:param name="verbose" select="1"/> |
---|
334 | |
---|
335 | <!-- catch-all for things with (possibly optional) titles --> |
---|
336 | <xsl:apply-templates select="." mode="object.xref.markup"> |
---|
337 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
338 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
339 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
340 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
341 | </xsl:apply-templates> |
---|
342 | </xsl:template> |
---|
343 | |
---|
344 | <xsl:template match="author|editor|othercredit|personname" mode="xref-to"> |
---|
345 | <xsl:param name="referrer"/> |
---|
346 | <xsl:param name="xrefstyle"/> |
---|
347 | |
---|
348 | <xsl:call-template name="person.name"/> |
---|
349 | </xsl:template> |
---|
350 | |
---|
351 | <xsl:template match="authorgroup" mode="xref-to"> |
---|
352 | <xsl:param name="referrer"/> |
---|
353 | <xsl:param name="xrefstyle"/> |
---|
354 | |
---|
355 | <xsl:call-template name="person.name.list"/> |
---|
356 | </xsl:template> |
---|
357 | |
---|
358 | <xsl:template match="figure|example|table|equation" mode="xref-to"> |
---|
359 | <xsl:param name="referrer"/> |
---|
360 | <xsl:param name="xrefstyle"/> |
---|
361 | <xsl:param name="verbose" select="1"/> |
---|
362 | |
---|
363 | <xsl:apply-templates select="." mode="object.xref.markup"> |
---|
364 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
365 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
366 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
367 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
368 | </xsl:apply-templates> |
---|
369 | </xsl:template> |
---|
370 | |
---|
371 | <xsl:template match="procedure" mode="xref-to"> |
---|
372 | <xsl:param name="referrer"/> |
---|
373 | <xsl:param name="xrefstyle"/> |
---|
374 | <xsl:param name="verbose"/> |
---|
375 | |
---|
376 | <xsl:apply-templates select="." mode="object.xref.markup"> |
---|
377 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
378 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
379 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
380 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
381 | </xsl:apply-templates> |
---|
382 | </xsl:template> |
---|
383 | |
---|
384 | <xsl:template match="task" mode="xref-to"> |
---|
385 | <xsl:param name="referrer"/> |
---|
386 | <xsl:param name="xrefstyle"/> |
---|
387 | <xsl:param name="verbose"/> |
---|
388 | |
---|
389 | <xsl:apply-templates select="." mode="object.xref.markup"> |
---|
390 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
391 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
392 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
393 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
394 | </xsl:apply-templates> |
---|
395 | </xsl:template> |
---|
396 | |
---|
397 | <xsl:template match="cmdsynopsis" mode="xref-to"> |
---|
398 | <xsl:apply-templates select="(.//command)[1]" mode="xref"/> |
---|
399 | </xsl:template> |
---|
400 | |
---|
401 | <xsl:template match="funcsynopsis" mode="xref-to"> |
---|
402 | <xsl:apply-templates select="(.//function)[1]" mode="xref"/> |
---|
403 | </xsl:template> |
---|
404 | |
---|
405 | <xsl:template match="dedication|preface|chapter|appendix|article" mode="xref-to"> |
---|
406 | <xsl:param name="referrer"/> |
---|
407 | <xsl:param name="xrefstyle"/> |
---|
408 | <xsl:param name="verbose" select="1"/> |
---|
409 | |
---|
410 | <xsl:apply-templates select="." mode="object.xref.markup"> |
---|
411 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
412 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
413 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
414 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
415 | </xsl:apply-templates> |
---|
416 | </xsl:template> |
---|
417 | |
---|
418 | <xsl:template match="bibliography" mode="xref-to"> |
---|
419 | <xsl:param name="referrer"/> |
---|
420 | <xsl:param name="xrefstyle"/> |
---|
421 | <xsl:param name="verbose" select="1"/> |
---|
422 | |
---|
423 | <xsl:apply-templates select="." mode="object.xref.markup"> |
---|
424 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
425 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
426 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
427 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
428 | </xsl:apply-templates> |
---|
429 | </xsl:template> |
---|
430 | |
---|
431 | <xsl:template match="biblioentry|bibliomixed" mode="xref-to-prefix"> |
---|
432 | <xsl:text>[</xsl:text> |
---|
433 | </xsl:template> |
---|
434 | |
---|
435 | <xsl:template match="biblioentry|bibliomixed" mode="xref-to-suffix"> |
---|
436 | <xsl:text>]</xsl:text> |
---|
437 | </xsl:template> |
---|
438 | |
---|
439 | <xsl:template match="biblioentry|bibliomixed" mode="xref-to"> |
---|
440 | <xsl:param name="referrer"/> |
---|
441 | <xsl:param name="xrefstyle"/> |
---|
442 | <xsl:param name="verbose" select="1"/> |
---|
443 | |
---|
444 | <!-- handles both biblioentry and bibliomixed --> |
---|
445 | <xsl:choose> |
---|
446 | <xsl:when test="string(.) = ''"> |
---|
447 | <xsl:variable name="bib" select="document($bibliography.collection,.)"/> |
---|
448 | <xsl:variable name="id" select="(@id|@xml:id)[1]"/> |
---|
449 | <xsl:variable name="entry" select="$bib/bibliography/ *[@id=$id or @xml:id=$id][1]"/> |
---|
450 | <xsl:choose> |
---|
451 | <xsl:when test="$entry"> |
---|
452 | <xsl:choose> |
---|
453 | <xsl:when test="$bibliography.numbered != 0"> |
---|
454 | <xsl:number from="bibliography" count="biblioentry|bibliomixed" level="any" format="1"/> |
---|
455 | </xsl:when> |
---|
456 | <xsl:when test="local-name($entry/*[1]) = 'abbrev'"> |
---|
457 | <xsl:apply-templates select="$entry/*[1]"/> |
---|
458 | </xsl:when> |
---|
459 | <xsl:otherwise> |
---|
460 | <xsl:value-of select="(@id|@xml:id)[1]"/> |
---|
461 | </xsl:otherwise> |
---|
462 | </xsl:choose> |
---|
463 | </xsl:when> |
---|
464 | <xsl:otherwise> |
---|
465 | <xsl:message> |
---|
466 | <xsl:text>No bibliography entry: </xsl:text> |
---|
467 | <xsl:value-of select="$id"/> |
---|
468 | <xsl:text> found in </xsl:text> |
---|
469 | <xsl:value-of select="$bibliography.collection"/> |
---|
470 | </xsl:message> |
---|
471 | <xsl:value-of select="(@id|@xml:id)[1]"/> |
---|
472 | </xsl:otherwise> |
---|
473 | </xsl:choose> |
---|
474 | </xsl:when> |
---|
475 | <xsl:otherwise> |
---|
476 | <xsl:choose> |
---|
477 | <xsl:when test="$bibliography.numbered != 0"> |
---|
478 | <xsl:number from="bibliography" count="biblioentry|bibliomixed" level="any" format="1"/> |
---|
479 | </xsl:when> |
---|
480 | <xsl:when test="local-name(*[1]) = 'abbrev'"> |
---|
481 | <xsl:apply-templates select="*[1]"/> |
---|
482 | </xsl:when> |
---|
483 | <xsl:otherwise> |
---|
484 | <xsl:value-of select="(@id|@xml:id)[1]"/> |
---|
485 | </xsl:otherwise> |
---|
486 | </xsl:choose> |
---|
487 | </xsl:otherwise> |
---|
488 | </xsl:choose> |
---|
489 | </xsl:template> |
---|
490 | |
---|
491 | <xsl:template match="glossary" mode="xref-to"> |
---|
492 | <xsl:param name="referrer"/> |
---|
493 | <xsl:param name="xrefstyle"/> |
---|
494 | <xsl:param name="verbose" select="1"/> |
---|
495 | |
---|
496 | <xsl:apply-templates select="." mode="object.xref.markup"> |
---|
497 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
498 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
499 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
500 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
501 | </xsl:apply-templates> |
---|
502 | </xsl:template> |
---|
503 | |
---|
504 | <xsl:template match="glossentry" mode="xref-to"> |
---|
505 | <xsl:param name="referrer"/> |
---|
506 | <xsl:param name="xrefstyle"/> |
---|
507 | <xsl:param name="verbose" select="1"/> |
---|
508 | <xsl:choose> |
---|
509 | <xsl:when test="$glossentry.show.acronym = 'primary'"> |
---|
510 | <xsl:choose> |
---|
511 | <xsl:when test="acronym|abbrev"> |
---|
512 | <xsl:apply-templates select="(acronym|abbrev)[1]"/> |
---|
513 | </xsl:when> |
---|
514 | <xsl:otherwise> |
---|
515 | <xsl:apply-templates select="glossterm[1]" mode="xref-to"> |
---|
516 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
517 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
518 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
519 | </xsl:apply-templates> |
---|
520 | </xsl:otherwise> |
---|
521 | </xsl:choose> |
---|
522 | </xsl:when> |
---|
523 | <xsl:otherwise> |
---|
524 | <xsl:apply-templates select="glossterm[1]" mode="xref-to"> |
---|
525 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
526 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
527 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
528 | </xsl:apply-templates> |
---|
529 | </xsl:otherwise> |
---|
530 | </xsl:choose> |
---|
531 | </xsl:template> |
---|
532 | |
---|
533 | <xsl:template match="glossterm" mode="xref-to"> |
---|
534 | <xsl:apply-templates/> |
---|
535 | </xsl:template> |
---|
536 | |
---|
537 | <xsl:template match="index" mode="xref-to"> |
---|
538 | <xsl:param name="referrer"/> |
---|
539 | <xsl:param name="xrefstyle"/> |
---|
540 | <xsl:param name="verbose" select="1"/> |
---|
541 | |
---|
542 | <xsl:apply-templates select="." mode="object.xref.markup"> |
---|
543 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
544 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
545 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
546 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
547 | </xsl:apply-templates> |
---|
548 | </xsl:template> |
---|
549 | |
---|
550 | <xsl:template match="listitem" mode="xref-to"> |
---|
551 | <xsl:param name="referrer"/> |
---|
552 | <xsl:param name="xrefstyle"/> |
---|
553 | <xsl:param name="verbose"/> |
---|
554 | |
---|
555 | <xsl:apply-templates select="." mode="object.xref.markup"> |
---|
556 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
557 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
558 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
559 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
560 | </xsl:apply-templates> |
---|
561 | </xsl:template> |
---|
562 | |
---|
563 | <xsl:template match="section|simplesect |sect1|sect2|sect3|sect4|sect5 |refsect1|refsect2|refsect3|refsection" mode="xref-to"> |
---|
564 | <xsl:param name="referrer"/> |
---|
565 | <xsl:param name="xrefstyle"/> |
---|
566 | <xsl:param name="verbose" select="1"/> |
---|
567 | |
---|
568 | <xsl:apply-templates select="." mode="object.xref.markup"> |
---|
569 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
570 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
571 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
572 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
573 | </xsl:apply-templates> |
---|
574 | <!-- FIXME: What about "in Chapter X"? --> |
---|
575 | </xsl:template> |
---|
576 | |
---|
577 | <xsl:template match="bridgehead" mode="xref-to"> |
---|
578 | <xsl:param name="referrer"/> |
---|
579 | <xsl:param name="xrefstyle"/> |
---|
580 | <xsl:param name="verbose" select="1"/> |
---|
581 | |
---|
582 | <xsl:apply-templates select="." mode="object.xref.markup"> |
---|
583 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
584 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
585 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
586 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
587 | </xsl:apply-templates> |
---|
588 | <!-- FIXME: What about "in Chapter X"? --> |
---|
589 | </xsl:template> |
---|
590 | |
---|
591 | <xsl:template match="qandaset" mode="xref-to"> |
---|
592 | <xsl:param name="referrer"/> |
---|
593 | <xsl:param name="xrefstyle"/> |
---|
594 | <xsl:param name="verbose" select="1"/> |
---|
595 | |
---|
596 | <xsl:apply-templates select="." mode="object.xref.markup"> |
---|
597 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
598 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
599 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
600 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
601 | </xsl:apply-templates> |
---|
602 | </xsl:template> |
---|
603 | |
---|
604 | <xsl:template match="qandadiv" mode="xref-to"> |
---|
605 | <xsl:param name="referrer"/> |
---|
606 | <xsl:param name="xrefstyle"/> |
---|
607 | <xsl:param name="verbose" select="1"/> |
---|
608 | |
---|
609 | <xsl:apply-templates select="." mode="object.xref.markup"> |
---|
610 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
611 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
612 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
613 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
614 | </xsl:apply-templates> |
---|
615 | </xsl:template> |
---|
616 | |
---|
617 | <xsl:template match="qandaentry" mode="xref-to"> |
---|
618 | <xsl:param name="referrer"/> |
---|
619 | <xsl:param name="xrefstyle"/> |
---|
620 | <xsl:param name="verbose" select="1"/> |
---|
621 | |
---|
622 | <xsl:apply-templates select="question[1]" mode="object.xref.markup"> |
---|
623 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
624 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
625 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
626 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
627 | </xsl:apply-templates> |
---|
628 | </xsl:template> |
---|
629 | |
---|
630 | <xsl:template match="question|answer" mode="xref-to"> |
---|
631 | <xsl:param name="referrer"/> |
---|
632 | <xsl:param name="xrefstyle"/> |
---|
633 | <xsl:param name="verbose" select="1"/> |
---|
634 | |
---|
635 | <xsl:apply-templates select="." mode="object.xref.markup"> |
---|
636 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
637 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
638 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
639 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
640 | </xsl:apply-templates> |
---|
641 | </xsl:template> |
---|
642 | |
---|
643 | <xsl:template match="part|reference" mode="xref-to"> |
---|
644 | <xsl:param name="referrer"/> |
---|
645 | <xsl:param name="xrefstyle"/> |
---|
646 | <xsl:param name="verbose" select="1"/> |
---|
647 | |
---|
648 | <xsl:apply-templates select="." mode="object.xref.markup"> |
---|
649 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
650 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
651 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
652 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
653 | </xsl:apply-templates> |
---|
654 | </xsl:template> |
---|
655 | |
---|
656 | <xsl:template match="refentry" mode="xref-to"> |
---|
657 | <xsl:param name="referrer"/> |
---|
658 | <xsl:param name="xrefstyle"/> |
---|
659 | |
---|
660 | <xsl:choose> |
---|
661 | <xsl:when test="refmeta/refentrytitle"> |
---|
662 | <xsl:apply-templates select="refmeta/refentrytitle"/> |
---|
663 | </xsl:when> |
---|
664 | <xsl:otherwise> |
---|
665 | <xsl:apply-templates select="refnamediv/refname[1]"/> |
---|
666 | </xsl:otherwise> |
---|
667 | </xsl:choose> |
---|
668 | <xsl:apply-templates select="refmeta/manvolnum"/> |
---|
669 | </xsl:template> |
---|
670 | |
---|
671 | <xsl:template match="refnamediv" mode="xref-to"> |
---|
672 | <xsl:param name="referrer"/> |
---|
673 | <xsl:param name="xrefstyle"/> |
---|
674 | <xsl:param name="verbose" select="1"/> |
---|
675 | |
---|
676 | <xsl:apply-templates select="refname[1]" mode="xref-to"> |
---|
677 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
678 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
679 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
680 | </xsl:apply-templates> |
---|
681 | </xsl:template> |
---|
682 | |
---|
683 | <xsl:template match="refname" mode="xref-to"> |
---|
684 | <xsl:param name="referrer"/> |
---|
685 | <xsl:param name="xrefstyle"/> |
---|
686 | <xsl:param name="verbose" select="1"/> |
---|
687 | |
---|
688 | <xsl:apply-templates mode="xref-to"/> |
---|
689 | </xsl:template> |
---|
690 | |
---|
691 | <xsl:template match="step" mode="xref-to"> |
---|
692 | <xsl:param name="referrer"/> |
---|
693 | <xsl:param name="xrefstyle"/> |
---|
694 | |
---|
695 | <xsl:call-template name="gentext"> |
---|
696 | <xsl:with-param name="key" select="'Step'"/> |
---|
697 | </xsl:call-template> |
---|
698 | <xsl:text> </xsl:text> |
---|
699 | <xsl:apply-templates select="." mode="number"/> |
---|
700 | </xsl:template> |
---|
701 | |
---|
702 | <xsl:template match="varlistentry" mode="xref-to"> |
---|
703 | <xsl:param name="referrer"/> |
---|
704 | <xsl:param name="xrefstyle"/> |
---|
705 | <xsl:param name="verbose" select="1"/> |
---|
706 | |
---|
707 | <xsl:apply-templates select="term[1]" mode="xref-to"> |
---|
708 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
709 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
710 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
711 | </xsl:apply-templates> |
---|
712 | </xsl:template> |
---|
713 | |
---|
714 | <xsl:template match="varlistentry/term" mode="xref-to"> |
---|
715 | <xsl:param name="referrer"/> |
---|
716 | <xsl:param name="xrefstyle"/> |
---|
717 | |
---|
718 | <!-- to avoid the comma that will be generated if there are several terms --> |
---|
719 | <xsl:apply-templates/> |
---|
720 | </xsl:template> |
---|
721 | |
---|
722 | <xsl:template match="co" mode="xref-to"> |
---|
723 | <xsl:param name="referrer"/> |
---|
724 | <xsl:param name="xrefstyle"/> |
---|
725 | |
---|
726 | <xsl:apply-templates select="." mode="callout-bug"/> |
---|
727 | </xsl:template> |
---|
728 | |
---|
729 | <xsl:template match="area|areaset" mode="xref-to"> |
---|
730 | <xsl:param name="referrer"/> |
---|
731 | <xsl:param name="xrefstyle"/> |
---|
732 | |
---|
733 | <xsl:call-template name="callout-bug"> |
---|
734 | <xsl:with-param name="conum"> |
---|
735 | <xsl:apply-templates select="." mode="conumber"/> |
---|
736 | </xsl:with-param> |
---|
737 | </xsl:call-template> |
---|
738 | </xsl:template> |
---|
739 | |
---|
740 | <xsl:template match="book" mode="xref-to"> |
---|
741 | <xsl:param name="referrer"/> |
---|
742 | <xsl:param name="xrefstyle"/> |
---|
743 | <xsl:param name="verbose" select="1"/> |
---|
744 | |
---|
745 | <xsl:apply-templates select="." mode="object.xref.markup"> |
---|
746 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
747 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
748 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
749 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
750 | </xsl:apply-templates> |
---|
751 | </xsl:template> |
---|
752 | |
---|
753 | <xsl:template match="para" mode="xref-to"> |
---|
754 | <xsl:param name="referrer"/> |
---|
755 | <xsl:param name="xrefstyle"/> |
---|
756 | <xsl:param name="verbose" select="1"/> |
---|
757 | |
---|
758 | <xsl:variable name="context" select="(ancestor::simplesect |ancestor::section |ancestor::sect1 |ancestor::sect2 |ancestor::sect3 |ancestor::sect4 |ancestor::sect5 |ancestor::refsection |ancestor::refsect1 |ancestor::refsect2 |ancestor::refsect3 |ancestor::chapter |ancestor::appendix |ancestor::preface |ancestor::partintro |ancestor::dedication |ancestor::colophon |ancestor::bibliography |ancestor::index |ancestor::glossary |ancestor::glossentry |ancestor::listitem |ancestor::varlistentry)[last()]"/> |
---|
759 | |
---|
760 | <xsl:apply-templates select="$context" mode="xref-to"> |
---|
761 | <xsl:with-param name="purpose" select="'xref'"/> |
---|
762 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/> |
---|
763 | <xsl:with-param name="referrer" select="$referrer"/> |
---|
764 | <xsl:with-param name="verbose" select="$verbose"/> |
---|
765 | </xsl:apply-templates> |
---|
766 | </xsl:template> |
---|
767 | |
---|
768 | <!-- ==================================================================== --> |
---|
769 | |
---|
770 | <xsl:template match="*" mode="xref-title"> |
---|
771 | <xsl:variable name="title"> |
---|
772 | <xsl:apply-templates select="." mode="object.title.markup"/> |
---|
773 | </xsl:variable> |
---|
774 | |
---|
775 | <xsl:value-of select="$title"/> |
---|
776 | </xsl:template> |
---|
777 | |
---|
778 | <xsl:template match="author" mode="xref-title"> |
---|
779 | <xsl:variable name="title"> |
---|
780 | <xsl:call-template name="person.name"/> |
---|
781 | </xsl:variable> |
---|
782 | |
---|
783 | <xsl:value-of select="$title"/> |
---|
784 | </xsl:template> |
---|
785 | |
---|
786 | <xsl:template match="authorgroup" mode="xref-title"> |
---|
787 | <xsl:variable name="title"> |
---|
788 | <xsl:call-template name="person.name.list"/> |
---|
789 | </xsl:variable> |
---|
790 | |
---|
791 | <xsl:value-of select="$title"/> |
---|
792 | </xsl:template> |
---|
793 | |
---|
794 | <xsl:template match="cmdsynopsis" mode="xref-title"> |
---|
795 | <xsl:variable name="title"> |
---|
796 | <xsl:apply-templates select="(.//command)[1]" mode="xref"/> |
---|
797 | </xsl:variable> |
---|
798 | |
---|
799 | <xsl:value-of select="$title"/> |
---|
800 | </xsl:template> |
---|
801 | |
---|
802 | <xsl:template match="funcsynopsis" mode="xref-title"> |
---|
803 | <xsl:variable name="title"> |
---|
804 | <xsl:apply-templates select="(.//function)[1]" mode="xref"/> |
---|
805 | </xsl:variable> |
---|
806 | |
---|
807 | <xsl:value-of select="$title"/> |
---|
808 | </xsl:template> |
---|
809 | |
---|
810 | <xsl:template match="biblioentry|bibliomixed" mode="xref-title"> |
---|
811 | <!-- handles both biblioentry and bibliomixed --> |
---|
812 | <xsl:variable name="title"> |
---|
813 | <xsl:text>[</xsl:text> |
---|
814 | <xsl:choose> |
---|
815 | <xsl:when test="local-name(*[1]) = 'abbrev'"> |
---|
816 | <xsl:apply-templates select="*[1]"/> |
---|
817 | </xsl:when> |
---|
818 | <xsl:otherwise> |
---|
819 | <xsl:value-of select="(@id|@xml:id)[1]"/> |
---|
820 | </xsl:otherwise> |
---|
821 | </xsl:choose> |
---|
822 | <xsl:text>]</xsl:text> |
---|
823 | </xsl:variable> |
---|
824 | |
---|
825 | <xsl:value-of select="$title"/> |
---|
826 | </xsl:template> |
---|
827 | |
---|
828 | <xsl:template match="step" mode="xref-title"> |
---|
829 | <xsl:call-template name="gentext"> |
---|
830 | <xsl:with-param name="key" select="'Step'"/> |
---|
831 | </xsl:call-template> |
---|
832 | <xsl:text> </xsl:text> |
---|
833 | <xsl:apply-templates select="." mode="number"/> |
---|
834 | </xsl:template> |
---|
835 | |
---|
836 | <xsl:template match="step[not(./title)]" mode="title.markup"> |
---|
837 | <xsl:call-template name="gentext"> |
---|
838 | <xsl:with-param name="key" select="'Step'"/> |
---|
839 | </xsl:call-template> |
---|
840 | <xsl:text> </xsl:text> |
---|
841 | <xsl:apply-templates select="." mode="number"/> |
---|
842 | </xsl:template> |
---|
843 | |
---|
844 | <xsl:template match="co" mode="xref-title"> |
---|
845 | <xsl:variable name="title"> |
---|
846 | <xsl:apply-templates select="." mode="callout-bug"/> |
---|
847 | </xsl:variable> |
---|
848 | |
---|
849 | <xsl:value-of select="$title"/> |
---|
850 | </xsl:template> |
---|
851 | |
---|
852 | <!-- ==================================================================== --> |
---|
853 | |
---|
854 | <xsl:template match="link" name="link"> |
---|
855 | <xsl:param name="linkend" select="@linkend"/> |
---|
856 | <xsl:param name="a.target"/> |
---|
857 | |
---|
858 | <xsl:variable name="content"> |
---|
859 | <xsl:call-template name="anchor"/> |
---|
860 | <xsl:choose> |
---|
861 | <xsl:when test="count(child::node()) > 0"> |
---|
862 | <!-- If it has content, use it --> |
---|
863 | <xsl:apply-templates/> |
---|
864 | </xsl:when> |
---|
865 | <!-- else look for an endterm --> |
---|
866 | <xsl:when test="@endterm"> |
---|
867 | <xsl:variable name="etargets" select="key('id',@endterm)"/> |
---|
868 | <xsl:variable name="etarget" select="$etargets[1]"/> |
---|
869 | <xsl:choose> |
---|
870 | <xsl:when test="count($etarget) = 0"> |
---|
871 | <xsl:message> |
---|
872 | <xsl:value-of select="count($etargets)"/> |
---|
873 | <xsl:text>Endterm points to nonexistent ID: </xsl:text> |
---|
874 | <xsl:value-of select="@endterm"/> |
---|
875 | </xsl:message> |
---|
876 | <xsl:text>???</xsl:text> |
---|
877 | </xsl:when> |
---|
878 | <xsl:otherwise> |
---|
879 | <xsl:apply-templates select="$etarget" mode="endterm"/> |
---|
880 | </xsl:otherwise> |
---|
881 | </xsl:choose> |
---|
882 | </xsl:when> |
---|
883 | <!-- Use the xlink:href if no other text --> |
---|
884 | <xsl:when test="@xlink:href"> |
---|
885 | <xsl:value-of select="@xlink:href"/> |
---|
886 | </xsl:when> |
---|
887 | <xsl:otherwise> |
---|
888 | <xsl:message> |
---|
889 | <xsl:text>Link element has no content and no Endterm. </xsl:text> |
---|
890 | <xsl:text>Nothing to show in the link to </xsl:text> |
---|
891 | <xsl:value-of select="(@xlink:href|@linkend)[1]"/> |
---|
892 | </xsl:message> |
---|
893 | <xsl:text>???</xsl:text> |
---|
894 | </xsl:otherwise> |
---|
895 | </xsl:choose> |
---|
896 | </xsl:variable> |
---|
897 | |
---|
898 | <xsl:call-template name="simple.xlink"> |
---|
899 | <xsl:with-param name="node" select="."/> |
---|
900 | <xsl:with-param name="linkend" select="$linkend"/> |
---|
901 | <xsl:with-param name="content" select="$content"/> |
---|
902 | <xsl:with-param name="a.target" select="$a.target"/> |
---|
903 | </xsl:call-template> |
---|
904 | |
---|
905 | </xsl:template> |
---|
906 | |
---|
907 | <xsl:template match="ulink" name="ulink"> |
---|
908 | <xsl:param name="url" select="@url"/> |
---|
909 | <xsl:variable name="link"> |
---|
910 | <a> |
---|
911 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
912 | <xsl:if test="@id or @xml:id"> |
---|
913 | <xsl:attribute name="id"> |
---|
914 | <xsl:value-of select="(@id|@xml:id)[1]"/> |
---|
915 | </xsl:attribute> |
---|
916 | </xsl:if> |
---|
917 | <xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute> |
---|
918 | <xsl:if test="$ulink.target != ''"> |
---|
919 | <xsl:attribute name="target"> |
---|
920 | <xsl:value-of select="$ulink.target"/> |
---|
921 | </xsl:attribute> |
---|
922 | </xsl:if> |
---|
923 | <xsl:choose> |
---|
924 | <xsl:when test="count(child::node())=0"> |
---|
925 | <xsl:value-of select="$url"/> |
---|
926 | </xsl:when> |
---|
927 | <xsl:otherwise> |
---|
928 | <xsl:apply-templates/> |
---|
929 | </xsl:otherwise> |
---|
930 | </xsl:choose> |
---|
931 | </a> |
---|
932 | </xsl:variable> |
---|
933 | |
---|
934 | <xsl:choose> |
---|
935 | <xsl:when test="function-available('suwl:unwrapLinks')"> |
---|
936 | <xsl:copy-of select="suwl:unwrapLinks($link)"/> |
---|
937 | </xsl:when> |
---|
938 | <xsl:otherwise> |
---|
939 | <xsl:copy-of select="$link"/> |
---|
940 | </xsl:otherwise> |
---|
941 | </xsl:choose> |
---|
942 | </xsl:template> |
---|
943 | |
---|
944 | <xsl:template match="olink" name="olink"> |
---|
945 | <!-- olink content may be passed in from xlink olink --> |
---|
946 | <xsl:param name="content" select="NOTANELEMENT"/> |
---|
947 | |
---|
948 | <xsl:call-template name="anchor"/> |
---|
949 | |
---|
950 | <xsl:variable name="localinfo" select="@localinfo"/> |
---|
951 | |
---|
952 | <xsl:choose> |
---|
953 | <!-- olinks resolved by stylesheet and target database --> |
---|
954 | <xsl:when test="@targetdoc or @targetptr or (@xlink:role=$xolink.role and contains(@xlink:href, '#') )"> |
---|
955 | |
---|
956 | <xsl:variable name="targetdoc.att"> |
---|
957 | <xsl:choose> |
---|
958 | <xsl:when test="@targetdoc != ''"> |
---|
959 | <xsl:value-of select="@targetdoc"/> |
---|
960 | </xsl:when> |
---|
961 | <xsl:when test="@xlink:role=$xolink.role and contains(@xlink:href, '#')"> |
---|
962 | <xsl:value-of select="substring-before(@xlink:href, '#')"/> |
---|
963 | </xsl:when> |
---|
964 | </xsl:choose> |
---|
965 | </xsl:variable> |
---|
966 | |
---|
967 | <xsl:variable name="targetptr.att"> |
---|
968 | <xsl:choose> |
---|
969 | <xsl:when test="@targetptr != ''"> |
---|
970 | <xsl:value-of select="@targetptr"/> |
---|
971 | </xsl:when> |
---|
972 | <xsl:when test="@xlink:role=$xolink.role and contains(@xlink:href, '#')"> |
---|
973 | <xsl:value-of select="substring-after(@xlink:href, '#')"/> |
---|
974 | </xsl:when> |
---|
975 | </xsl:choose> |
---|
976 | </xsl:variable> |
---|
977 | |
---|
978 | <xsl:variable name="olink.lang"> |
---|
979 | <xsl:call-template name="l10n.language"> |
---|
980 | <xsl:with-param name="xref-context" select="true()"/> |
---|
981 | </xsl:call-template> |
---|
982 | </xsl:variable> |
---|
983 | |
---|
984 | <xsl:variable name="target.database.filename"> |
---|
985 | <xsl:call-template name="select.target.database"> |
---|
986 | <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/> |
---|
987 | <xsl:with-param name="targetptr.att" select="$targetptr.att"/> |
---|
988 | <xsl:with-param name="olink.lang" select="$olink.lang"/> |
---|
989 | </xsl:call-template> |
---|
990 | </xsl:variable> |
---|
991 | |
---|
992 | <xsl:variable name="target.database" select="document($target.database.filename,/)"/> |
---|
993 | |
---|
994 | <xsl:if test="$olink.debug != 0"> |
---|
995 | <xsl:message> |
---|
996 | <xsl:text>Olink debug: root element of target.database '</xsl:text> |
---|
997 | <xsl:value-of select="$target.database.filename"/> |
---|
998 | <xsl:text>' is '</xsl:text> |
---|
999 | <xsl:value-of select="local-name($target.database/*[1])"/> |
---|
1000 | <xsl:text>'.</xsl:text> |
---|
1001 | </xsl:message> |
---|
1002 | </xsl:if> |
---|
1003 | |
---|
1004 | <xsl:variable name="olink.key"> |
---|
1005 | <xsl:call-template name="select.olink.key"> |
---|
1006 | <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/> |
---|
1007 | <xsl:with-param name="targetptr.att" select="$targetptr.att"/> |
---|
1008 | <xsl:with-param name="olink.lang" select="$olink.lang"/> |
---|
1009 | <xsl:with-param name="target.database" select="$target.database"/> |
---|
1010 | </xsl:call-template> |
---|
1011 | </xsl:variable> |
---|
1012 | |
---|
1013 | <xsl:if test="string-length($olink.key) = 0"> |
---|
1014 | <xsl:message> |
---|
1015 | <xsl:text>Error: unresolved olink: </xsl:text> |
---|
1016 | <xsl:text>targetdoc/targetptr = '</xsl:text> |
---|
1017 | <xsl:value-of select="$targetdoc.att"/> |
---|
1018 | <xsl:text>/</xsl:text> |
---|
1019 | <xsl:value-of select="$targetptr.att"/> |
---|
1020 | <xsl:text>'.</xsl:text> |
---|
1021 | </xsl:message> |
---|
1022 | </xsl:if> |
---|
1023 | |
---|
1024 | <xsl:variable name="href"> |
---|
1025 | <xsl:call-template name="make.olink.href"> |
---|
1026 | <xsl:with-param name="olink.key" select="$olink.key"/> |
---|
1027 | <xsl:with-param name="target.database" select="$target.database"/> |
---|
1028 | </xsl:call-template> |
---|
1029 | </xsl:variable> |
---|
1030 | |
---|
1031 | <xsl:variable name="hottext"> |
---|
1032 | <xsl:choose> |
---|
1033 | <xsl:when test="$content"> |
---|
1034 | <xsl:copy-of select="$content"/> |
---|
1035 | </xsl:when> |
---|
1036 | <xsl:otherwise> |
---|
1037 | <xsl:call-template name="olink.hottext"> |
---|
1038 | <xsl:with-param name="olink.key" select="$olink.key"/> |
---|
1039 | <xsl:with-param name="olink.lang" select="$olink.lang"/> |
---|
1040 | <xsl:with-param name="target.database" select="$target.database"/> |
---|
1041 | </xsl:call-template> |
---|
1042 | </xsl:otherwise> |
---|
1043 | </xsl:choose> |
---|
1044 | </xsl:variable> |
---|
1045 | |
---|
1046 | <xsl:variable name="olink.docname.citation"> |
---|
1047 | <xsl:call-template name="olink.document.citation"> |
---|
1048 | <xsl:with-param name="olink.key" select="$olink.key"/> |
---|
1049 | <xsl:with-param name="target.database" select="$target.database"/> |
---|
1050 | <xsl:with-param name="olink.lang" select="$olink.lang"/> |
---|
1051 | </xsl:call-template> |
---|
1052 | </xsl:variable> |
---|
1053 | |
---|
1054 | <xsl:variable name="olink.page.citation"> |
---|
1055 | <xsl:call-template name="olink.page.citation"> |
---|
1056 | <xsl:with-param name="olink.key" select="$olink.key"/> |
---|
1057 | <xsl:with-param name="target.database" select="$target.database"/> |
---|
1058 | <xsl:with-param name="olink.lang" select="$olink.lang"/> |
---|
1059 | </xsl:call-template> |
---|
1060 | </xsl:variable> |
---|
1061 | |
---|
1062 | <xsl:choose> |
---|
1063 | <xsl:when test="$href != ''"> |
---|
1064 | <a href="{$href}"> |
---|
1065 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
1066 | <xsl:copy-of select="$hottext"/> |
---|
1067 | </a> |
---|
1068 | <xsl:copy-of select="$olink.page.citation"/> |
---|
1069 | <xsl:copy-of select="$olink.docname.citation"/> |
---|
1070 | </xsl:when> |
---|
1071 | <xsl:otherwise> |
---|
1072 | <span class="olink"><xsl:copy-of select="$hottext"/></span> |
---|
1073 | <xsl:copy-of select="$olink.page.citation"/> |
---|
1074 | <xsl:copy-of select="$olink.docname.citation"/> |
---|
1075 | </xsl:otherwise> |
---|
1076 | </xsl:choose> |
---|
1077 | |
---|
1078 | </xsl:when> |
---|
1079 | |
---|
1080 | <!-- Or use old olink mechanism --> |
---|
1081 | <xsl:otherwise> |
---|
1082 | <xsl:variable name="href"> |
---|
1083 | <xsl:choose> |
---|
1084 | <xsl:when test="@linkmode"> |
---|
1085 | <!-- use the linkmode to get the base URI, use localinfo as fragid --> |
---|
1086 | <xsl:variable name="modespec" select="key('id',@linkmode)"/> |
---|
1087 | <xsl:if test="count($modespec) != 1 or local-name($modespec) != 'modespec'"> |
---|
1088 | <xsl:message>Warning: olink linkmode pointer is wrong.</xsl:message> |
---|
1089 | </xsl:if> |
---|
1090 | <xsl:value-of select="$modespec"/> |
---|
1091 | <xsl:if test="@localinfo"> |
---|
1092 | <xsl:text>#</xsl:text> |
---|
1093 | <xsl:value-of select="@localinfo"/> |
---|
1094 | </xsl:if> |
---|
1095 | </xsl:when> |
---|
1096 | <xsl:when test="@type = 'href'"> |
---|
1097 | <xsl:call-template name="olink.outline"> |
---|
1098 | <xsl:with-param name="outline.base.uri" select="unparsed-entity-uri(@targetdocent)"/> |
---|
1099 | <xsl:with-param name="localinfo" select="@localinfo"/> |
---|
1100 | <xsl:with-param name="return" select="'href'"/> |
---|
1101 | </xsl:call-template> |
---|
1102 | </xsl:when> |
---|
1103 | <xsl:otherwise> |
---|
1104 | <xsl:value-of select="$olink.resolver"/> |
---|
1105 | <xsl:text>?</xsl:text> |
---|
1106 | <xsl:value-of select="$olink.sysid"/> |
---|
1107 | <xsl:value-of select="unparsed-entity-uri(@targetdocent)"/> |
---|
1108 | <!-- XSL gives no access to the public identifier (grumble...) --> |
---|
1109 | <xsl:if test="@localinfo"> |
---|
1110 | <xsl:text>&</xsl:text> |
---|
1111 | <xsl:value-of select="$olink.fragid"/> |
---|
1112 | <xsl:value-of select="@localinfo"/> |
---|
1113 | </xsl:if> |
---|
1114 | </xsl:otherwise> |
---|
1115 | </xsl:choose> |
---|
1116 | </xsl:variable> |
---|
1117 | |
---|
1118 | <xsl:choose> |
---|
1119 | <xsl:when test="$href != ''"> |
---|
1120 | <a href="{$href}"> |
---|
1121 | <xsl:apply-templates select="." mode="class.attribute"/> |
---|
1122 | <xsl:call-template name="olink.hottext"/> |
---|
1123 | </a> |
---|
1124 | </xsl:when> |
---|
1125 | <xsl:otherwise> |
---|
1126 | <xsl:call-template name="olink.hottext"/> |
---|
1127 | </xsl:otherwise> |
---|
1128 | </xsl:choose> |
---|
1129 | </xsl:otherwise> |
---|
1130 | </xsl:choose> |
---|
1131 | </xsl:template> |
---|
1132 | |
---|
1133 | <xsl:template match="*" mode="pagenumber.markup"> |
---|
1134 | <!-- no-op in HTML --> |
---|
1135 | </xsl:template> |
---|
1136 | |
---|
1137 | |
---|
1138 | <xsl:template name="olink.outline"> |
---|
1139 | <xsl:param name="outline.base.uri"/> |
---|
1140 | <xsl:param name="localinfo"/> |
---|
1141 | <xsl:param name="return" select="href"/> |
---|
1142 | |
---|
1143 | <xsl:variable name="outline-file" select="concat($outline.base.uri, $olink.outline.ext)"/> |
---|
1144 | |
---|
1145 | <xsl:variable name="outline" select="document($outline-file,.)/div"/> |
---|
1146 | |
---|
1147 | <xsl:variable name="node-href"> |
---|
1148 | <xsl:choose> |
---|
1149 | <xsl:when test="$localinfo != ''"> |
---|
1150 | <xsl:variable name="node" select="$outline// *[@id=$localinfo or @xml:id=$localinfo]"/> |
---|
1151 | <xsl:value-of select="$node/@href"/> |
---|
1152 | </xsl:when> |
---|
1153 | <xsl:otherwise> |
---|
1154 | <xsl:value-of select="$outline/@href"/> |
---|
1155 | </xsl:otherwise> |
---|
1156 | </xsl:choose> |
---|
1157 | </xsl:variable> |
---|
1158 | |
---|
1159 | <xsl:variable name="node-xref"> |
---|
1160 | <xsl:choose> |
---|
1161 | <xsl:when test="$localinfo != ''"> |
---|
1162 | <xsl:variable name="node" select="$outline// *[@id=$localinfo or @xml:id=$localinfo]"/> |
---|
1163 | <xsl:copy-of select="$node/xref"/> |
---|
1164 | </xsl:when> |
---|
1165 | <xsl:otherwise> |
---|
1166 | <xsl:value-of select="$outline/xref"/> |
---|
1167 | </xsl:otherwise> |
---|
1168 | </xsl:choose> |
---|
1169 | </xsl:variable> |
---|
1170 | |
---|
1171 | <xsl:choose> |
---|
1172 | <xsl:when test="$return = 'href'"> |
---|
1173 | <xsl:value-of select="$node-href"/> |
---|
1174 | </xsl:when> |
---|
1175 | <xsl:when test="$return = 'xref'"> |
---|
1176 | <xsl:value-of select="$node-xref"/> |
---|
1177 | </xsl:when> |
---|
1178 | <xsl:otherwise> |
---|
1179 | <xsl:copy-of select="$node-xref"/> |
---|
1180 | </xsl:otherwise> |
---|
1181 | </xsl:choose> |
---|
1182 | </xsl:template> |
---|
1183 | |
---|
1184 | <!-- ==================================================================== --> |
---|
1185 | |
---|
1186 | <xsl:template name="xref.xreflabel"> |
---|
1187 | <!-- called to process an xreflabel...you might use this to make --> |
---|
1188 | <!-- xreflabels come out in the right font for different targets, --> |
---|
1189 | <!-- for example. --> |
---|
1190 | <xsl:param name="target" select="."/> |
---|
1191 | <xsl:value-of select="$target/@xreflabel"/> |
---|
1192 | </xsl:template> |
---|
1193 | |
---|
1194 | <!-- ==================================================================== --> |
---|
1195 | |
---|
1196 | <xsl:template match="title" mode="xref"> |
---|
1197 | <xsl:apply-templates/> |
---|
1198 | </xsl:template> |
---|
1199 | |
---|
1200 | <xsl:template match="command" mode="xref"> |
---|
1201 | <xsl:call-template name="inline.boldseq"/> |
---|
1202 | </xsl:template> |
---|
1203 | |
---|
1204 | <xsl:template match="function" mode="xref"> |
---|
1205 | <xsl:call-template name="inline.monoseq"/> |
---|
1206 | </xsl:template> |
---|
1207 | |
---|
1208 | <!-- ==================================================================== --> |
---|
1209 | |
---|
1210 | <xsl:template match="*" mode="insert.title.markup"> |
---|
1211 | <xsl:param name="purpose"/> |
---|
1212 | <xsl:param name="xrefstyle"/> |
---|
1213 | <xsl:param name="title"/> |
---|
1214 | |
---|
1215 | <xsl:choose> |
---|
1216 | <!-- FIXME: what about the case where titleabbrev is inside the info? --> |
---|
1217 | <xsl:when test="$purpose = 'xref' and titleabbrev"> |
---|
1218 | <xsl:apply-templates select="." mode="titleabbrev.markup"/> |
---|
1219 | </xsl:when> |
---|
1220 | <xsl:otherwise> |
---|
1221 | <xsl:copy-of select="$title"/> |
---|
1222 | </xsl:otherwise> |
---|
1223 | </xsl:choose> |
---|
1224 | </xsl:template> |
---|
1225 | |
---|
1226 | <xsl:template match="chapter|appendix" mode="insert.title.markup"> |
---|
1227 | <xsl:param name="purpose"/> |
---|
1228 | <xsl:param name="xrefstyle"/> |
---|
1229 | <xsl:param name="title"/> |
---|
1230 | |
---|
1231 | <xsl:choose> |
---|
1232 | <xsl:when test="$purpose = 'xref'"> |
---|
1233 | <i> |
---|
1234 | <xsl:copy-of select="$title"/> |
---|
1235 | </i> |
---|
1236 | </xsl:when> |
---|
1237 | <xsl:otherwise> |
---|
1238 | <xsl:copy-of select="$title"/> |
---|
1239 | </xsl:otherwise> |
---|
1240 | </xsl:choose> |
---|
1241 | </xsl:template> |
---|
1242 | |
---|
1243 | <xsl:template match="*" mode="insert.subtitle.markup"> |
---|
1244 | <xsl:param name="purpose"/> |
---|
1245 | <xsl:param name="xrefstyle"/> |
---|
1246 | <xsl:param name="subtitle"/> |
---|
1247 | |
---|
1248 | <xsl:copy-of select="$subtitle"/> |
---|
1249 | </xsl:template> |
---|
1250 | |
---|
1251 | <xsl:template match="*" mode="insert.label.markup"> |
---|
1252 | <xsl:param name="purpose"/> |
---|
1253 | <xsl:param name="xrefstyle"/> |
---|
1254 | <xsl:param name="label"/> |
---|
1255 | |
---|
1256 | <xsl:copy-of select="$label"/> |
---|
1257 | </xsl:template> |
---|
1258 | |
---|
1259 | <xsl:template match="*" mode="insert.pagenumber.markup"> |
---|
1260 | <xsl:param name="purpose"/> |
---|
1261 | <xsl:param name="xrefstyle"/> |
---|
1262 | <xsl:param name="pagenumber"/> |
---|
1263 | |
---|
1264 | <xsl:copy-of select="$pagenumber"/> |
---|
1265 | </xsl:template> |
---|
1266 | |
---|
1267 | <xsl:template match="*" mode="insert.direction.markup"> |
---|
1268 | <xsl:param name="purpose"/> |
---|
1269 | <xsl:param name="xrefstyle"/> |
---|
1270 | <xsl:param name="direction"/> |
---|
1271 | |
---|
1272 | <xsl:copy-of select="$direction"/> |
---|
1273 | </xsl:template> |
---|
1274 | |
---|
1275 | <xsl:template match="*" mode="insert.olink.docname.markup"> |
---|
1276 | <xsl:param name="purpose"/> |
---|
1277 | <xsl:param name="xrefstyle"/> |
---|
1278 | <xsl:param name="docname"/> |
---|
1279 | |
---|
1280 | <span class="olinkdocname"> |
---|
1281 | <xsl:copy-of select="$docname"/> |
---|
1282 | </span> |
---|
1283 | |
---|
1284 | </xsl:template> |
---|
1285 | |
---|
1286 | </xsl:stylesheet> |
---|