source: BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/common/refentry.xsl@ 5699aaf

clfs-3.0.0-systemd systemd
Last change on this file since 5699aaf was f8c4e94, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added LFS XSL Stylesheets.

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