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