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