1 | <?xml version='1.0'?>
|
---|
2 | <!DOCTYPE xsl:stylesheet [ <!ENTITY % xsldoc.ent SYSTEM "./xsldoc.ent"> %xsldoc.ent; ]>
|
---|
3 | <!--#############################################################################
|
---|
4 | | $Id: xref.mod.xsl,v 1.41 2004/01/28 02:07:08 j-devenish Exp $
|
---|
5 | |- #############################################################################
|
---|
6 | | $Author: j-devenish $
|
---|
7 | + ############################################################################## -->
|
---|
8 |
|
---|
9 | <xsl:stylesheet
|
---|
10 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
11 | xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
|
---|
12 | exclude-result-prefixes="doc" version='1.0'>
|
---|
13 |
|
---|
14 | <doc:reference id="xref" xmlns="">
|
---|
15 | <referenceinfo>
|
---|
16 | <releaseinfo role="meta">
|
---|
17 | $Id: xref.mod.xsl,v 1.41 2004/01/28 02:07:08 j-devenish Exp $
|
---|
18 | </releaseinfo>
|
---|
19 | <authorgroup>
|
---|
20 | &ramon;
|
---|
21 | &james;
|
---|
22 | </authorgroup>
|
---|
23 | <copyright>
|
---|
24 | <year>2000</year><year>2001</year><year>2002</year><year>2003</year><year>2004</year>
|
---|
25 | <holder>Ramon Casellas</holder>
|
---|
26 | </copyright>
|
---|
27 | <revhistory>
|
---|
28 | <doc:revision rcasver="1.12">&rev_2003_05;</doc:revision>
|
---|
29 | </revhistory>
|
---|
30 | </referenceinfo>
|
---|
31 | <title>Cross References <filename>xref.mod.xsl</filename></title>
|
---|
32 | <partintro>
|
---|
33 | <para>
|
---|
34 |
|
---|
35 | Portions (c) Norman Walsh, official DocBook XSL stylesheets. See docbook.sf.net
|
---|
36 |
|
---|
37 | </para>
|
---|
38 | </partintro>
|
---|
39 | </doc:reference>
|
---|
40 |
|
---|
41 | <doc:template xmlns="">
|
---|
42 | <refpurpose>Process <doc:db>anchor</doc:db> elements</refpurpose>
|
---|
43 | <doc:description>
|
---|
44 | <para>
|
---|
45 | Identify a place in the document for cross references.
|
---|
46 | </para>
|
---|
47 | </doc:description>
|
---|
48 | <doc:variables>
|
---|
49 | &no_var;
|
---|
50 | </doc:variables>
|
---|
51 | <doc:notes>
|
---|
52 | <para>
|
---|
53 | Inserts a &LaTeX; <function condition="latex">hypertarget</function>
|
---|
54 | with the current node's id value and no content.
|
---|
55 | <doc:todo>Check to see whether this causes typesetting problems
|
---|
56 | with <command>latex</command> (as opposed to
|
---|
57 | <command>pdflatex</command>) due to insertion of errant
|
---|
58 | <literal>pdfmark</literal>s.</doc:todo>
|
---|
59 | </para>
|
---|
60 | </doc:notes>
|
---|
61 | </doc:template>
|
---|
62 | <xsl:template match="anchor">
|
---|
63 | <xsl:param name="id" select="@id"/>
|
---|
64 | <xsl:text>\hypertarget{</xsl:text>
|
---|
65 | <xsl:value-of select="$id"/>
|
---|
66 | <xsl:text>}{}</xsl:text>
|
---|
67 | </xsl:template>
|
---|
68 |
|
---|
69 | <xsl:key name="cross-refs" match="xref|link" use="@linkend"/>
|
---|
70 | <doc:template name="id.is.xrefed" xmlns="">
|
---|
71 | <refpurpose>Auxiliary named template</refpurpose>
|
---|
72 | <doc:description>
|
---|
73 | <para>This template returns 1 if there exists somewhere an xref
|
---|
74 | or link whose linkend is the target's id.</para>
|
---|
75 | </doc:description>
|
---|
76 | </doc:template>
|
---|
77 | <xsl:template name="id.is.xrefed">
|
---|
78 | <xsl:param name="target" select="."/>
|
---|
79 | <xsl:variable name="id">
|
---|
80 | <xsl:call-template name="generate.label.id">
|
---|
81 | <xsl:with-param name="object" select="$target"/>
|
---|
82 | </xsl:call-template>
|
---|
83 | </xsl:variable>
|
---|
84 | <xsl:choose>
|
---|
85 | <xsl:when test="count(key('cross-refs', $id))>0">
|
---|
86 | <xsl:text>1</xsl:text>
|
---|
87 | </xsl:when>
|
---|
88 | <xsl:otherwise>
|
---|
89 | <xsl:text>0</xsl:text>
|
---|
90 | </xsl:otherwise>
|
---|
91 | </xsl:choose>
|
---|
92 | </xsl:template>
|
---|
93 |
|
---|
94 | <doc:template name="xref.xreflabel" xmlns="">
|
---|
95 | <refpurpose>Auxiliary named template</refpurpose>
|
---|
96 | <doc:description>
|
---|
97 | <para> Called to process an xreflabel...you might use this to make
|
---|
98 | xreflabels come out in the right font for different targets,
|
---|
99 | for example.</para>
|
---|
100 | </doc:description>
|
---|
101 | </doc:template>
|
---|
102 | <xsl:template name="xref.xreflabel">
|
---|
103 | <xsl:param name="target" select="."/>
|
---|
104 | <xsl:value-of select="$target/@xreflabel"/>
|
---|
105 | </xsl:template>
|
---|
106 |
|
---|
107 | <doc:template match="xref|link" xmlns="">
|
---|
108 | <refpurpose>Xref and Link XSL Template</refpurpose>
|
---|
109 | <doc:description>
|
---|
110 | <para>
|
---|
111 | <doc:todo>Undocumented.</doc:todo>
|
---|
112 | </para>
|
---|
113 | </doc:description>
|
---|
114 | <doc:variables>
|
---|
115 | <itemizedlist>
|
---|
116 | <listitem><simpara><xref linkend="param.insert.xref.page.number"/></simpara></listitem>
|
---|
117 | <listitem><simpara><xref linkend="param.latex.use.varioref"/></simpara></listitem>
|
---|
118 | </itemizedlist>
|
---|
119 | </doc:variables>
|
---|
120 | </doc:template>
|
---|
121 | <xsl:template match="xref|link">
|
---|
122 | <xsl:variable name="targets" select="key('id',@linkend)"/>
|
---|
123 | <xsl:variable name="target" select="$targets[1]"/>
|
---|
124 | <xsl:variable name="refelem" select="local-name($target)"/>
|
---|
125 | <xsl:call-template name="check.id.unique"><xsl:with-param name="linkend" select="@linkend"/></xsl:call-template>
|
---|
126 | <xsl:choose>
|
---|
127 | <xsl:when test="$refelem=''">
|
---|
128 | <xsl:message><xsl:text>XRef to nonexistent id: </xsl:text><xsl:value-of select="@linkend"/></xsl:message>
|
---|
129 | <xsl:text>XrefId[?</xsl:text>
|
---|
130 | <xsl:if test="local-name(.)='link'"><xsl:apply-templates/></xsl:if>
|
---|
131 | <xsl:text>?]</xsl:text>
|
---|
132 | </xsl:when>
|
---|
133 |
|
---|
134 | <!-- This is a link with content ... -->
|
---|
135 | <xsl:when test="local-name(.)='link' and .!=''">
|
---|
136 | <xsl:call-template name="generate.hyperlink">
|
---|
137 | <xsl:with-param name="target" select="$target"/>
|
---|
138 | <xsl:with-param name="text"><xsl:apply-templates/></xsl:with-param>
|
---|
139 | </xsl:call-template>
|
---|
140 | </xsl:when>
|
---|
141 |
|
---|
142 | <xsl:otherwise>
|
---|
143 | <xsl:choose>
|
---|
144 | <xsl:when test="@endterm">
|
---|
145 | <xsl:variable name="etargets" select="key('id',@endterm)"/>
|
---|
146 | <xsl:variable name="etarget" select="$etargets[1]"/>
|
---|
147 | <xsl:choose>
|
---|
148 | <xsl:when test="count($etarget) = 0">
|
---|
149 | <xsl:message>
|
---|
150 | <xsl:value-of select="count($etargets)"/>
|
---|
151 | <xsl:text>Endterm points to nonexistent ID: </xsl:text>
|
---|
152 | <xsl:value-of select="@endterm"/>
|
---|
153 | </xsl:message>
|
---|
154 | <xsl:text>[NONEXISTENT ID]</xsl:text>
|
---|
155 | </xsl:when>
|
---|
156 | <xsl:otherwise>
|
---|
157 | <xsl:call-template name="generate.hyperlink">
|
---|
158 | <xsl:with-param name="target" select="$target"/>
|
---|
159 | <xsl:with-param name="text">
|
---|
160 | <xsl:call-template name="generate.xref.text">
|
---|
161 | <xsl:with-param name="target" select="$etarget"/>
|
---|
162 | </xsl:call-template>
|
---|
163 | </xsl:with-param>
|
---|
164 | </xsl:call-template>
|
---|
165 | </xsl:otherwise>
|
---|
166 | </xsl:choose>
|
---|
167 | </xsl:when>
|
---|
168 | <!-- If an xreflabel has been specified for the target ... -->
|
---|
169 | <xsl:when test="local-name(.)='xref' and $target/@xreflabel">
|
---|
170 | <xsl:call-template name="generate.hyperlink">
|
---|
171 | <xsl:with-param name="target" select="$target"/>
|
---|
172 | <xsl:with-param name="text">
|
---|
173 | <xsl:text>{[</xsl:text>
|
---|
174 | <xsl:call-template name="xref.xreflabel">
|
---|
175 | <xsl:with-param name="target" select="$target"/>
|
---|
176 | </xsl:call-template>
|
---|
177 | <xsl:text>]}</xsl:text>
|
---|
178 | </xsl:with-param>
|
---|
179 | </xsl:call-template>
|
---|
180 | </xsl:when>
|
---|
181 | <xsl:otherwise>
|
---|
182 | <xsl:call-template name="generate.hyperlink">
|
---|
183 | <xsl:with-param name="target" select="$target"/>
|
---|
184 | <xsl:with-param name="text">
|
---|
185 | <xsl:call-template name="generate.xref.text">
|
---|
186 | <xsl:with-param name="target" select="$target"/>
|
---|
187 | </xsl:call-template>
|
---|
188 | </xsl:with-param>
|
---|
189 | </xsl:call-template>
|
---|
190 | </xsl:otherwise>
|
---|
191 | </xsl:choose>
|
---|
192 | </xsl:otherwise>
|
---|
193 | </xsl:choose>
|
---|
194 | <xsl:if test="$insert.xref.page.number=1 and not($latex.use.varioref='1') and $refelem!='' and local-name(.)='xref'">
|
---|
195 | <xsl:variable name="xref.text">
|
---|
196 | <xsl:call-template name="gentext.template">
|
---|
197 | <xsl:with-param name="context" select="'xref'"/>
|
---|
198 | <xsl:with-param name="name" select="'page.citation'"/>
|
---|
199 | </xsl:call-template>
|
---|
200 | </xsl:variable>
|
---|
201 | <xsl:for-each select="$target">
|
---|
202 | <xsl:call-template name="substitute-markup">
|
---|
203 | <xsl:with-param name="template" select="$xref.text"/>
|
---|
204 | </xsl:call-template>
|
---|
205 | </xsl:for-each>
|
---|
206 | </xsl:if>
|
---|
207 | </xsl:template>
|
---|
208 |
|
---|
209 | <doc:template>
|
---|
210 | <refpurpose> Generate xref text </refpurpose>
|
---|
211 | <doc:variables>
|
---|
212 | <itemizedlist>
|
---|
213 | <listitem><simpara><xref linkend="param.use.role.as.xrefstyle"/></simpara></listitem>
|
---|
214 | </itemizedlist>
|
---|
215 | </doc:variables>
|
---|
216 | </doc:template>
|
---|
217 | <xsl:template name="generate.xref.text">
|
---|
218 | <xsl:param name="target"/>
|
---|
219 | <xsl:apply-templates select="$target" mode="xref-to">
|
---|
220 | <xsl:with-param name="referrer" select="."/>
|
---|
221 | <xsl:with-param name="xrefstyle">
|
---|
222 | <xsl:choose>
|
---|
223 | <xsl:when test="@role and not(@xrefstyle) and $use.role.as.xrefstyle != 0">
|
---|
224 | <xsl:value-of select="@role"/>
|
---|
225 | </xsl:when>
|
---|
226 | <xsl:when test="@xrefstyle">
|
---|
227 | <xsl:value-of select="@xrefstyle"/>
|
---|
228 | </xsl:when>
|
---|
229 | <xsl:when test="local-name($target)='title' or local-name($target)='subtitle'">
|
---|
230 | <xsl:value-of select="concat(local-name($target), '-unnumbered')"/>
|
---|
231 | </xsl:when>
|
---|
232 | <xsl:otherwise>
|
---|
233 | <xsl:text>xref-number</xsl:text>
|
---|
234 | </xsl:otherwise>
|
---|
235 | </xsl:choose>
|
---|
236 | </xsl:with-param>
|
---|
237 | </xsl:apply-templates>
|
---|
238 | </xsl:template>
|
---|
239 |
|
---|
240 | <doc:template name="generate.hyperlink" xmlns="">
|
---|
241 | <refpurpose> Choose hyperlink syntax </refpurpose>
|
---|
242 | <doc:description>
|
---|
243 | <para>Will use hyperref, if it is available. Otherwise, just outputs
|
---|
244 | unlinked text. If the destination is a citation, a backreference is
|
---|
245 | emitted (even though it is technically a hyperlink, not a citation).
|
---|
246 | If the 'text' arises from an @endterm, then the 'optional argument'
|
---|
247 | syntax of <literal>\cite</literal> is used.</para>
|
---|
248 | </doc:description>
|
---|
249 | </doc:template>
|
---|
250 | <xsl:template name="generate.hyperlink">
|
---|
251 | <xsl:param name="target"/>
|
---|
252 | <xsl:param name="text"/>
|
---|
253 | <xsl:variable name="element" select="local-name($target)"/>
|
---|
254 | <xsl:variable name="citation" select="$element='biblioentry' or $element='bibliomixed'"/>
|
---|
255 | <xsl:choose>
|
---|
256 | <xsl:when test="$citation and @endterm!=''">
|
---|
257 | <xsl:text>\docbooktolatexcite</xsl:text>
|
---|
258 | <xsl:text>{</xsl:text>
|
---|
259 | <xsl:value-of select="$target/@id"/>
|
---|
260 | <xsl:text>}{</xsl:text>
|
---|
261 | <xsl:call-template name="scape-optionalarg">
|
---|
262 | <xsl:with-param name="string" select="$text"/>
|
---|
263 | </xsl:call-template>
|
---|
264 | <xsl:text>}</xsl:text>
|
---|
265 | </xsl:when>
|
---|
266 | <xsl:otherwise>
|
---|
267 | <xsl:if test="$latex.use.hyperref=1 and not(ancestor::title)">
|
---|
268 | <xsl:text>\hyperlink{</xsl:text>
|
---|
269 | <xsl:value-of select="$target/@id"/>
|
---|
270 | <xsl:text>}</xsl:text>
|
---|
271 | </xsl:if>
|
---|
272 | <xsl:text>{</xsl:text>
|
---|
273 | <xsl:if test="$citation">
|
---|
274 | <xsl:text>\docbooktolatexbackcite{</xsl:text>
|
---|
275 | <xsl:value-of select="$target/@id"/>
|
---|
276 | <xsl:text>}</xsl:text>
|
---|
277 | </xsl:if>
|
---|
278 | <xsl:value-of select="$text"/>
|
---|
279 | <xsl:text>}</xsl:text>
|
---|
280 | </xsl:otherwise>
|
---|
281 | </xsl:choose>
|
---|
282 | </xsl:template>
|
---|
283 |
|
---|
284 | <doc:template basename="insert.label.markup" xmlns="">
|
---|
285 | <refpurpose>Numbering template</refpurpose>
|
---|
286 | <doc:description>
|
---|
287 | <para>
|
---|
288 | Let &LaTeX; manage the numbering. Otherwise sty files that
|
---|
289 | do specify another numberic (e.g I,II) get messed.
|
---|
290 | </para>
|
---|
291 | </doc:description>
|
---|
292 | <doc:variables>
|
---|
293 | <itemizedlist>
|
---|
294 | <listitem><simpara><xref linkend="param.insert.xref.page.number"/></simpara></listitem>
|
---|
295 | <listitem><simpara><xref linkend="param.latex.use.varioref"/></simpara></listitem>
|
---|
296 | </itemizedlist>
|
---|
297 | </doc:variables>
|
---|
298 | </doc:template>
|
---|
299 | <xsl:template match="*" mode="insert.label.markup" name="insert.label.markup">
|
---|
300 | <xsl:param name="id" select="@id"/>
|
---|
301 | <xsl:choose>
|
---|
302 | <xsl:when test="$insert.xref.page.number=1 and $latex.use.varioref='1'">
|
---|
303 | <xsl:text>{\vref{</xsl:text><xsl:value-of select="$id"/><xsl:text>}}</xsl:text>
|
---|
304 | </xsl:when>
|
---|
305 | <xsl:otherwise>
|
---|
306 | <xsl:text>{\ref{</xsl:text><xsl:value-of select="$id"/><xsl:text>}}</xsl:text>
|
---|
307 | </xsl:otherwise>
|
---|
308 | </xsl:choose>
|
---|
309 | </xsl:template>
|
---|
310 |
|
---|
311 | <doc:template basename="insert.label.markup" xmlns="">
|
---|
312 | <refpurpose>Numbering template -- uses parent's @id</refpurpose>
|
---|
313 | <doc:description>
|
---|
314 | <para>
|
---|
315 | Calls <xref linkend="template.insert.label.markup"/> using parent's @id.
|
---|
316 | </para>
|
---|
317 | </doc:description>
|
---|
318 | <doc:variables>
|
---|
319 | <itemizedlist>
|
---|
320 | <listitem><simpara><xref linkend="param.insert.xref.page.number"/></simpara></listitem>
|
---|
321 | <listitem><simpara><xref linkend="param.latex.use.varioref"/></simpara></listitem>
|
---|
322 | </itemizedlist>
|
---|
323 | </doc:variables>
|
---|
324 | </doc:template>
|
---|
325 | <xsl:template match="title" mode="insert.label.markup">
|
---|
326 | <xsl:call-template name="insert.label.markup">
|
---|
327 | <xsl:with-param name="id">
|
---|
328 | <xsl:choose>
|
---|
329 | <xsl:when test="contains(local-name(..), 'info')">
|
---|
330 | <xsl:call-template name="generate.label.id">
|
---|
331 | <xsl:with-param name="object" select="../.."/>
|
---|
332 | </xsl:call-template>
|
---|
333 | </xsl:when>
|
---|
334 | <xsl:otherwise>
|
---|
335 | <xsl:call-template name="generate.label.id">
|
---|
336 | <xsl:with-param name="object" select=".."/>
|
---|
337 | </xsl:call-template>
|
---|
338 | </xsl:otherwise>
|
---|
339 | </xsl:choose>
|
---|
340 | </xsl:with-param>
|
---|
341 | </xsl:call-template>
|
---|
342 | </xsl:template>
|
---|
343 |
|
---|
344 | <doc:template xmlns="">
|
---|
345 | <refpurpose> Format titles in xref text </refpurpose>
|
---|
346 | <doc:params>
|
---|
347 | <variablelist>
|
---|
348 | <varlistentry>
|
---|
349 | <term>title</term>
|
---|
350 | <listitem><simpara>The text. This is expected to
|
---|
351 | be received from gentext.xsl, in which case it will
|
---|
352 | contain no deliberate &LaTeX; commands and must be
|
---|
353 | escaped.</simpara></listitem>
|
---|
354 | </varlistentry>
|
---|
355 | <varlistentry>
|
---|
356 | <term>is.component</term>
|
---|
357 | <listitem><simpara>Whether the node is considered
|
---|
358 | to be a <quote>component</quote> in the sense of &DocBook;.
|
---|
359 | If so, the formatting of the title may be different. By default,
|
---|
360 | the determination of component elements is performed by the
|
---|
361 | <literal>is.component</literal> template in
|
---|
362 | <filename>common.xsl</filename>.</simpara></listitem>
|
---|
363 | </varlistentry>
|
---|
364 | </variablelist>
|
---|
365 | </doc:params>
|
---|
366 | <doc:description>
|
---|
367 | <para>
|
---|
368 | Calls <xref linkend="template.normalize-scape"/>. If the node
|
---|
369 | is a component type (e.g. appendix, article, chapter, preface,
|
---|
370 | bibliography, glossary or index) then gentext.startquote and
|
---|
371 | gentext.endquote are placed around the title.
|
---|
372 | </para>
|
---|
373 | </doc:description>
|
---|
374 | </doc:template>
|
---|
375 | <xsl:template match="*" mode="insert.title.markup" name="generate.title.markup">
|
---|
376 | <xsl:param name="title"/>
|
---|
377 | <xsl:param name="is.component">
|
---|
378 | <xsl:call-template name="is.component"/>
|
---|
379 | </xsl:param>
|
---|
380 | <xsl:choose>
|
---|
381 | <xsl:when test="$is.component=1">
|
---|
382 | <xsl:call-template name="gentext.startquote"/>
|
---|
383 | <xsl:call-template name="normalize-scape">
|
---|
384 | <xsl:with-param name="string" select="$title"/>
|
---|
385 | </xsl:call-template>
|
---|
386 | <xsl:call-template name="gentext.endquote"/>
|
---|
387 | </xsl:when>
|
---|
388 | <xsl:otherwise>
|
---|
389 | <xsl:call-template name="normalize-scape">
|
---|
390 | <xsl:with-param name="string" select="$title"/>
|
---|
391 | </xsl:call-template>
|
---|
392 | </xsl:otherwise>
|
---|
393 | </xsl:choose>
|
---|
394 | </xsl:template>
|
---|
395 |
|
---|
396 | <doc:template xmlns="">
|
---|
397 | <refpurpose> Format titles in xref text </refpurpose>
|
---|
398 | <doc:params>
|
---|
399 | <variablelist>
|
---|
400 | <varlistentry>
|
---|
401 | <term>title</term>
|
---|
402 | <listitem><simpara>The text.</simpara></listitem>
|
---|
403 | </varlistentry>
|
---|
404 | <varlistentry>
|
---|
405 | <term>is.component</term>
|
---|
406 | <listitem><simpara>Whether the node's parent is considered
|
---|
407 | to be a <quote>component</quote> in the sense of &DocBook;.
|
---|
408 | </simpara></listitem>
|
---|
409 | </varlistentry>
|
---|
410 | </variablelist>
|
---|
411 | </doc:params>
|
---|
412 | <doc:description>
|
---|
413 | <para>
|
---|
414 | Calls <xref linkend="template.generate.title.markup"/>.
|
---|
415 | </para>
|
---|
416 | </doc:description>
|
---|
417 | </doc:template>
|
---|
418 | <xsl:template match="title" mode="insert.title.markup">
|
---|
419 | <xsl:param name="title"/>
|
---|
420 | <xsl:param name="is.component">
|
---|
421 | <xsl:choose>
|
---|
422 | <xsl:when test="contains(local-name(..), 'info')">
|
---|
423 | <xsl:call-template name="is.component">
|
---|
424 | <xsl:with-param name="node" select="../.."/>
|
---|
425 | </xsl:call-template>
|
---|
426 | </xsl:when>
|
---|
427 | <xsl:otherwise>
|
---|
428 | <xsl:call-template name="is.component">
|
---|
429 | <xsl:with-param name="node" select=".."/>
|
---|
430 | </xsl:call-template>
|
---|
431 | </xsl:otherwise>
|
---|
432 | </xsl:choose>
|
---|
433 | </xsl:param>
|
---|
434 | <xsl:call-template name="generate.title.markup">
|
---|
435 | <xsl:with-param name="title" select="$title"/>
|
---|
436 | <xsl:with-param name="is.component" select="$is.component"/>
|
---|
437 | </xsl:call-template>
|
---|
438 | </xsl:template>
|
---|
439 |
|
---|
440 | <doc:template xmlns="">
|
---|
441 | <refpurpose> Format titles in xref text </refpurpose>
|
---|
442 | <doc:description>
|
---|
443 | <para>
|
---|
444 | Does not add quotation marks around the title
|
---|
445 | but does italicise it.
|
---|
446 | </para>
|
---|
447 | </doc:description>
|
---|
448 | </doc:template>
|
---|
449 | <xsl:template match="book" mode="insert.title.markup">
|
---|
450 | <xsl:param name="title"/>
|
---|
451 | <xsl:text>{\textit{</xsl:text>
|
---|
452 | <xsl:call-template name="normalize-scape">
|
---|
453 | <xsl:with-param name="string" select="$title"/>
|
---|
454 | </xsl:call-template>
|
---|
455 | <xsl:text>}}</xsl:text>
|
---|
456 | </xsl:template>
|
---|
457 |
|
---|
458 | <xsl:template match="*" mode="insert.subtitle.markup">
|
---|
459 | <xsl:message>Warning: unexpected insert.subtitle.markup in DB2LaTeX</xsl:message>
|
---|
460 | </xsl:template>
|
---|
461 |
|
---|
462 | <xsl:template match="*" mode="insert.pagenumber.markup">
|
---|
463 | <xsl:param name="target" select="."/>
|
---|
464 | <xsl:choose>
|
---|
465 | <xsl:when test="$latex.use.varioref='1'">
|
---|
466 | <xsl:variable name="options"><xsl:call-template name="latex.vpageref.options"/></xsl:variable>
|
---|
467 | <xsl:text>\vpageref</xsl:text>
|
---|
468 | <xsl:if test="$options!=''">
|
---|
469 | <xsl:choose>
|
---|
470 | <xsl:when test="contains($options,'[')">
|
---|
471 | <xsl:value-of select="$options"/>
|
---|
472 | </xsl:when>
|
---|
473 | <xsl:otherwise>
|
---|
474 | <xsl:text>[</xsl:text>
|
---|
475 | <xsl:value-of select="$options"/>
|
---|
476 | <xsl:text>]</xsl:text>
|
---|
477 | </xsl:otherwise>
|
---|
478 | </xsl:choose>
|
---|
479 | </xsl:if>
|
---|
480 | <xsl:text>{</xsl:text>
|
---|
481 | </xsl:when>
|
---|
482 | <xsl:otherwise>
|
---|
483 | <xsl:text>\pageref{</xsl:text>
|
---|
484 | </xsl:otherwise>
|
---|
485 | </xsl:choose>
|
---|
486 | <xsl:value-of select="$target/@id"/>
|
---|
487 | <xsl:text>}</xsl:text>
|
---|
488 | </xsl:template>
|
---|
489 |
|
---|
490 | <xsl:template match="*" mode="insert.direction.markup">
|
---|
491 | <xsl:message>Warning: unexpected insert.direction.markup in DB2LaTeX</xsl:message>
|
---|
492 | </xsl:template>
|
---|
493 |
|
---|
494 | <doc:template match="ulink" xmlns="">
|
---|
495 | <refpurpose>A link that addresses its target by means of a URL (Uniform Resource Locator)</refpurpose>
|
---|
496 | <doc:variables>
|
---|
497 | <itemizedlist>
|
---|
498 | <listitem><simpara><xref linkend="param.ulink.show"/></simpara></listitem>
|
---|
499 | <listitem><simpara><xref linkend="param.ulink.footnotes"/></simpara></listitem>
|
---|
500 | <listitem><simpara><xref linkend="param.latex.ulink.protocols.relaxed"/></simpara></listitem>
|
---|
501 | <listitem><simpara><xref linkend="param.latex.hyphenation.tttricks"/></simpara></listitem>
|
---|
502 | </itemizedlist>
|
---|
503 | </doc:variables>
|
---|
504 | </doc:template>
|
---|
505 | <xsl:template match="ulink" name="ulink">
|
---|
506 | <xsl:param name="hyphenation">\docbookhyphenateurl</xsl:param>
|
---|
507 | <xsl:param name="url" select="@url"/>
|
---|
508 | <xsl:param name="content">
|
---|
509 | <xsl:call-template name="trim-outer">
|
---|
510 | <xsl:with-param name="string" select="."/>
|
---|
511 | </xsl:call-template>
|
---|
512 | </xsl:param>
|
---|
513 | <xsl:choose>
|
---|
514 | <xsl:when test="$content = '' or $content = $url">
|
---|
515 | <xsl:call-template name="generate.typeset.url">
|
---|
516 | <xsl:with-param name="hyphenation" select="$hyphenation"/>
|
---|
517 | <xsl:with-param name="url" select="$url"/>
|
---|
518 | <xsl:with-param name="prepend" select="''"/>
|
---|
519 | </xsl:call-template>
|
---|
520 | </xsl:when>
|
---|
521 | <xsl:when test="$latex.ulink.protocols.relaxed='1' and (substring-after($url,':')=$content or substring-after($url,'://')=$content)">
|
---|
522 | <xsl:call-template name="generate.typeset.url">
|
---|
523 | <xsl:with-param name="hyphenation" select="$hyphenation"/>
|
---|
524 | <xsl:with-param name="url" select="$content"/>
|
---|
525 | <xsl:with-param name="prepend" select="''"/>
|
---|
526 | </xsl:call-template>
|
---|
527 | <xsl:if test="$ulink.footnotes='1' and count(ancestor::footnote)=0">
|
---|
528 | <xsl:call-template name="generate.ulink.in.footnote">
|
---|
529 | <xsl:with-param name="hyphenation" select="$hyphenation"/>
|
---|
530 | <xsl:with-param name="url" select="$url"/>
|
---|
531 | </xsl:call-template>
|
---|
532 | </xsl:if>
|
---|
533 | </xsl:when>
|
---|
534 | <xsl:when test="$latex.use.tabularx=1 and count(ancestor::table)>0">
|
---|
535 | <xsl:apply-templates/>
|
---|
536 | <xsl:call-template name="generate.typeset.url">
|
---|
537 | <xsl:with-param name="hyphenation" select="$hyphenation"/>
|
---|
538 | <xsl:with-param name="url" select="$url"/>
|
---|
539 | </xsl:call-template>
|
---|
540 | </xsl:when>
|
---|
541 | <xsl:when test="$ulink.footnotes='1' or $ulink.show='1'">
|
---|
542 | <xsl:apply-templates/>
|
---|
543 | <xsl:if test="$ulink.footnotes='1' and count(ancestor::footnote)=0">
|
---|
544 | <xsl:call-template name="generate.ulink.in.footnote">
|
---|
545 | <xsl:with-param name="hyphenation" select="$hyphenation"/>
|
---|
546 | <xsl:with-param name="url" select="$url"/>
|
---|
547 | </xsl:call-template>
|
---|
548 | </xsl:if>
|
---|
549 | <xsl:if test="$ulink.show='1' or ($ulink.footnotes='1' and ancestor::footnote)">
|
---|
550 | <xsl:call-template name="generate.typeset.url">
|
---|
551 | <xsl:with-param name="hyphenation" select="$hyphenation"/>
|
---|
552 | <xsl:with-param name="url" select="$url"/>
|
---|
553 | </xsl:call-template>
|
---|
554 | </xsl:if>
|
---|
555 | </xsl:when>
|
---|
556 | <xsl:otherwise>
|
---|
557 | <xsl:text>\href{</xsl:text>
|
---|
558 | <xsl:call-template name="scape-href">
|
---|
559 | <xsl:with-param name="string" select="$url"/>
|
---|
560 | </xsl:call-template>
|
---|
561 | <xsl:text>}</xsl:text>
|
---|
562 | <xsl:text>{</xsl:text>
|
---|
563 | <xsl:apply-templates/>
|
---|
564 | <xsl:text>}</xsl:text><!-- End Of second argument of \href -->
|
---|
565 | </xsl:otherwise>
|
---|
566 | </xsl:choose>
|
---|
567 | </xsl:template>
|
---|
568 |
|
---|
569 | <doc:template match="olink" xmlns="">
|
---|
570 | <refpurpose>OLink XSL template</refpurpose>
|
---|
571 | <doc:description>
|
---|
572 | <para></para>
|
---|
573 | </doc:description>
|
---|
574 | </doc:template>
|
---|
575 | <xsl:template match="olink">
|
---|
576 | <xsl:apply-templates/>
|
---|
577 | </xsl:template>
|
---|
578 |
|
---|
579 | <xsl:template match="*" name="title.xref">
|
---|
580 | <xsl:param name="target" select="."/>
|
---|
581 | <xsl:choose>
|
---|
582 | <xsl:when test="name($target) = 'figure'
|
---|
583 | or name($target) = 'example'
|
---|
584 | or name($target) = 'equation'
|
---|
585 | or name($target) = 'table'
|
---|
586 | or name($target) = 'dedication'
|
---|
587 | or name($target) = 'preface'
|
---|
588 | or name($target) = 'bibliography'
|
---|
589 | or name($target) = 'glossary'
|
---|
590 | or name($target) = 'index'
|
---|
591 | or name($target) = 'setindex'
|
---|
592 | or name($target) = 'colophon'">
|
---|
593 | <xsl:call-template name="gentext.startquote"/>
|
---|
594 | <xsl:apply-templates select="$target" mode="title.content"/>
|
---|
595 | <xsl:call-template name="gentext.endquote"/>
|
---|
596 | </xsl:when>
|
---|
597 | <xsl:otherwise>
|
---|
598 | <xsl:text>{\em </xsl:text><xsl:apply-templates select="$target" mode="title.content"/><xsl:text>}</xsl:text>
|
---|
599 | </xsl:otherwise>
|
---|
600 | </xsl:choose>
|
---|
601 | </xsl:template>
|
---|
602 |
|
---|
603 | <xsl:template match="title" mode="xref">
|
---|
604 | <xsl:apply-templates/>
|
---|
605 | </xsl:template>
|
---|
606 |
|
---|
607 | <xsl:template match="command" mode="xref">
|
---|
608 | <xsl:call-template name="inline.boldseq"/>
|
---|
609 | </xsl:template>
|
---|
610 |
|
---|
611 | <xsl:template match="function" mode="xref">
|
---|
612 | <xsl:call-template name="inline.monoseq"/>
|
---|
613 | </xsl:template>
|
---|
614 |
|
---|
615 | <doc:template xmlns="">
|
---|
616 | <refpurpose> Typeset a URL using the <function condition="latex">url</function> or <function condition="latex">href</function> commands </refpurpose>
|
---|
617 | <doc:variables>
|
---|
618 | <itemizedlist>
|
---|
619 | <listitem><simpara><xref linkend="param.latex.url.quotation"/></simpara></listitem>
|
---|
620 | </itemizedlist>
|
---|
621 | </doc:variables>
|
---|
622 | <doc:description>
|
---|
623 | <para>If <xref linkend="param.latex.url.quotation"/> is set,
|
---|
624 | the <quote>urlstartquote</quote> and <quote>urlendquote</quote>
|
---|
625 | gentext dingbats will be emitted.</para>
|
---|
626 | </doc:description>
|
---|
627 | </doc:template>
|
---|
628 | <xsl:template name="generate.typeset.url">
|
---|
629 | <xsl:param name="hyphenation"/>
|
---|
630 | <xsl:param name="url" select="@url"/>
|
---|
631 | <xsl:param name="prepend" select="' '"/>
|
---|
632 | <xsl:value-of select="$prepend"/>
|
---|
633 | <xsl:if test="$latex.url.quotation=1">
|
---|
634 | <xsl:call-template name="gentext.dingbat">
|
---|
635 | <xsl:with-param name="dingbat">urlstartquote</xsl:with-param>
|
---|
636 | </xsl:call-template>
|
---|
637 | </xsl:if>
|
---|
638 | <xsl:choose>
|
---|
639 | <xsl:when test="$latex.use.url='1'">
|
---|
640 | <xsl:text>\url{</xsl:text>
|
---|
641 | <xsl:call-template name="scape-url">
|
---|
642 | <xsl:with-param name="string" select="$url"/>
|
---|
643 | </xsl:call-template>
|
---|
644 | <xsl:text>}</xsl:text>
|
---|
645 | </xsl:when>
|
---|
646 | <xsl:otherwise>
|
---|
647 | <xsl:text>\href{</xsl:text>
|
---|
648 | <xsl:call-template name="scape-href">
|
---|
649 | <xsl:with-param name="string" select="$url"/>
|
---|
650 | </xsl:call-template>
|
---|
651 | <xsl:text>}{\texttt{</xsl:text>
|
---|
652 | <xsl:call-template name="generate.string.url">
|
---|
653 | <xsl:with-param name="hyphenation" select="$hyphenation"/>
|
---|
654 | <xsl:with-param name="string" select="$url"/>
|
---|
655 | </xsl:call-template>
|
---|
656 | <xsl:text>}}</xsl:text>
|
---|
657 | </xsl:otherwise>
|
---|
658 | </xsl:choose>
|
---|
659 | <xsl:if test="$latex.url.quotation=1">
|
---|
660 | <xsl:call-template name="gentext.dingbat">
|
---|
661 | <xsl:with-param name="dingbat">urlendquote</xsl:with-param>
|
---|
662 | </xsl:call-template>
|
---|
663 | </xsl:if>
|
---|
664 | </xsl:template>
|
---|
665 |
|
---|
666 | <doc:template name="generate.string.url" xmlns="">
|
---|
667 | <refpurpose>Escape and hyphenate a string as a teletype URL.</refpurpose>
|
---|
668 | <doc:description>
|
---|
669 | <para>
|
---|
670 | This template typsets teletype text using slash.hyphen if
|
---|
671 | $latex.hyphenation.tttricks is disabled.
|
---|
672 | Has two parameters: 'hyphenation' and 'string'.
|
---|
673 | </para>
|
---|
674 | </doc:description>
|
---|
675 | </doc:template>
|
---|
676 | <xsl:template name="generate.string.url">
|
---|
677 | <xsl:param name="hyphenation" />
|
---|
678 | <xsl:param name="string" />
|
---|
679 | <xsl:param name="url" select="$string"/>
|
---|
680 | <xsl:choose>
|
---|
681 | <xsl:when test="$latex.hyphenation.tttricks=1">
|
---|
682 | <xsl:value-of select="$hyphenation" />
|
---|
683 | <xsl:text>{</xsl:text>
|
---|
684 | <xsl:call-template name="normalize-scape"><xsl:with-param name="string" select="$string"/></xsl:call-template>
|
---|
685 | <xsl:text>}</xsl:text>
|
---|
686 | </xsl:when>
|
---|
687 | <xsl:otherwise>
|
---|
688 | <!-- LaTeX chars are scaped. Each / except the :// is mapped to a /\- -->
|
---|
689 | <xsl:call-template name="scape.slash.hyphen"><xsl:with-param name="string" select="$url"/></xsl:call-template>
|
---|
690 | </xsl:otherwise>
|
---|
691 | </xsl:choose>
|
---|
692 | </xsl:template>
|
---|
693 |
|
---|
694 | <xsl:template name="xpath.location">
|
---|
695 | <!-- abbreviated -->
|
---|
696 | <xsl:param name="node" select="."/>
|
---|
697 | <xsl:value-of select="local-name($node)"/>
|
---|
698 | </xsl:template>
|
---|
699 |
|
---|
700 | <xsl:template match="*" mode="object.xref.template">
|
---|
701 | <xsl:param name="purpose"/>
|
---|
702 | <xsl:param name="xrefstyle"/>
|
---|
703 | <xsl:param name="referrer"/>
|
---|
704 |
|
---|
705 | <xsl:variable name="user-template">
|
---|
706 | <xsl:if test="$xrefstyle != '' and not(contains($xrefstyle, ':'))">
|
---|
707 | <xsl:call-template name="gentext.template.exists">
|
---|
708 | <xsl:with-param name="context" select="$xrefstyle"/>
|
---|
709 | <xsl:with-param name="name">
|
---|
710 | <xsl:call-template name="xpath.location"/>
|
---|
711 | </xsl:with-param>
|
---|
712 | </xsl:call-template>
|
---|
713 | </xsl:if>
|
---|
714 | </xsl:variable>
|
---|
715 |
|
---|
716 | <xsl:variable name="context">
|
---|
717 | <xsl:choose>
|
---|
718 | <xsl:when test="$user-template = 1">
|
---|
719 | <xsl:value-of select="$xrefstyle"/>
|
---|
720 | </xsl:when>
|
---|
721 | <xsl:otherwise>
|
---|
722 | <xsl:value-of select="'xref'"/>
|
---|
723 | </xsl:otherwise>
|
---|
724 | </xsl:choose>
|
---|
725 | </xsl:variable>
|
---|
726 |
|
---|
727 | <xsl:call-template name="gentext.template">
|
---|
728 | <xsl:with-param name="context" select="$context"/>
|
---|
729 | <xsl:with-param name="name">
|
---|
730 | <xsl:call-template name="xpath.location"/>
|
---|
731 | </xsl:with-param>
|
---|
732 | <xsl:with-param name="purpose" select="$purpose"/>
|
---|
733 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
734 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
735 | </xsl:call-template>
|
---|
736 |
|
---|
737 | </xsl:template>
|
---|
738 |
|
---|
739 | <xsl:template match="*" mode="xref-to">
|
---|
740 | <xsl:param name="referrer"/>
|
---|
741 | <xsl:param name="xrefstyle"/>
|
---|
742 |
|
---|
743 | <xsl:message>
|
---|
744 | <xsl:text>Don't know what gentext to create for xref to: "</xsl:text>
|
---|
745 | <xsl:value-of select="name(.)"/>
|
---|
746 | <xsl:text>"</xsl:text>
|
---|
747 | </xsl:message>
|
---|
748 | <xsl:text>?</xsl:text>
|
---|
749 | <xsl:value-of select="$referrer/@linkend"/>
|
---|
750 | <xsl:text>?</xsl:text>
|
---|
751 | </xsl:template>
|
---|
752 |
|
---|
753 | <xsl:template match="title" mode="xref-to">
|
---|
754 | <xsl:param name="referrer"/>
|
---|
755 | <xsl:param name="purpose"/>
|
---|
756 | <xsl:param name="xrefstyle"/>
|
---|
757 | <xsl:param name="name">
|
---|
758 | <xsl:choose>
|
---|
759 | <xsl:when test="contains(local-name(parent::*), 'info')">
|
---|
760 | <xsl:call-template name="xpath.location">
|
---|
761 | <xsl:with-param name="node" select="../.."/>
|
---|
762 | </xsl:call-template>
|
---|
763 | </xsl:when>
|
---|
764 | <xsl:otherwise>
|
---|
765 | <xsl:call-template name="xpath.location">
|
---|
766 | <xsl:with-param name="node" select=".."/>
|
---|
767 | </xsl:call-template>
|
---|
768 | </xsl:otherwise>
|
---|
769 | </xsl:choose>
|
---|
770 | </xsl:param>
|
---|
771 |
|
---|
772 | <xsl:variable name="template">
|
---|
773 | <xsl:variable name="user-template">
|
---|
774 | <xsl:if test="$xrefstyle != '' and not(contains($xrefstyle, ':'))">
|
---|
775 | <xsl:call-template name="gentext.template.exists">
|
---|
776 | <xsl:with-param name="context" select="$xrefstyle"/>
|
---|
777 | <xsl:with-param name="name" select="$name"/>
|
---|
778 | </xsl:call-template>
|
---|
779 | </xsl:if>
|
---|
780 | </xsl:variable>
|
---|
781 | <xsl:variable name="context">
|
---|
782 | <xsl:choose>
|
---|
783 | <xsl:when test="$user-template = 1">
|
---|
784 | <xsl:value-of select="$xrefstyle"/>
|
---|
785 | </xsl:when>
|
---|
786 | <xsl:otherwise>
|
---|
787 | <xsl:value-of select="'title'"/>
|
---|
788 | </xsl:otherwise>
|
---|
789 | </xsl:choose>
|
---|
790 | </xsl:variable>
|
---|
791 | <xsl:call-template name="gentext.template">
|
---|
792 | <xsl:with-param name="context" select="$context"/>
|
---|
793 | <xsl:with-param name="name" select="$name"/>
|
---|
794 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
795 | <xsl:with-param name="purpose" select="$purpose"/>
|
---|
796 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
797 | </xsl:call-template>
|
---|
798 | </xsl:variable>
|
---|
799 |
|
---|
800 | <xsl:call-template name="substitute-markup">
|
---|
801 | <xsl:with-param name="purpose" select="$purpose"/>
|
---|
802 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
803 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
804 | <xsl:with-param name="template" select="$template"/>
|
---|
805 | </xsl:call-template>
|
---|
806 | </xsl:template>
|
---|
807 |
|
---|
808 | <xsl:template match="abstract|article|authorblurb|bibliodiv|bibliomset
|
---|
809 | |biblioset|blockquote|calloutlist|caution|colophon
|
---|
810 | |constraintdef|formalpara|glossdiv|important|indexdiv
|
---|
811 | |itemizedlist|legalnotice|lot|msg|msgexplan|msgmain
|
---|
812 | |msgrel|msgset|msgsub|note|orderedlist|partintro
|
---|
813 | |productionset|qandadiv|refsynopsisdiv|segmentedlist
|
---|
814 | |set|setindex|sidebar|tip|toc|variablelist|warning"
|
---|
815 | mode="xref-to">
|
---|
816 | <xsl:param name="referrer"/>
|
---|
817 | <xsl:param name="xrefstyle"/>
|
---|
818 |
|
---|
819 | <!-- catch-all for things with (possibly optional) titles -->
|
---|
820 | <xsl:apply-templates select="." mode="object.xref.markup">
|
---|
821 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
822 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
823 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
824 | </xsl:apply-templates>
|
---|
825 | </xsl:template>
|
---|
826 |
|
---|
827 | <xsl:template match="author|editor|othercredit|personname" mode="xref-to">
|
---|
828 | <xsl:param name="referrer"/>
|
---|
829 | <xsl:param name="xrefstyle"/>
|
---|
830 |
|
---|
831 | <xsl:call-template name="person.name"/>
|
---|
832 | </xsl:template>
|
---|
833 |
|
---|
834 | <xsl:template match="authorgroup" mode="xref-to">
|
---|
835 | <xsl:param name="referrer"/>
|
---|
836 | <xsl:param name="xrefstyle"/>
|
---|
837 |
|
---|
838 | <xsl:call-template name="person.name.list"/>
|
---|
839 | </xsl:template>
|
---|
840 |
|
---|
841 | <xsl:template match="figure|example|table|equation" mode="xref-to">
|
---|
842 | <xsl:param name="referrer"/>
|
---|
843 | <xsl:param name="xrefstyle"/>
|
---|
844 |
|
---|
845 | <xsl:apply-templates select="." mode="object.xref.markup">
|
---|
846 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
847 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
848 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
849 | </xsl:apply-templates>
|
---|
850 | </xsl:template>
|
---|
851 |
|
---|
852 | <xsl:template match="procedure" mode="xref-to">
|
---|
853 | <xsl:param name="referrer"/>
|
---|
854 | <xsl:param name="xrefstyle"/>
|
---|
855 |
|
---|
856 | <xsl:apply-templates select="." mode="object.xref.markup">
|
---|
857 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
858 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
859 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
860 | </xsl:apply-templates>
|
---|
861 | </xsl:template>
|
---|
862 |
|
---|
863 | <xsl:template match="cmdsynopsis" mode="xref-to">
|
---|
864 | <xsl:param name="referrer"/>
|
---|
865 | <xsl:param name="xrefstyle"/>
|
---|
866 |
|
---|
867 | <xsl:apply-templates select="(.//command)[1]" mode="xref"/>
|
---|
868 | </xsl:template>
|
---|
869 |
|
---|
870 | <xsl:template match="funcsynopsis" mode="xref-to">
|
---|
871 | <xsl:param name="referrer"/>
|
---|
872 | <xsl:param name="xrefstyle"/>
|
---|
873 |
|
---|
874 | <xsl:apply-templates select="(.//function)[1]" mode="xref"/>
|
---|
875 | </xsl:template>
|
---|
876 |
|
---|
877 | <xsl:template match="dedication|preface|chapter|appendix" mode="xref-to">
|
---|
878 | <xsl:param name="referrer"/>
|
---|
879 | <xsl:param name="xrefstyle"/>
|
---|
880 |
|
---|
881 | <xsl:apply-templates select="." mode="object.xref.markup">
|
---|
882 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
883 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
884 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
885 | </xsl:apply-templates>
|
---|
886 | </xsl:template>
|
---|
887 |
|
---|
888 | <xsl:template match="bibliography" mode="xref-to">
|
---|
889 | <xsl:param name="referrer"/>
|
---|
890 | <xsl:param name="xrefstyle"/>
|
---|
891 |
|
---|
892 | <xsl:apply-templates select="." mode="object.xref.markup">
|
---|
893 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
894 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
895 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
896 | </xsl:apply-templates>
|
---|
897 | </xsl:template>
|
---|
898 |
|
---|
899 | <!--
|
---|
900 | <xsl:template match="biblioentry|bibliomixed" mode="xref-to">
|
---|
901 | <xsl:param name="referrer"/>
|
---|
902 | <xsl:param name="xrefstyle"/>
|
---|
903 |
|
---|
904 | <xsl:text>[</xsl:text>
|
---|
905 | <xsl:choose>
|
---|
906 | <xsl:when test="string(.) = ''">
|
---|
907 | <xsl:variable name="bib" select="document($bibliography.collection)"/>
|
---|
908 | <xsl:variable name="id" select="@id"/>
|
---|
909 | <xsl:variable name="entry" select="$bib/bibliography/*[@id=$id][1]"/>
|
---|
910 | <xsl:choose>
|
---|
911 | <xsl:when test="$entry">
|
---|
912 | <xsl:choose>
|
---|
913 | <xsl:when test="$bibliography.numbered != 0">
|
---|
914 | <xsl:number from="bibliography" count="biblioentry|bibliomixed"
|
---|
915 | level="any" format="1"/>
|
---|
916 | </xsl:when>
|
---|
917 | <xsl:when test="local-name($entry/*[1]) = 'abbrev'">
|
---|
918 | <xsl:apply-templates select="$entry/*[1]"/>
|
---|
919 | </xsl:when>
|
---|
920 | <xsl:otherwise>
|
---|
921 | <xsl:value-of select="@id"/>
|
---|
922 | </xsl:otherwise>
|
---|
923 | </xsl:choose>
|
---|
924 | </xsl:when>
|
---|
925 | <xsl:otherwise>
|
---|
926 | <xsl:message>
|
---|
927 | <xsl:text>No bibliography entry: </xsl:text>
|
---|
928 | <xsl:value-of select="$id"/>
|
---|
929 | <xsl:text> found in </xsl:text>
|
---|
930 | <xsl:value-of select="$bibliography.collection"/>
|
---|
931 | </xsl:message>
|
---|
932 | <xsl:value-of select="@id"/>
|
---|
933 | </xsl:otherwise>
|
---|
934 | </xsl:choose>
|
---|
935 | </xsl:when>
|
---|
936 | <xsl:otherwise>
|
---|
937 | <xsl:choose>
|
---|
938 | <xsl:when test="$bibliography.numbered != 0">
|
---|
939 | <xsl:number from="bibliography" count="biblioentry|bibliomixed"
|
---|
940 | level="any" format="1"/>
|
---|
941 | </xsl:when>
|
---|
942 | <xsl:when test="local-name(*[1]) = 'abbrev'">
|
---|
943 | <xsl:apply-templates select="*[1]"/>
|
---|
944 | </xsl:when>
|
---|
945 | <xsl:otherwise>
|
---|
946 | <xsl:value-of select="@id"/>
|
---|
947 | </xsl:otherwise>
|
---|
948 | </xsl:choose>
|
---|
949 | </xsl:otherwise>
|
---|
950 | </xsl:choose>
|
---|
951 | <xsl:text>]</xsl:text>
|
---|
952 | </xsl:template>
|
---|
953 | -->
|
---|
954 |
|
---|
955 | <xsl:template match="glossary" mode="xref-to">
|
---|
956 | <xsl:param name="referrer"/>
|
---|
957 | <xsl:param name="xrefstyle"/>
|
---|
958 |
|
---|
959 | <xsl:apply-templates select="." mode="object.xref.markup">
|
---|
960 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
961 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
962 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
963 | </xsl:apply-templates>
|
---|
964 | </xsl:template>
|
---|
965 |
|
---|
966 | <xsl:template match="glossentry" mode="xref-to">
|
---|
967 | <xsl:choose>
|
---|
968 | <xsl:when test="$glossentry.show.acronym = 'primary'">
|
---|
969 | <xsl:choose>
|
---|
970 | <xsl:when test="acronym|abbrev">
|
---|
971 | <xsl:apply-templates select="(acronym|abbrev)[1]"/>
|
---|
972 | </xsl:when>
|
---|
973 | <xsl:otherwise>
|
---|
974 | <xsl:apply-templates select="glossterm[1]" mode="xref-to"/>
|
---|
975 | </xsl:otherwise>
|
---|
976 | </xsl:choose>
|
---|
977 | </xsl:when>
|
---|
978 | <xsl:otherwise>
|
---|
979 | <xsl:apply-templates select="glossterm[1]" mode="xref-to"/>
|
---|
980 | </xsl:otherwise>
|
---|
981 | </xsl:choose>
|
---|
982 | </xsl:template>
|
---|
983 |
|
---|
984 | <xsl:template match="glossterm" mode="xref-to">
|
---|
985 | <xsl:apply-templates/>
|
---|
986 | </xsl:template>
|
---|
987 |
|
---|
988 | <xsl:template match="index" mode="xref-to">
|
---|
989 | <xsl:param name="referrer"/>
|
---|
990 | <xsl:param name="xrefstyle"/>
|
---|
991 |
|
---|
992 | <xsl:apply-templates select="." mode="object.xref.markup">
|
---|
993 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
994 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
995 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
996 | </xsl:apply-templates>
|
---|
997 | </xsl:template>
|
---|
998 |
|
---|
999 | <xsl:template match="listitem" mode="xref-to">
|
---|
1000 | <xsl:param name="referrer"/>
|
---|
1001 | <xsl:param name="xrefstyle"/>
|
---|
1002 |
|
---|
1003 | <xsl:apply-templates select="." mode="object.xref.markup">
|
---|
1004 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
1005 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
1006 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
1007 | </xsl:apply-templates>
|
---|
1008 | </xsl:template>
|
---|
1009 |
|
---|
1010 | <xsl:template match="section|simplesect
|
---|
1011 | |sect1|sect2|sect3|sect4|sect5
|
---|
1012 | |refsect1|refsect2|refsect3" mode="xref-to">
|
---|
1013 | <xsl:param name="referrer"/>
|
---|
1014 | <xsl:param name="xrefstyle"/>
|
---|
1015 |
|
---|
1016 | <xsl:apply-templates select="." mode="object.xref.markup">
|
---|
1017 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
1018 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
1019 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
1020 | </xsl:apply-templates>
|
---|
1021 | <!-- What about "in Chapter X"? -->
|
---|
1022 | </xsl:template>
|
---|
1023 |
|
---|
1024 | <xsl:template match="bridgehead" mode="xref-to">
|
---|
1025 | <xsl:param name="referrer"/>
|
---|
1026 | <xsl:param name="xrefstyle"/>
|
---|
1027 |
|
---|
1028 | <xsl:apply-templates select="." mode="object.xref.markup">
|
---|
1029 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
1030 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
1031 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
1032 | </xsl:apply-templates>
|
---|
1033 | <!-- What about "in Chapter X"? -->
|
---|
1034 | </xsl:template>
|
---|
1035 |
|
---|
1036 | <xsl:template match="qandaset" mode="xref-to">
|
---|
1037 | <xsl:param name="referrer"/>
|
---|
1038 | <xsl:param name="xrefstyle"/>
|
---|
1039 |
|
---|
1040 | <xsl:apply-templates select="." mode="object.xref.markup">
|
---|
1041 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
1042 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
1043 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
1044 | </xsl:apply-templates>
|
---|
1045 | </xsl:template>
|
---|
1046 |
|
---|
1047 | <xsl:template match="qandadiv" mode="xref-to">
|
---|
1048 | <xsl:param name="referrer"/>
|
---|
1049 | <xsl:param name="xrefstyle"/>
|
---|
1050 |
|
---|
1051 | <xsl:apply-templates select="." mode="object.xref.markup">
|
---|
1052 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
1053 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
1054 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
1055 | </xsl:apply-templates>
|
---|
1056 | </xsl:template>
|
---|
1057 |
|
---|
1058 | <xsl:template match="qandaentry" mode="xref-to">
|
---|
1059 | <xsl:param name="referrer"/>
|
---|
1060 | <xsl:param name="xrefstyle"/>
|
---|
1061 |
|
---|
1062 | <xsl:apply-templates select="question[1]" mode="object.xref.markup">
|
---|
1063 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
1064 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
1065 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
1066 | </xsl:apply-templates>
|
---|
1067 | </xsl:template>
|
---|
1068 |
|
---|
1069 | <xsl:template match="question|answer" mode="xref-to">
|
---|
1070 | <xsl:param name="referrer"/>
|
---|
1071 | <xsl:param name="xrefstyle"/>
|
---|
1072 |
|
---|
1073 | <xsl:apply-templates select="." mode="object.xref.markup">
|
---|
1074 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
1075 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
1076 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
1077 | </xsl:apply-templates>
|
---|
1078 | </xsl:template>
|
---|
1079 |
|
---|
1080 | <xsl:template match="part|reference" mode="xref-to">
|
---|
1081 | <xsl:param name="referrer"/>
|
---|
1082 | <xsl:param name="xrefstyle"/>
|
---|
1083 |
|
---|
1084 | <xsl:apply-templates select="." mode="object.xref.markup">
|
---|
1085 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
1086 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
1087 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
1088 | </xsl:apply-templates>
|
---|
1089 | </xsl:template>
|
---|
1090 |
|
---|
1091 | <xsl:template match="refentry" mode="xref-to">
|
---|
1092 | <xsl:param name="referrer"/>
|
---|
1093 | <xsl:param name="xrefstyle"/>
|
---|
1094 |
|
---|
1095 | <xsl:choose>
|
---|
1096 | <xsl:when test="refmeta/refentrytitle">
|
---|
1097 | <xsl:apply-templates select="refmeta/refentrytitle"/>
|
---|
1098 | </xsl:when>
|
---|
1099 | <xsl:otherwise>
|
---|
1100 | <xsl:apply-templates select="refnamediv/refname[1]"/>
|
---|
1101 | </xsl:otherwise>
|
---|
1102 | </xsl:choose>
|
---|
1103 | <xsl:apply-templates select="refmeta/manvolnum"/>
|
---|
1104 | </xsl:template>
|
---|
1105 |
|
---|
1106 | <xsl:template match="refnamediv" mode="xref-to">
|
---|
1107 | <xsl:param name="referrer"/>
|
---|
1108 | <xsl:param name="xrefstyle"/>
|
---|
1109 |
|
---|
1110 | <xsl:apply-templates select="refname[1]" mode="xref-to">
|
---|
1111 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
1112 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
1113 | </xsl:apply-templates>
|
---|
1114 | </xsl:template>
|
---|
1115 |
|
---|
1116 | <xsl:template match="refname" mode="xref-to">
|
---|
1117 | <xsl:param name="referrer"/>
|
---|
1118 | <xsl:param name="xrefstyle"/>
|
---|
1119 |
|
---|
1120 | <xsl:apply-templates mode="xref-to">
|
---|
1121 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
1122 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
1123 | </xsl:apply-templates>
|
---|
1124 | </xsl:template>
|
---|
1125 |
|
---|
1126 | <xsl:template match="step" mode="xref-to">
|
---|
1127 | <xsl:param name="referrer"/>
|
---|
1128 | <xsl:param name="xrefstyle"/>
|
---|
1129 |
|
---|
1130 | <xsl:call-template name="gentext">
|
---|
1131 | <xsl:with-param name="key" select="'Step'"/>
|
---|
1132 | </xsl:call-template>
|
---|
1133 | <xsl:text> </xsl:text>
|
---|
1134 | <xsl:apply-templates select="." mode="number"/>
|
---|
1135 | </xsl:template>
|
---|
1136 |
|
---|
1137 | <xsl:template match="varlistentry" mode="xref-to">
|
---|
1138 | <xsl:param name="referrer"/>
|
---|
1139 | <xsl:param name="xrefstyle"/>
|
---|
1140 |
|
---|
1141 | <xsl:apply-templates select="term[1]" mode="xref-to">
|
---|
1142 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
1143 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
1144 | </xsl:apply-templates>
|
---|
1145 | </xsl:template>
|
---|
1146 |
|
---|
1147 | <xsl:template match="varlistentry/term" mode="xref-to">
|
---|
1148 | <!-- to avoid the comma that will be generated if there are several terms -->
|
---|
1149 | <xsl:apply-templates/>
|
---|
1150 | </xsl:template>
|
---|
1151 |
|
---|
1152 | <xsl:template match="co" mode="xref-to">
|
---|
1153 | <xsl:param name="referrer"/>
|
---|
1154 | <xsl:param name="xrefstyle"/>
|
---|
1155 |
|
---|
1156 | <xsl:apply-templates select="." mode="callout-bug"/>
|
---|
1157 | </xsl:template>
|
---|
1158 |
|
---|
1159 | <xsl:template match="book" mode="xref-to">
|
---|
1160 | <xsl:param name="referrer"/>
|
---|
1161 | <xsl:param name="xrefstyle"/>
|
---|
1162 |
|
---|
1163 | <xsl:apply-templates select="." mode="object.xref.markup">
|
---|
1164 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
1165 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
1166 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
1167 | </xsl:apply-templates>
|
---|
1168 | </xsl:template>
|
---|
1169 |
|
---|
1170 | <xsl:template match="para" mode="xref-to">
|
---|
1171 | <xsl:param name="referrer"/>
|
---|
1172 | <xsl:param name="xrefstyle"/>
|
---|
1173 |
|
---|
1174 | <xsl:variable name="context" select="(ancestor::simplesect
|
---|
1175 | |ancestor::section
|
---|
1176 | |ancestor::sect1
|
---|
1177 | |ancestor::sect2
|
---|
1178 | |ancestor::sect3
|
---|
1179 | |ancestor::sect4
|
---|
1180 | |ancestor::sect5
|
---|
1181 | |ancestor::refsection
|
---|
1182 | |ancestor::refsect1
|
---|
1183 | |ancestor::refsect2
|
---|
1184 | |ancestor::refsect3
|
---|
1185 | |ancestor::chapter
|
---|
1186 | |ancestor::appendix
|
---|
1187 | |ancestor::preface
|
---|
1188 | |ancestor::partintro
|
---|
1189 | |ancestor::dedication
|
---|
1190 | |ancestor::colophon
|
---|
1191 | |ancestor::bibliography
|
---|
1192 | |ancestor::index
|
---|
1193 | |ancestor::glossary
|
---|
1194 | |ancestor::glossentry
|
---|
1195 | |ancestor::listitem
|
---|
1196 | |ancestor::varlistentry)[last()]"/>
|
---|
1197 |
|
---|
1198 | <xsl:apply-templates select="$context" mode="xref-to"/>
|
---|
1199 | <!--
|
---|
1200 | <xsl:apply-templates select="." mode="object.xref.markup">
|
---|
1201 | <xsl:with-param name="purpose" select="'xref'"/>
|
---|
1202 | <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
|
---|
1203 | <xsl:with-param name="referrer" select="$referrer"/>
|
---|
1204 | </xsl:apply-templates>
|
---|
1205 | -->
|
---|
1206 | </xsl:template>
|
---|
1207 |
|
---|
1208 | </xsl:stylesheet>
|
---|