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