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