source: clfs-embedded/BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/common/refentry.xsl@ 39a9ea5

Last change on this file since 39a9ea5 was 9882b55, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added the new lfs-xsl stylesheets.

  • Property mode set to 100644
File size: 52.1 KB
RevLine 
[9882b55]1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
4 xmlns:date="http://exslt.org/dates-and-times"
5 exclude-result-prefixes="doc date"
6 version='1.0'>
7
8<!-- ********************************************************************
9 $Id$
10 ********************************************************************
11
12 This file is part of the XSL DocBook Stylesheet distribution.
13 See ../README or http://docbook.sf.net/release/xsl/current/ for
14 copyright and other information.
15
16 ******************************************************************** -->
17
18<!-- ==================================================================== -->
19<doc:reference xmlns="">
20 <referenceinfo>
21 <releaseinfo role="meta">
22 $Id$
23 </releaseinfo>
24 <corpauthor>The DocBook Project</corpauthor>
25 <copyright>
26 <year>2005-2007</year>
27 <holder>The DocBook Project</holder>
28 </copyright>
29 </referenceinfo>
30 <title>Refentry Metadata-Gathering Template Reference</title>
31
32 <partintro id="partintro">
33 <title>Introduction</title>
34
35 <para>This is technical reference documentation for the "refentry
36 metadata gathering" templates in the DocBook XSL Stylesheets.</para>
37
38 <para>This is not intended to be user documentation. It is provided
39 for developers writing customization layers for the
40 stylesheets.</para>
41
42 <note>
43 <para>Currently, only the manpages stylesheets make use of these
44 templates. They are, however, potentially useful elsewhere.</para>
45 </note>
46
47 </partintro>
48
49</doc:reference>
50
51<!-- ==================================================================== -->
52<doc:template name="get.refentry.metadata" xmlns="">
53 <refpurpose>Gathers metadata from a refentry and its ancestors</refpurpose>
54 <refdescription id="get.refentry.metadata-desc">
55 <para>Reference documentation for particular commands, functions,
56 etc., is sometimes viewed in isolation from its greater "context". For
57 example, users view Unix man pages as, well, individual pages, not as
58 part of a "book" of some kind. Therefore, it is sometimes necessary to
59 embed "context" information in output for each <sgmltag>refentry</sgmltag>.</para>
60
61 <para>However, one problem is that different users mark up that
62 context information in different ways. Often (usually), the
63 context information is not actually part of the content of the
64 <sgmltag>refentry</sgmltag> itself, but instead part of the content of a
65 parent or ancestor element to the the <sgmltag>refentry</sgmltag>. And
66 even then, DocBook provides a variety of elements that users might
67 potentially use to mark up the same kind of information. One user
68 might use the <sgmltag>productnumber</sgmltag> element to mark up version
69 information about a particular product, while another might use
70 the <sgmltag>releaseinfo</sgmltag> element.</para>
71
72 <para>Taking all that in mind, the
73 <function>get.refentry.metadata</function> template tries to gather
74 metadata from a <sgmltag>refentry</sgmltag> element and its ancestor
75 elements in an intelligent and user-configurable way. The basic
76 mechanism used in the XPath expressions throughout this stylesheet
77 is to select the relevant metadata from the *info element that is
78 closest to the actual <sgmltag>refentry</sgmltag>&#160;– either on the
79 <sgmltag>refentry</sgmltag> itself, or on its nearest ancestor.</para>
80
81 <note>
82 <para>The <function>get.refentry.metadata</function>
83 template is actually just sort of a "driver" template; it
84 calls other templates that do the actual data collection,
85 then returns the data as a set.</para>
86 </note>
87
88 </refdescription>
89 <refparameter id="get.refentry.metadata-params">
90 <variablelist>
91 <varlistentry>
92 <term>refname</term>
93 <listitem>
94 <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
95 </listitem>
96 </varlistentry>
97 <varlistentry>
98 <term>info</term>
99 <listitem>
100 <para>A set of info nodes (from a <sgmltag>refentry</sgmltag>
101 element and its ancestors)</para>
102 </listitem>
103 </varlistentry>
104 <varlistentry>
105 <term>prefs</term>
106 <listitem>
107 <para>A node containing user preferences (from global
108 stylesheet parameters)</para>
109 </listitem>
110 </varlistentry>
111 </variablelist>
112 </refparameter>
113 <refreturn id="get.refentry.metadata-returns">
114 <para>Returns a node set with the following elements. The
115 descriptions are verbatim from the <literal>man(7)</literal> man
116 page.
117 <variablelist>
118 <varlistentry>
119 <term>title</term>
120 <listitem>
121 <para>the title of the man page (e.g., <literal>MAN</literal>)</para>
122 </listitem>
123 </varlistentry>
124 <varlistentry>
125 <term>section</term>
126 <listitem>
127 <para>the section number the man page should be placed in (e.g.,
128 <literal>7</literal>)</para>
129 </listitem>
130 </varlistentry>
131 <varlistentry>
132 <term>date</term>
133 <listitem>
134 <para>the date of the last revision</para>
135 </listitem>
136 </varlistentry>
137 <varlistentry>
138 <term>source</term>
139 <listitem>
140 <para>the source of the command</para>
141 </listitem>
142 </varlistentry>
143 <varlistentry>
144 <term>manual</term>
145 <listitem>
146 <para>the title of the manual (e.g., <citetitle>Linux
147 Programmer's Manual</citetitle>)</para>
148 </listitem>
149 </varlistentry>
150 </variablelist>
151 </para>
152 </refreturn>
153</doc:template>
154<xsl:template name="get.refentry.metadata">
155 <xsl:param name="refname"/>
156 <xsl:param name="info"/>
157 <xsl:param name="prefs"/>
158 <title>
159 <xsl:call-template name="get.refentry.title">
160 <xsl:with-param name="refname" select="$refname"/>
161 </xsl:call-template>
162 </title>
163 <section>
164 <xsl:call-template name="get.refentry.section">
165 <xsl:with-param name="refname" select="$refname"/>
166 </xsl:call-template>
167 </section>
168 <date>
169 <xsl:call-template name="get.refentry.date">
170 <xsl:with-param name="info" select="$info"/>
171 <xsl:with-param name="refname" select="$refname"/>
172 <xsl:with-param name="prefs" select="$prefs/DatePrefs"/>
173 </xsl:call-template>
174 </date>
175 <source>
176 <xsl:call-template name="get.refentry.source">
177 <xsl:with-param name="info" select="$info"/>
178 <xsl:with-param name="refname" select="$refname"/>
179 <xsl:with-param name="prefs" select="$prefs/SourcePrefs"/>
180 </xsl:call-template>
181 </source>
182 <manual>
183 <xsl:call-template name="get.refentry.manual">
184 <xsl:with-param name="info" select="$info"/>
185 <xsl:with-param name="refname" select="$refname"/>
186 <xsl:with-param name="prefs" select="$prefs/ManualPrefs"/>
187 </xsl:call-template>
188 </manual>
189</xsl:template>
190
191<!-- ====================================================================== -->
192<doc:template name="get.refentry.title" xmlns="">
193 <refpurpose>Gets title metadata for a refentry</refpurpose>
194 <refdescription id="get.refentry.title-desc">
195 <para>The <literal>man(7)</literal> man page describes this as "the
196 title of the man page (e.g., <literal>MAN</literal>). This differs
197 from <sgmltag>refname</sgmltag> in that, if the <sgmltag>refentry</sgmltag> has a
198 <sgmltag>refentrytitle</sgmltag>, we use that as the <sgmltag>title</sgmltag>;
199 otherwise, we just use first <sgmltag>refname</sgmltag> in the first
200 <sgmltag>refnamediv</sgmltag> in the source.</para>
201 </refdescription>
202 <refparameter id="get.refentry.title-params">
203 <variablelist>
204 <varlistentry>
205 <term>refname</term>
206 <listitem>
207 <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
208 </listitem>
209 </varlistentry>
210 </variablelist>
211 </refparameter>
212 <refreturn id="get.refentry.title-returns">
213 <para>Returns a <sgmltag>title</sgmltag> node.</para></refreturn>
214</doc:template>
215<xsl:template name="get.refentry.title">
216 <xsl:param name="refname"/>
217 <xsl:choose>
218 <xsl:when test="refmeta/refentrytitle">
219 <xsl:copy>
220 <xsl:apply-templates select="refmeta/refentrytitle/node()"/>
221 </xsl:copy>
222 </xsl:when>
223 <xsl:otherwise>
224 <xsl:copy-of select="$refname"/>
225 </xsl:otherwise>
226 </xsl:choose>
227</xsl:template>
228
229<!-- ==================================================================== -->
230<doc:template name="get.refentry.section" xmlns="">
231 <refpurpose>Gets section metadata for a refentry</refpurpose>
232 <refdescription id="get.refentry.section-desc">
233 <para>The <literal>man(7)</literal> man page describes this as "the
234 section number the man page should be placed in (e.g.,
235 <literal>7</literal>)". If we do not find a <sgmltag>manvolnum</sgmltag>
236 specified in the source, and we find that the <sgmltag>refentry</sgmltag> is
237 for a function, we use the section number <literal>3</literal>
238 ["Library calls (functions within program libraries)"]; otherwise, we
239 default to using <literal>1</literal> ["Executable programs or shell
240 commands"].</para>
241 </refdescription>
242 <refparameter id="get.refentry.section-params">
243 <variablelist>
244 <varlistentry>
245 <term>refname</term>
246 <listitem>
247 <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
248 </listitem>
249 </varlistentry>
250 <varlistentry>
251 <term>quiet</term>
252 <listitem>
253 <para>If non-zero, no "missing" message is emitted</para>
254 </listitem>
255 </varlistentry>
256 </variablelist>
257 </refparameter>
258 <refreturn id="get.refentry.section-returns">
259 <para>Returns a string representing a section number.</para></refreturn>
260</doc:template>
261<xsl:template name="get.refentry.section">
262 <xsl:param name="refname"/>
263 <xsl:param name="quiet" select="0"/>
264 <xsl:choose>
265 <xsl:when test="refmeta/manvolnum">
266 <xsl:value-of select="refmeta/manvolnum"/>
267 </xsl:when>
268 <xsl:otherwise>
269 <xsl:if test="$quiet = 0">
270 <xsl:if test="$refentry.meta.get.quietly = 0">
271 <xsl:call-template name="log.message">
272 <xsl:with-param name="level">Note</xsl:with-param>
273 <xsl:with-param name="source" select="$refname"/>
274 <xsl:with-param name="context-desc">meta manvol</xsl:with-param>
275 <xsl:with-param name="message">
276 <xsl:text>no refentry/refmeta/manvolnum</xsl:text>
277 </xsl:with-param>
278 </xsl:call-template>
279 <xsl:call-template name="log.message">
280 <xsl:with-param name="level">Note</xsl:with-param>
281 <xsl:with-param name="source" select="$refname"/>
282 <xsl:with-param name="context-desc">meta manvol</xsl:with-param>
283 <xsl:with-param name="message">
284 <xsl:text>see http://docbook.sf.net/el/manvolnum</xsl:text>
285 </xsl:with-param>
286 </xsl:call-template>
287 </xsl:if>
288 </xsl:if>
289 <xsl:choose>
290 <xsl:when test=".//funcsynopsis">
291 <xsl:if test="$quiet = 0">
292 <xsl:if test="$refentry.meta.get.quietly = 0">
293 <xsl:call-template name="log.message">
294 <xsl:with-param name="level">Note</xsl:with-param>
295 <xsl:with-param name="source" select="$refname"/>
296 <xsl:with-param name="context-desc">meta manvol</xsl:with-param>
297 <xsl:with-param name="message">
298 <xsl:text>Setting man section to 3</xsl:text>
299 </xsl:with-param>
300 </xsl:call-template>
301 </xsl:if>
302 </xsl:if>
303 <xsl:text>3</xsl:text>
304 </xsl:when>
305 <xsl:otherwise>
306 <xsl:text>1</xsl:text>
307 </xsl:otherwise>
308 </xsl:choose>
309 </xsl:otherwise>
310 </xsl:choose>
311</xsl:template>
312
313<!-- ==================================================================== -->
314<doc:template name="get.refentry.date" xmlns="">
315 <refpurpose>Gets date metadata for a refentry</refpurpose>
316 <refdescription id="get.refentry.date-desc">
317 <para>The <literal>man(7)</literal> man page describes this as "the
318 date of the last revision". If we cannot find a date in the source, we
319 generate one.</para>
320 </refdescription>
321 <refparameter id="get.refentry.date-params">
322 <variablelist>
323 <varlistentry>
324 <term>refname</term>
325 <listitem>
326 <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
327 </listitem>
328 </varlistentry>
329 <varlistentry>
330 <term>info</term>
331 <listitem>
332 <para>A set of info nodes (from a <sgmltag>refentry</sgmltag>
333 element and its ancestors)</para>
334 </listitem>
335 </varlistentry>
336 <varlistentry>
337 <term>prefs</term>
338 <listitem>
339 <para>A node containing users preferences (from global stylesheet parameters)</para>
340 </listitem>
341 </varlistentry>
342 </variablelist>
343 </refparameter>
344 <refreturn id="get.refentry.date-returns">
345 <para>Returns a <sgmltag>date</sgmltag> node.</para>
346 </refreturn>
347</doc:template>
348<xsl:template name="get.refentry.date">
349 <xsl:param name="refname"/>
350 <xsl:param name="info"/>
351 <xsl:param name="prefs"/>
352 <xsl:variable name="Date">
353 <xsl:choose>
354 <!-- * if profiling is enabled for date, and the date -->
355 <!-- * profile is non-empty, use it -->
356 <xsl:when test="not($prefs/@profileEnabled = 0) and
357 not($prefs/@profile = '')">
358 <xsl:call-template name="evaluate.info.profile">
359 <xsl:with-param name="profile" select="$prefs/@profile"/>
360 <xsl:with-param name="info" select="$info"/>
361 </xsl:call-template>
362 </xsl:when>
363 <xsl:otherwise>
364 <!-- * either profiling is not enabled for date, or the-->
365 <!-- * date profile is empty, so we need to look for date -->
366 <!-- * in *info -->
367 <xsl:choose>
368 <!-- * look for date or pubdate in *info -->
369 <xsl:when test="$info/date/node()
370 |$info/pubdate/node()">
371 <xsl:apply-templates
372 select="(($info[date])[last()]/date)[1]|
373 (($info[pubdate])[last()]/pubdate)[1]"/>
374 </xsl:when>
375 <xsl:otherwise>
376 <!-- * found no Date or Pubdate -->
377 </xsl:otherwise>
378 </xsl:choose>
379 </xsl:otherwise>
380 </xsl:choose>
381 </xsl:variable>
382 <xsl:choose>
383 <xsl:when test="not($Date = '')">
384 <xsl:value-of select="$Date"/>
385 </xsl:when>
386 <!-- * We couldn't find a date, so we generate a date. -->
387 <!-- * And we make it an appropriately localized date. -->
388 <xsl:otherwise>
389 <xsl:if test="$refentry.meta.get.quietly = 0">
390 <xsl:call-template name="log.message">
391 <xsl:with-param name="level">Note</xsl:with-param>
392 <xsl:with-param name="source" select="$refname"/>
393 <xsl:with-param name="context-desc">meta date</xsl:with-param>
394 <xsl:with-param name="message">
395 <xsl:text>no date; using generated date</xsl:text>
396 </xsl:with-param>
397 </xsl:call-template>
398 <xsl:call-template name="log.message">
399 <xsl:with-param name="level">Note</xsl:with-param>
400 <xsl:with-param name="source" select="$refname"/>
401 <xsl:with-param name="context-desc">meta date</xsl:with-param>
402 <xsl:with-param name="message">
403 <xsl:text>see http://docbook.sf.net/el/date</xsl:text>
404 </xsl:with-param>
405 </xsl:call-template>
406 </xsl:if>
407 <xsl:call-template name="datetime.format">
408 <xsl:with-param name="date">
409 <xsl:choose>
410 <xsl:when test="function-available('date:date-time')">
411 <xsl:value-of select="date:date-time()"/>
412 </xsl:when>
413 <xsl:when test="function-available('date:dateTime')">
414 <!-- Xalan quirk -->
415 <xsl:value-of select="date:dateTime()"/>
416 </xsl:when>
417 </xsl:choose>
418 </xsl:with-param>
419 <xsl:with-param name="format">
420 <xsl:call-template name="gentext.template">
421 <xsl:with-param name="context" select="'datetime'"/>
422 <xsl:with-param name="name" select="'format'"/>
423 </xsl:call-template>
424 </xsl:with-param>
425 </xsl:call-template>
426 </xsl:otherwise>
427 </xsl:choose>
428</xsl:template>
429
430<!-- ==================================================================== -->
431<doc:template name="get.refentry.source" xmlns="">
432 <refpurpose>Gets source metadata for a refentry</refpurpose>
433 <refdescription id="get.refentry.source-desc">
434 <para>The <literal>man(7)</literal> man page describes this as "the
435 source of the command", and provides the following examples:
436 <itemizedlist>
437 <listitem>
438 <para>For binaries, use something like: GNU, NET-2, SLS
439 Distribution, MCC Distribution.</para>
440 </listitem>
441 <listitem>
442 <para>For system calls, use the version of the kernel that you are
443 currently looking at: Linux 0.99.11.</para>
444 </listitem>
445 <listitem>
446 <para>For library calls, use the source of the function: GNU, BSD
447 4.3, Linux DLL 4.4.1.</para>
448 </listitem>
449 </itemizedlist>
450 </para>
451
452 <para>The <literal>solbook(5)</literal> man page describes
453 something very much like what <literal>man(7)</literal> calls
454 "source", except that <literal>solbook(5)</literal> names it
455 "software" and describes it like this:
456 <blockquote>
457 <para>This is the name of the software product that the topic
458 discussed on the reference page belongs to. For example UNIX
459 commands are part of the <literal>SunOS x.x</literal>
460 release.</para>
461 </blockquote>
462 </para>
463
464 <para>In practice, there are many pages that simply have a version
465 number in the "source" field. So, it looks like what we have is a
466 two-part field,
467 <replaceable>Name</replaceable>&#160;<replaceable>Version</replaceable>,
468 where:
469 <variablelist>
470 <varlistentry>
471 <term>Name</term>
472 <listitem>
473 <para>product name (e.g., BSD) or org. name (e.g., GNU)</para>
474 </listitem>
475 </varlistentry>
476 <varlistentry>
477 <term>Version</term>
478 <listitem>
479 <para>version name</para>
480 </listitem>
481 </varlistentry>
482 </variablelist>
483 Each part is optional. If the <replaceable>Name</replaceable> is a
484 product name, then the <replaceable>Version</replaceable> is probably
485 the version of the product. Or there may be no
486 <replaceable>Name</replaceable>, in which case, if there is a
487 <replaceable>Version</replaceable>, it is probably the version of the
488 item itself, not the product it is part of. Or, if the
489 <replaceable>Name</replaceable> is an organization name, then there
490 probably will be no <replaceable>Version</replaceable>.
491 </para>
492 </refdescription>
493 <refparameter id="get.refentry.source-params">
494 <variablelist>
495 <varlistentry>
496 <term>refname</term>
497 <listitem>
498 <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
499 </listitem>
500 </varlistentry>
501 <varlistentry>
502 <term>info</term>
503 <listitem>
504 <para>A set of info nodes (from a <sgmltag>refentry</sgmltag>
505 element and its ancestors)</para>
506 </listitem>
507 </varlistentry>
508 <varlistentry>
509 <term>prefs</term>
510 <listitem>
511 <para>A node containing users preferences (from global
512 stylesheet parameters)</para>
513 </listitem>
514 </varlistentry>
515 </variablelist>
516 </refparameter>
517 <refreturn id="get.refentry.source-returns">
518 <para>Returns a <sgmltag>source</sgmltag> node.</para>
519 </refreturn>
520</doc:template>
521<xsl:template name="get.refentry.source">
522 <xsl:param name="refname"/>
523 <xsl:param name="info"/>
524 <xsl:param name="prefs"/>
525 <xsl:variable name="Name">
526 <xsl:if test="$prefs/Name/@suppress = 0">
527 <xsl:call-template name="get.refentry.source.name">
528 <xsl:with-param name="info" select="$info"/>
529 <xsl:with-param name="refname" select="$refname"/>
530 <xsl:with-param name="prefs" select="$prefs/Name"/>
531 </xsl:call-template>
532 </xsl:if>
533 </xsl:variable>
534 <xsl:variable name="Version">
535 <xsl:if test="$prefs/Version/@suppress = 0">
536 <xsl:call-template name="get.refentry.version">
537 <xsl:with-param name="info" select="$info"/>
538 <xsl:with-param name="refname" select="$refname"/>
539 <xsl:with-param name="prefs" select="$prefs/Version"/>
540 </xsl:call-template>
541 </xsl:if>
542 </xsl:variable>
543 <xsl:choose>
544 <!-- * if we have a Name and/or Version, use either or both -->
545 <!-- * of those, in the form "Name Version" or just "Name" -->
546 <!-- * or just "Version" -->
547 <xsl:when test="not($Name = '') or not($Version = '')">
548 <xsl:choose>
549 <xsl:when test="not($Name = '') and not($Version = '')">
550 <xsl:copy-of select="$Name"/>
551 <xsl:text> </xsl:text>
552 </xsl:when>
553 <xsl:otherwise>
554 <xsl:copy-of select="$Name"/>
555 </xsl:otherwise>
556 </xsl:choose>
557 <xsl:copy-of select="$Version"/>
558 </xsl:when>
559 <!-- * if no Name and no Version, use fallback (if any) -->
560 <xsl:when test="not($prefs/@fallback = '')">
561 <xsl:variable name="source.fallback">
562 <xsl:call-template name="evaluate.info.profile">
563 <xsl:with-param name="profile" select="$prefs/@fallback"/>
564 <xsl:with-param name="info" select="$info"/>
565 </xsl:call-template>
566 </xsl:variable>
567 <xsl:choose>
568 <xsl:when test="not($source.fallback = '')">
569 <xsl:value-of select="$source.fallback"/>
570 </xsl:when>
571 <xsl:otherwise>
572 <xsl:if test="$refentry.meta.get.quietly = 0">
573 <xsl:call-template name="log.message">
574 <xsl:with-param name="level">Warn</xsl:with-param>
575 <xsl:with-param name="source" select="$refname"/>
576 <xsl:with-param name="context-desc">meta source</xsl:with-param>
577 <xsl:with-param name="message">
578 <xsl:text>no valid fallback for source; leaving empty</xsl:text>
579 </xsl:with-param>
580 </xsl:call-template>
581 </xsl:if>
582 </xsl:otherwise>
583 </xsl:choose>
584 </xsl:when>
585 <xsl:otherwise>
586 <xsl:if test="$refentry.meta.get.quietly = 0">
587 <xsl:call-template name="log.message">
588 <xsl:with-param name="level">Warn</xsl:with-param>
589 <xsl:with-param name="source" select="$refname"/>
590 <xsl:with-param name="context-desc">meta source</xsl:with-param>
591 <xsl:with-param name="message">
592 <xsl:text>no source fallback specified; leaving empty</xsl:text>
593 </xsl:with-param>
594 </xsl:call-template>
595 </xsl:if>
596 </xsl:otherwise>
597 </xsl:choose>
598</xsl:template>
599
600<!-- ==================================================================== -->
601<doc:template name="get.refentry.source.name" xmlns="">
602 <refpurpose>Gets source-name metadata for a refentry</refpurpose>
603 <refdescription id="get.refentry.source.name-desc">
604 <para>A "source name" is one part of a (potentially) two-part
605 <replaceable>Name</replaceable>&#160;<replaceable>Version</replaceable>
606 source field. For more details, see the documentation for the
607 <function>get.refentry.source</function> template.</para>
608 </refdescription>
609 <refparameter id="get.refentry.source.name-params">
610 <variablelist>
611 <varlistentry>
612 <term>refname</term>
613 <listitem>
614 <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
615 </listitem>
616 </varlistentry>
617 <varlistentry>
618 <term>info</term>
619 <listitem>
620 <para>A set of info nodes (from a <sgmltag>refentry</sgmltag>
621 element and its ancestors)</para>
622 </listitem>
623 </varlistentry>
624 <varlistentry>
625 <term>prefs</term>
626 <listitem>
627 <para>A node containing users preferences (from global
628 stylesheet parameters)</para>
629 </listitem>
630 </varlistentry>
631 </variablelist>
632 </refparameter>
633 <refreturn id="get.refentry.source.name-returns">
634 <para>Depending on what output method is used for the
635 current stylesheet, either returns a text node or possibly an element
636 node, containing "source name" data.</para>
637 </refreturn>
638</doc:template>
639<xsl:template name="get.refentry.source.name">
640 <xsl:param name="refname"/>
641 <xsl:param name="info"/>
642 <xsl:param name="prefs"/>
643 <xsl:choose>
644 <!-- * if profiling is enabled for source.name, and the -->
645 <!-- * source.name profile is non-empty, use it -->
646 <xsl:when test="not($prefs/@profileEnabled = 0) and
647 not($prefs/@profile = '')">
648 <xsl:call-template name="evaluate.info.profile">
649 <xsl:with-param name="profile" select="$prefs/@profile"/>
650 <xsl:with-param name="info" select="$info"/>
651 </xsl:call-template>
652 </xsl:when>
653 <xsl:otherwise>
654 <!-- * either profiling for source.name is not enabled, or-->
655 <!-- * the source.name profile is empty; so we need to look -->
656 <!-- * for a name to use -->
657 <xsl:choose>
658 <xsl:when test="refmeta/refmiscinfo[@class = 'source' or @class = 'software']">
659 <xsl:apply-templates
660 select="refmeta/refmiscinfo[@class = 'source' or @class='software'][1]/node()"/>
661 </xsl:when>
662 <xsl:otherwise>
663 <xsl:choose>
664 <xsl:when test="$info/productname">
665 <xsl:call-template name="set.refentry.metadata">
666 <xsl:with-param name="refname" select="$refname"/>
667 <xsl:with-param
668 name="info"
669 select="($info[productname])[last()]"/>
670 <xsl:with-param
671 name="contents"
672 select="(($info[productname])[last()]/productname)[1]"/>
673 <xsl:with-param name="context">source</xsl:with-param>
674 </xsl:call-template>
675 </xsl:when>
676 <xsl:when test="$info/corpname">
677 <xsl:call-template name="set.refentry.metadata">
678 <xsl:with-param name="refname" select="$refname"/>
679 <xsl:with-param
680 name="info"
681 select="($info[corpname])[last()]"/>
682 <xsl:with-param
683 name="contents"
684 select="(($info[corpname])[last()]/corpname)[1]"/>
685 <xsl:with-param name="context">source</xsl:with-param>
686 <xsl:with-param name="preferred">productname</xsl:with-param>
687 </xsl:call-template>
688 </xsl:when>
689 <xsl:when test="$info/corpcredit">
690 <xsl:call-template name="set.refentry.metadata">
691 <xsl:with-param name="refname" select="$refname"/>
692 <xsl:with-param
693 name="info"
694 select="($info[corpcredit])[last()]"/>
695 <xsl:with-param
696 name="contents"
697 select="(($info[corpcredit])[last()]/corpcredit)[1]"/>
698 <xsl:with-param name="context">source</xsl:with-param>
699 <xsl:with-param name="preferred">productname</xsl:with-param>
700 </xsl:call-template>
701 </xsl:when>
702 <xsl:when test="$info/corpauthor">
703 <xsl:call-template name="set.refentry.metadata">
704 <xsl:with-param name="refname" select="$refname"/>
705 <xsl:with-param
706 name="info"
707 select="($info[corpauthor])[last()]"/>
708 <xsl:with-param
709 name="contents"
710 select="(($info[corpauthor])[last()]/corpauthor)[1]"/>
711 <xsl:with-param name="context">source</xsl:with-param>
712 <xsl:with-param name="preferred">productname</xsl:with-param>
713 </xsl:call-template>
714 </xsl:when>
715 <xsl:when test="$info//orgname">
716 <xsl:call-template name="set.refentry.metadata">
717 <xsl:with-param name="refname" select="$refname"/>
718 <xsl:with-param
719 name="info"
720 select="($info[//orgname])[last()]"/>
721 <xsl:with-param
722 name="contents"
723 select="(($info[//orgname])[last()]//orgname)[1]"/>
724 <xsl:with-param name="context">source</xsl:with-param>
725 <xsl:with-param name="preferred">productname</xsl:with-param>
726 </xsl:call-template>
727 </xsl:when>
728 <xsl:when test="$info//publishername">
729 <xsl:call-template name="set.refentry.metadata">
730 <xsl:with-param name="refname" select="$refname"/>
731 <xsl:with-param
732 name="info"
733 select="($info[//publishername])[last()]"/>
734 <xsl:with-param
735 name="contents"
736 select="(($info[//publishername])[last()]//publishername)[1]"/>
737 <xsl:with-param name="context">source</xsl:with-param>
738 <xsl:with-param name="preferred">productname</xsl:with-param>
739 </xsl:call-template>
740 </xsl:when>
741 <xsl:otherwise>
742 <xsl:if test="$refentry.meta.get.quietly = 0">
743 <xsl:call-template name="log.message">
744 <xsl:with-param name="level">Note</xsl:with-param>
745 <xsl:with-param name="source" select="$refname"/>
746 <xsl:with-param name="context-desc">meta source</xsl:with-param>
747 <xsl:with-param name="message">
748 <xsl:text>no *info/productname or alternative</xsl:text>
749 </xsl:with-param>
750 </xsl:call-template>
751 <xsl:call-template name="log.message">
752 <xsl:with-param name="level">Note</xsl:with-param>
753 <xsl:with-param name="source" select="$refname"/>
754 <xsl:with-param name="context-desc">meta source</xsl:with-param>
755 <xsl:with-param name="message">
756 <xsl:text>see http://docbook.sf.net/el/productname</xsl:text>
757 </xsl:with-param>
758 </xsl:call-template>
759 <xsl:call-template name="log.message">
760 <xsl:with-param name="level">Note</xsl:with-param>
761 <xsl:with-param name="source" select="$refname"/>
762 <xsl:with-param name="context-desc">meta source</xsl:with-param>
763 <xsl:with-param name="message">
764 <xsl:text>no refentry/refmeta/refmiscinfo@class=source</xsl:text>
765 </xsl:with-param>
766 </xsl:call-template>
767 <xsl:call-template name="log.message">
768 <xsl:with-param name="level">Note</xsl:with-param>
769 <xsl:with-param name="source" select="$refname"/>
770 <xsl:with-param name="context-desc">meta source</xsl:with-param>
771 <xsl:with-param name="message">
772 <xsl:text>see http://docbook.sf.net/el/refmiscinfo</xsl:text>
773 </xsl:with-param>
774 </xsl:call-template>
775 </xsl:if>
776 </xsl:otherwise>
777 </xsl:choose>
778 </xsl:otherwise>
779 </xsl:choose>
780 </xsl:otherwise>
781 </xsl:choose>
782</xsl:template>
783
784<!-- ==================================================================== -->
785<doc:template name="get.refentry.version" xmlns="">
786 <refpurpose>Gets version metadata for a refentry</refpurpose>
787 <refdescription id="get.refentry.version-desc">
788 <para>A "version" is one part of a (potentially) two-part
789 <replaceable>Name</replaceable>&#160;<replaceable>Version</replaceable>
790 source field. For more details, see the documentation for the
791 <function>get.refentry.source</function> template.</para>
792 </refdescription>
793 <refparameter id="get.refentry.version-params">
794 <variablelist>
795 <varlistentry>
796 <term>refname</term>
797 <listitem>
798 <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
799 </listitem>
800 </varlistentry>
801 <varlistentry>
802 <term>info</term>
803 <listitem>
804 <para>A set of info nodes (from a <sgmltag>refentry</sgmltag>
805 element and its ancestors)</para>
806 </listitem>
807 </varlistentry>
808 <varlistentry>
809 <term>prefs</term>
810 <listitem>
811 <para>A node containing users preferences (from global
812 stylesheet parameters)</para>
813 </listitem>
814 </varlistentry>
815 </variablelist>
816 </refparameter>
817 <refreturn id="get.refentry.version-returns">
818 <para>Depending on what output method is used for the
819 current stylesheet, either returns a text node or possibly an element
820 node, containing "version" data.</para>
821 </refreturn>
822</doc:template>
823<xsl:template name="get.refentry.version">
824 <xsl:param name="refname"/>
825 <xsl:param name="info"/>
826 <xsl:param name="prefs"/>
827 <xsl:choose>
828 <!-- * if profiling is enabled for version, and the -->
829 <!-- * version profile is non-empty, use it -->
830 <xsl:when test="not($prefs/@profileEnabled = 0) and
831 not($prefs/@profile = '')">
832 <xsl:call-template name="evaluate.info.profile">
833 <xsl:with-param name="profile" select="$prefs/@profile"/>
834 <xsl:with-param name="info" select="$info"/>
835 </xsl:call-template>
836 </xsl:when>
837 <xsl:otherwise>
838 <!-- * either profiling for source.name is not enabled, or-->
839 <!-- * the source.name profile is empty; so we need to look -->
840 <!-- * for a name to use -->
841 <xsl:choose>
842 <xsl:when test="refmeta/refmiscinfo[@class = 'version']">
843 <xsl:apply-templates
844 select="refmeta/refmiscinfo[@class = 'version'][1]/node()"/>
845 </xsl:when>
846 <xsl:otherwise>
847 <xsl:choose>
848 <xsl:when test="$info/productnumber">
849 <xsl:call-template name="set.refentry.metadata">
850 <xsl:with-param name="refname" select="$refname"/>
851 <xsl:with-param
852 name="info"
853 select="($info[productnumber])[last()]"/>
854 <xsl:with-param
855 name="contents"
856 select="(($info[productnumber])[last()]/productnumber)[1]"/>
857 <xsl:with-param name="context">version</xsl:with-param>
858 </xsl:call-template>
859 </xsl:when>
860 <xsl:when test="$info/edition">
861 <xsl:call-template name="set.refentry.metadata">
862 <xsl:with-param name="refname" select="$refname"/>
863 <xsl:with-param
864 name="info"
865 select="($info[edition])[last()]"/>
866 <xsl:with-param
867 name="contents"
868 select="(($info[edition])[last()]/edition)[1]"/>
869 <xsl:with-param name="context">version</xsl:with-param>
870 <xsl:with-param name="preferred">productnumber</xsl:with-param>
871 </xsl:call-template>
872 </xsl:when>
873 <xsl:when test="$info/releaseinfo">
874 <xsl:call-template name="set.refentry.metadata">
875 <xsl:with-param name="refname" select="$refname"/>
876 <xsl:with-param
877 name="info"
878 select="($info[releaseinfo])[last()]"/>
879 <xsl:with-param
880 name="contents"
881 select="(($info[releaseinfo])[last()]/releaseinfo)[1]"/>
882 <xsl:with-param name="context">version</xsl:with-param>
883 <xsl:with-param name="preferred">productnumber</xsl:with-param>
884 </xsl:call-template>
885 </xsl:when>
886 <xsl:otherwise>
887 <xsl:if test="$refentry.meta.get.quietly = 0">
888 <xsl:call-template name="log.message">
889 <xsl:with-param name="level">Note</xsl:with-param>
890 <xsl:with-param name="source" select="$refname"/>
891 <xsl:with-param name="context-desc">meta version</xsl:with-param>
892 <xsl:with-param name="message">
893 <xsl:text>no *info/productnumber or alternative</xsl:text>
894 </xsl:with-param>
895 </xsl:call-template>
896 <xsl:call-template name="log.message">
897 <xsl:with-param name="level">Note</xsl:with-param>
898 <xsl:with-param name="source" select="$refname"/>
899 <xsl:with-param name="context-desc">meta version</xsl:with-param>
900 <xsl:with-param name="message">
901 <xsl:text>see http://docbook.sf.net/el/productnumber</xsl:text>
902 </xsl:with-param>
903 </xsl:call-template>
904 <xsl:call-template name="log.message">
905 <xsl:with-param name="level">Note</xsl:with-param>
906 <xsl:with-param name="source" select="$refname"/>
907 <xsl:with-param name="context-desc">meta version</xsl:with-param>
908 <xsl:with-param name="message">
909 <xsl:text>no refentry/refmeta/refmiscinfo@class=version</xsl:text>
910 </xsl:with-param>
911 </xsl:call-template>
912 <xsl:call-template name="log.message">
913 <xsl:with-param name="level">Note</xsl:with-param>
914 <xsl:with-param name="source" select="$refname"/>
915 <xsl:with-param name="context-desc">meta version</xsl:with-param>
916 <xsl:with-param name="message">
917 <xsl:text>see http://docbook.sf.net/el/refmiscinfo</xsl:text>
918 </xsl:with-param>
919 </xsl:call-template>
920 </xsl:if>
921 </xsl:otherwise>
922 </xsl:choose>
923 </xsl:otherwise>
924 </xsl:choose>
925 </xsl:otherwise>
926 </xsl:choose>
927</xsl:template>
928
929<!-- ==================================================================== -->
930<doc:template name="get.refentry.manual" xmlns="">
931 <refpurpose>Gets source metadata for a refentry</refpurpose>
932 <refdescription id="get.refentry.manual-desc">
933 <para>The <literal>man(7)</literal> man page describes this as "the
934 title of the manual (e.g., <citetitle>Linux Programmer's
935 Manual</citetitle>)". Here are some examples from existing man pages:
936 <itemizedlist>
937 <listitem>
938 <para><citetitle>dpkg utilities</citetitle>
939 (<command>dpkg-name</command>)</para>
940 </listitem>
941 <listitem>
942 <para><citetitle>User Contributed Perl Documentation</citetitle>
943 (<command>GET</command>)</para>
944 </listitem>
945 <listitem>
946 <para><citetitle>GNU Development Tools</citetitle>
947 (<command>ld</command>)</para>
948 </listitem>
949 <listitem>
950 <para><citetitle>Emperor Norton Utilities</citetitle>
951 (<command>ddate</command>)</para>
952 </listitem>
953 <listitem>
954 <para><citetitle>Debian GNU/Linux manual</citetitle>
955 (<command>faked</command>)</para>
956 </listitem>
957 <listitem>
958 <para><citetitle>GIMP Manual Pages</citetitle>
959 (<command>gimp</command>)</para>
960 </listitem>
961 <listitem>
962 <para><citetitle>KDOC Documentation System</citetitle>
963 (<command>qt2kdoc</command>)</para>
964 </listitem>
965 </itemizedlist>
966 </para>
967
968 <para>The <literal>solbook(5)</literal> man page describes
969 something very much like what <literal>man(7)</literal> calls
970 "manual", except that <literal>solbook(5)</literal> names it
971 "sectdesc" and describes it like this:
972 <blockquote>
973 <para>This is the section title of the reference page; for
974 example <literal>User Commands</literal>.</para>
975 </blockquote>
976 </para>
977
978 </refdescription>
979 <refparameter id="get.refentry.manual-params">
980 <variablelist>
981 <varlistentry>
982 <term>refname</term>
983 <listitem>
984 <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
985 </listitem>
986 </varlistentry>
987 <varlistentry>
988 <term>info</term>
989 <listitem>
990 <para>A set of info nodes (from a <sgmltag>refentry</sgmltag>
991 element and its ancestors)</para>
992 </listitem>
993 </varlistentry>
994 <varlistentry>
995 <term>prefs</term>
996 <listitem>
997 <para>A node containing users preferences (from global
998 stylesheet parameters)</para>
999 </listitem>
1000 </varlistentry>
1001 </variablelist>
1002 </refparameter>
1003 <refreturn id="get.refentry.manual-returns">
1004 <para>Returns a <sgmltag>manual</sgmltag> node.</para>
1005 </refreturn>
1006</doc:template>
1007<xsl:template name="get.refentry.manual">
1008 <xsl:param name="refname"/>
1009 <xsl:param name="info"/>
1010 <xsl:param name="prefs"/>
1011 <xsl:variable name="Manual">
1012 <xsl:choose>
1013 <!-- * if profiling is enabled for manual, and the manual -->
1014 <!-- * profile is non-empty, use it -->
1015 <xsl:when test="not($prefs/@profileEnabled = 0) and
1016 not($prefs/@profile = '')">
1017 <xsl:call-template name="evaluate.info.profile">
1018 <xsl:with-param name="profile" select="$prefs/@profile"/>
1019 <xsl:with-param name="info" select="$info"/>
1020 </xsl:call-template>
1021 </xsl:when>
1022 <xsl:otherwise>
1023 <xsl:choose>
1024 <xsl:when test="refmeta/refmiscinfo[@class = 'manual' or @class = 'sectdesc']">
1025 <xsl:apply-templates
1026 select="refmeta/refmiscinfo[@class = 'manual' or @class = 'sectdesc'][1]/node()"/>
1027 </xsl:when>
1028 <xsl:otherwise>
1029 <!-- * only in the case of choosing appropriate -->
1030 <!-- * "manual" content do we select the furthest -->
1031 <!-- * (first) matching element instead of the -->
1032 <!-- * closest (last) matching one -->
1033 <xsl:choose>
1034 <xsl:when test="ancestor::*/title">
1035 <xsl:call-template name="set.refentry.metadata">
1036 <xsl:with-param name="refname" select="$refname"/>
1037 <xsl:with-param
1038 name="info"
1039 select="(ancestor::*[title])[1]"/>
1040 <xsl:with-param
1041 name="contents"
1042 select="(ancestor::*[title])[1]/title"/>
1043 <xsl:with-param name="context">manual</xsl:with-param>
1044 </xsl:call-template>
1045 </xsl:when>
1046 <xsl:when test="$info/title">
1047 <xsl:call-template name="set.refentry.metadata">
1048 <xsl:with-param name="refname" select="$refname"/>
1049 <xsl:with-param
1050 name="info"
1051 select="($info[title])[1]"/>
1052 <xsl:with-param
1053 name="contents"
1054 select="(($info[title])[1]/title)[1]"/>
1055 <xsl:with-param name="context">manual</xsl:with-param>
1056 </xsl:call-template>
1057 </xsl:when>
1058 <xsl:otherwise>
1059 <xsl:if test="$refentry.meta.get.quietly = 0">
1060 <xsl:call-template name="log.message">
1061 <xsl:with-param name="level">Note</xsl:with-param>
1062 <xsl:with-param name="source" select="$refname"/>
1063 <xsl:with-param name="context-desc">meta manual</xsl:with-param>
1064 <xsl:with-param name="message">
1065 <xsl:text>no titled ancestor of refentry</xsl:text>
1066 </xsl:with-param>
1067 </xsl:call-template>
1068 <xsl:call-template name="log.message">
1069 <xsl:with-param name="level">Note</xsl:with-param>
1070 <xsl:with-param name="source" select="$refname"/>
1071 <xsl:with-param name="context-desc">meta manual</xsl:with-param>
1072 <xsl:with-param name="message">
1073 <xsl:text>no refentry/refmeta/refmiscinfo@class=manual</xsl:text>
1074 </xsl:with-param>
1075 </xsl:call-template>
1076 <xsl:call-template name="log.message">
1077 <xsl:with-param name="level">Note</xsl:with-param>
1078 <xsl:with-param name="source" select="$refname"/>
1079 <xsl:with-param name="context-desc">meta manual</xsl:with-param>
1080 <xsl:with-param name="message">
1081 <xsl:text>see http://docbook.sf.net/el/refmiscinfo</xsl:text>
1082 </xsl:with-param>
1083 </xsl:call-template>
1084 </xsl:if>
1085 </xsl:otherwise>
1086 </xsl:choose>
1087 </xsl:otherwise>
1088 </xsl:choose>
1089 </xsl:otherwise>
1090 </xsl:choose>
1091 </xsl:variable>
1092 <xsl:choose>
1093 <xsl:when test="not($Manual = '')">
1094 <xsl:copy-of select="$Manual"/>
1095 </xsl:when>
1096 <!-- * if no Manual, use contents of specified Fallback (if any) -->
1097 <xsl:when test="not($prefs/@fallback = '')">
1098 <xsl:variable name="manual.fallback">
1099 <xsl:call-template name="evaluate.info.profile">
1100 <xsl:with-param name="profile" select="$prefs/@fallback"/>
1101 <xsl:with-param name="info" select="$info"/>
1102 </xsl:call-template>
1103 </xsl:variable>
1104 <xsl:choose>
1105 <xsl:when test="not($manual.fallback = '')">
1106 <xsl:value-of select="$manual.fallback"/>
1107 </xsl:when>
1108 <xsl:otherwise>
1109 <xsl:if test="$refentry.meta.get.quietly = 0">
1110 <xsl:call-template name="log.message">
1111 <xsl:with-param name="level">Warn</xsl:with-param>
1112 <xsl:with-param name="source" select="$refname"/>
1113 <xsl:with-param name="context-desc">meta manual</xsl:with-param>
1114 <xsl:with-param name="message">
1115 <xsl:text>no valid fallback for manual; leaving empty</xsl:text>
1116 </xsl:with-param>
1117 </xsl:call-template>
1118 </xsl:if>
1119 </xsl:otherwise>
1120 </xsl:choose>
1121
1122 </xsl:when>
1123 <xsl:otherwise>
1124 <xsl:if test="$refentry.meta.get.quietly = 0">
1125 <xsl:call-template name="log.message">
1126 <xsl:with-param name="level">Warn</xsl:with-param>
1127 <xsl:with-param name="source" select="$refname"/>
1128 <xsl:with-param name="context-desc">meta manual</xsl:with-param>
1129 <xsl:with-param name="message">
1130 <xsl:text>no manual fallback specified; leaving empty</xsl:text>
1131 </xsl:with-param>
1132 </xsl:call-template>
1133 </xsl:if>
1134 </xsl:otherwise>
1135 </xsl:choose>
1136</xsl:template>
1137
1138<!-- ====================================================================== -->
1139<doc:template name="get.refentry.metadata.prefs" xmlns="">
1140 <refpurpose>Gets user preferences for refentry metadata gathering</refpurpose>
1141 <refdescription id="get.refentry.metadata.prefs-desc">
1142 <para>The DocBook XSL stylesheets include several user-configurable
1143 global stylesheet parameters for controlling <sgmltag>refentry</sgmltag>
1144 metadata gathering. Those parameters are not read directly by the
1145 other <sgmltag>refentry</sgmltag> metadata-gathering
1146 templates. Instead, they are read only by the
1147 <function>get.refentry.metadata.prefs</function> template,
1148 which assembles them into a structure that is then passed to
1149 the other <sgmltag>refentry</sgmltag> metadata-gathering
1150 templates.</para>
1151
1152 <para>So the, <function>get.refentry.metadata.prefs</function>
1153 template is the only interface to collecting stylesheet parameters for
1154 controlling <sgmltag>refentry</sgmltag> metadata gathering.</para>
1155 </refdescription>
1156 <refparameter id="get.refentry.metadata.prefs-params">
1157 <para>There are no local parameters for this template; however, it
1158 does rely on a number of global parameters.</para>
1159 </refparameter>
1160 <refreturn id="get.refentry.metadata.prefs-returns">
1161 <para>Returns a <sgmltag>manual</sgmltag> node.</para>
1162 </refreturn>
1163</doc:template>
1164<xsl:template name="get.refentry.metadata.prefs">
1165 <DatePrefs>
1166 <xsl:attribute name="profile">
1167 <xsl:value-of select="$refentry.date.profile"/>
1168 </xsl:attribute>
1169 <xsl:attribute name="profileEnabled">
1170 <xsl:value-of select="$refentry.date.profile.enabled"/>
1171 </xsl:attribute>
1172 </DatePrefs>
1173 <SourcePrefs>
1174 <xsl:attribute name="fallback">
1175 <xsl:value-of select="$refentry.source.fallback.profile"/>
1176 </xsl:attribute>
1177 <Name>
1178 <xsl:attribute name="profile">
1179 <xsl:value-of select="$refentry.source.name.profile"/>
1180 </xsl:attribute>
1181 <xsl:attribute name="profileEnabled">
1182 <xsl:value-of select="$refentry.source.name.profile.enabled"/>
1183 </xsl:attribute>
1184 <xsl:attribute name="suppress">
1185 <xsl:value-of select="$refentry.source.name.suppress"/>
1186 </xsl:attribute>
1187 </Name>
1188 <Version>
1189 <xsl:attribute name="profile">
1190 <xsl:value-of select="$refentry.version.profile"/>
1191 </xsl:attribute>
1192 <xsl:attribute name="profileEnabled">
1193 <xsl:value-of select="$refentry.version.profile.enabled"/>
1194 </xsl:attribute>
1195 <xsl:attribute name="suppress">
1196 <xsl:value-of select="$refentry.version.suppress"/>
1197 </xsl:attribute>
1198 </Version>
1199 </SourcePrefs>
1200 <ManualPrefs>
1201 <xsl:attribute name="fallback">
1202 <xsl:value-of select="$refentry.manual.fallback.profile"/>
1203 </xsl:attribute>
1204 <xsl:attribute name="profile">
1205 <xsl:value-of select="$refentry.manual.profile"/>
1206 </xsl:attribute>
1207 <xsl:attribute name="profileEnabled">
1208 <xsl:value-of select="$refentry.manual.profile.enabled"/>
1209 </xsl:attribute>
1210 </ManualPrefs>
1211</xsl:template>
1212
1213<!-- ====================================================================== -->
1214<doc:template name="set.refentry.metadata" xmlns="">
1215 <refpurpose>Sets content of a refentry metadata item</refpurpose>
1216 <refdescription id="set.refentry.metadata-desc">
1217 <para>The <function>set.refentry.metadata</function> template is
1218 called each time a suitable source element is found for a certain
1219 metadata field.</para>
1220 </refdescription>
1221 <refparameter id="set.refentry.metadata-params">
1222 <variablelist>
1223 <varlistentry>
1224 <term>refname</term>
1225 <listitem>
1226 <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
1227 </listitem>
1228 </varlistentry>
1229 <varlistentry>
1230 <term>info</term>
1231 <listitem>
1232 <para>A single *info node that contains the selected source element.</para>
1233 </listitem>
1234 </varlistentry>
1235 <varlistentry>
1236 <term>contents</term>
1237 <listitem>
1238 <para>A node containing the selected source element.</para>
1239 </listitem>
1240 </varlistentry>
1241 <varlistentry>
1242 <term>context</term>
1243 <listitem>
1244 <para>A string describing the metadata context in which the
1245 <function>set.refentry.metadata</function> template was
1246 called: either "date", "source", "version", or "manual".</para>
1247 </listitem>
1248 </varlistentry>
1249 </variablelist>
1250 </refparameter>
1251 <refreturn id="set.refentry.metadata-returns">
1252 <para>Returns formatted contents of a selected source element.</para></refreturn>
1253</doc:template>
1254<xsl:template name="set.refentry.metadata">
1255 <xsl:param name="refname"/>
1256 <xsl:param name="info"/>
1257 <xsl:param name="contents"/>
1258 <xsl:param name="context"/>
1259 <xsl:param name="preferred"/>
1260 <xsl:if test="not($preferred = '')">
1261 <xsl:if test="$refentry.meta.get.quietly = 0">
1262 <xsl:call-template name="log.message">
1263 <xsl:with-param name="level">Note</xsl:with-param>
1264 <xsl:with-param name="source" select="$refname"/>
1265 <xsl:with-param name="context-desc" select="concat('meta ', $context)"/>
1266 <xsl:with-param name="message" select="concat('No ', $preferred)"/>
1267 </xsl:call-template>
1268 <xsl:call-template name="log.message">
1269 <xsl:with-param name="level">Note</xsl:with-param>
1270 <xsl:with-param name="source" select="$refname"/>
1271 <xsl:with-param name="context-desc" select="concat('meta ', $context)"/>
1272 <xsl:with-param name="message">
1273 <xsl:text>no refentry/refmeta/refmiscinfo@class=</xsl:text>
1274 <xsl:value-of select="$context"/>
1275 </xsl:with-param>
1276 </xsl:call-template>
1277 <xsl:call-template name="log.message">
1278 <xsl:with-param name="level">Note</xsl:with-param>
1279 <xsl:with-param name="source" select="$refname"/>
1280 <xsl:with-param name="context-desc" select="concat('meta ', $context)"/>
1281 <xsl:with-param name="message" select="concat('Using ', local-name($contents))"/>
1282 </xsl:call-template>
1283 </xsl:if>
1284 </xsl:if>
1285 <xsl:value-of select="$contents"/>
1286</xsl:template>
1287
1288</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.