1 <?xml version="1.0"?>
\r
3 <reference xml:id="refentry">
\r
5 <title>Common » Refentry Metadata Template Reference</title>
\r
6 <releaseinfo role="meta">
\r
7 $Id: refentry.xsl 7867 2008-03-07 09:54:25Z xmldoc $
\r
11 <partintro xml:id="partintro">
\r
12 <title>Introduction</title>
\r
14 <para>This is technical reference documentation for the “refentry
\r
15 metadata” templates in the DocBook XSL Stylesheets.</para>
\r
18 <para>This is not intended to be user documentation. It is provided
\r
19 for developers writing customization layers for the stylesheets.</para>
\r
23 <para>Currently, only the manpages stylesheets make use of these
\r
24 templates. They are, however, potentially useful elsewhere.</para>
\r
29 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="template.get.refentry.metadata">
\r
31 <refname>get.refentry.metadata</refname>
\r
32 <refpurpose>Gathers metadata from a refentry and its ancestors</refpurpose>
\r
35 <synopsis><xsl:template name="get.refentry.metadata">
\r
36 <xsl:param name="refname"/>
\r
37 <xsl:param name="info"/>
\r
38 <xsl:param name="prefs"/>
\r
40 </xsl:template></synopsis>
\r
42 <refsect1><title>Description</title>
\r
44 <para>Reference documentation for particular commands, functions,
\r
45 etc., is sometimes viewed in isolation from its greater "context". For
\r
46 example, users view Unix man pages as, well, individual pages, not as
\r
47 part of a "book" of some kind. Therefore, it is sometimes necessary to
\r
48 embed "context" information in output for each <tag>refentry</tag>.</para>
\r
52 <para>However, one problem is that different users mark up that
\r
53 context information in different ways. Often (usually), the
\r
54 context information is not actually part of the content of the
\r
55 <tag>refentry</tag> itself, but instead part of the content of a
\r
56 parent or ancestor element to the <tag>refentry</tag>. And
\r
57 even then, DocBook provides a variety of elements that users might
\r
58 potentially use to mark up the same kind of information. One user
\r
59 might use the <tag>productnumber</tag> element to mark up version
\r
60 information about a particular product, while another might use
\r
61 the <tag>releaseinfo</tag> element.</para>
\r
65 <para>Taking all that in mind, the
\r
66 <function>get.refentry.metadata</function> template tries to gather
\r
67 metadata from a <tag>refentry</tag> element and its ancestor
\r
68 elements in an intelligent and user-configurable way. The basic
\r
69 mechanism used in the XPath expressions throughout this stylesheet
\r
70 is to select the relevant metadata from the *info element that is
\r
71 closest to the actual <tag>refentry</tag> – either on the
\r
72 <tag>refentry</tag> itself, or on its nearest ancestor.</para>
\r
77 <para>The <function>get.refentry.metadata</function>
\r
78 template is actually just sort of a "driver" template; it
\r
79 calls other templates that do the actual data collection,
\r
80 then returns the data as a set.</para>
\r
84 </refsect1><refsect1><title>Parameters</title>
\r
88 <term>refname</term>
\r
91 <para>The first <tag>refname</tag> in the refentry</para>
\r
99 <para>A set of info nodes (from a <tag>refentry</tag>
\r
100 element and its ancestors)</para>
\r
108 <para>A node containing user preferences (from global
\r
109 stylesheet parameters)</para>
\r
115 </refsect1><refsect1><title>Returns</title>
\r
117 <para>Returns a node set with the following elements. The
\r
118 descriptions are verbatim from the <literal>man(7)</literal> man
\r
126 <para>the title of the man page (e.g., <literal>MAN</literal>)</para>
\r
131 <term>section</term>
\r
134 <para>the section number the man page should be placed in (e.g.,
\r
135 <literal>7</literal>)</para>
\r
143 <para>the date of the last revision</para>
\r
148 <term>source</term>
\r
151 <para>the source of the command</para>
\r
156 <term>manual</term>
\r
159 <para>the title of the manual (e.g., <citetitle>Linux
\r
160 Programmer's Manual</citetitle>)</para>
\r
168 </refsect1></refentry>
\r
170 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="template.get.refentry.title">
\r
172 <refname>get.refentry.title</refname>
\r
173 <refpurpose>Gets title metadata for a refentry</refpurpose>
\r
176 <synopsis><xsl:template name="get.refentry.title">
\r
177 <xsl:param name="refname"/>
\r
179 </xsl:template></synopsis>
\r
181 <refsect1><title>Description</title>
\r
183 <para>The <literal>man(7)</literal> man page describes this as "the
\r
184 title of the man page (e.g., <literal>MAN</literal>). This differs
\r
185 from <tag>refname</tag> in that, if the <tag>refentry</tag> has a
\r
186 <tag>refentrytitle</tag>, we use that as the <tag>title</tag>;
\r
187 otherwise, we just use first <tag>refname</tag> in the first
\r
188 <tag>refnamediv</tag> in the source.</para>
\r
190 </refsect1><refsect1><title>Parameters</title>
\r
194 <term>refname</term>
\r
197 <para>The first <tag>refname</tag> in the refentry</para>
\r
203 </refsect1><refsect1><title>Returns</title>
\r
205 <para>Returns a <tag>title</tag> node.</para>
\r
206 </refsect1></refentry>
\r
208 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="template.get.refentry.section">
\r
210 <refname>get.refentry.section</refname>
\r
211 <refpurpose>Gets section metadata for a refentry</refpurpose>
\r
214 <synopsis><xsl:template name="get.refentry.section">
\r
215 <xsl:param name="refname"/>
\r
216 <xsl:param name="quiet" select="0"/>
\r
218 </xsl:template></synopsis>
\r
220 <refsect1><title>Description</title>
\r
222 <para>The <literal>man(7)</literal> man page describes this as "the
\r
223 section number the man page should be placed in (e.g.,
\r
224 <literal>7</literal>)". If we do not find a <tag>manvolnum</tag>
\r
225 specified in the source, and we find that the <tag>refentry</tag> is
\r
226 for a function, we use the section number <literal>3</literal>
\r
227 ["Library calls (functions within program libraries)"]; otherwise, we
\r
228 default to using <literal>1</literal> ["Executable programs or shell
\r
231 </refsect1><refsect1><title>Parameters</title>
\r
235 <term>refname</term>
\r
238 <para>The first <tag>refname</tag> in the refentry</para>
\r
246 <para>If non-zero, no "missing" message is emitted</para>
\r
252 </refsect1><refsect1><title>Returns</title>
\r
254 <para>Returns a string representing a section number.</para>
\r
255 </refsect1></refentry>
\r
257 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="template.get.refentry.date">
\r
259 <refname>get.refentry.date</refname>
\r
260 <refpurpose>Gets date metadata for a refentry</refpurpose>
\r
263 <synopsis><xsl:template name="get.refentry.date">
\r
264 <xsl:param name="refname"/>
\r
265 <xsl:param name="info"/>
\r
266 <xsl:param name="prefs"/>
\r
268 </xsl:template></synopsis>
\r
270 <refsect1><title>Description</title>
\r
272 <para>The <literal>man(7)</literal> man page describes this as "the
\r
273 date of the last revision". If we cannot find a date in the source, we
\r
274 generate one.</para>
\r
276 </refsect1><refsect1><title>Parameters</title>
\r
280 <term>refname</term>
\r
283 <para>The first <tag>refname</tag> in the refentry</para>
\r
291 <para>A set of info nodes (from a <tag>refentry</tag>
\r
292 element and its ancestors)</para>
\r
300 <para>A node containing users preferences (from global stylesheet parameters)</para>
\r
306 </refsect1><refsect1><title>Returns</title>
\r
308 <para>Returns a <tag>date</tag> node.</para>
\r
310 </refsect1></refentry>
\r
312 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="template.get.refentry.source">
\r
314 <refname>get.refentry.source</refname>
\r
315 <refpurpose>Gets source metadata for a refentry</refpurpose>
\r
318 <synopsis><xsl:template name="get.refentry.source">
\r
319 <xsl:param name="refname"/>
\r
320 <xsl:param name="info"/>
\r
321 <xsl:param name="prefs"/>
\r
323 </xsl:template></synopsis>
\r
325 <refsect1><title>Description</title>
\r
327 <para>The <literal>man(7)</literal> man page describes this as "the
\r
328 source of the command", and provides the following examples:
\r
333 <para>For binaries, use something like: GNU, NET-2, SLS
\r
334 Distribution, MCC Distribution.</para>
\r
339 <para>For system calls, use the version of the kernel that you are
\r
340 currently looking at: Linux 0.99.11.</para>
\r
345 <para>For library calls, use the source of the function: GNU, BSD
\r
346 4.3, Linux DLL 4.4.1.</para>
\r
355 <para>The <literal>solbook(5)</literal> man page describes
\r
356 something very much like what <literal>man(7)</literal> calls
\r
357 "source", except that <literal>solbook(5)</literal> names it
\r
358 "software" and describes it like this:
\r
361 <para>This is the name of the software product that the topic
\r
362 discussed on the reference page belongs to. For example UNIX
\r
363 commands are part of the <literal>SunOS x.x</literal>
\r
371 <para>In practice, there are many pages that simply have a version
\r
372 number in the "source" field. So, it looks like what we have is a
\r
374 <replaceable>Name</replaceable> <replaceable>Version</replaceable>,
\r
382 <para>product name (e.g., BSD) or org. name (e.g., GNU)</para>
\r
387 <term>Version</term>
\r
390 <para>version name</para>
\r
396 Each part is optional. If the <replaceable>Name</replaceable> is a
\r
397 product name, then the <replaceable>Version</replaceable> is probably
\r
398 the version of the product. Or there may be no
\r
399 <replaceable>Name</replaceable>, in which case, if there is a
\r
400 <replaceable>Version</replaceable>, it is probably the version of the
\r
401 item itself, not the product it is part of. Or, if the
\r
402 <replaceable>Name</replaceable> is an organization name, then there
\r
403 probably will be no <replaceable>Version</replaceable>.
\r
406 </refsect1><refsect1><title>Parameters</title>
\r
410 <term>refname</term>
\r
413 <para>The first <tag>refname</tag> in the refentry</para>
\r
421 <para>A set of info nodes (from a <tag>refentry</tag>
\r
422 element and its ancestors)</para>
\r
430 <para>A node containing users preferences (from global
\r
431 stylesheet parameters)</para>
\r
437 </refsect1><refsect1><title>Returns</title>
\r
439 <para>Returns a <tag>source</tag> node.</para>
\r
441 </refsect1></refentry>
\r
443 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="template.get.refentry.source.name">
\r
445 <refname>get.refentry.source.name</refname>
\r
446 <refpurpose>Gets source-name metadata for a refentry</refpurpose>
\r
449 <synopsis><xsl:template name="get.refentry.source.name">
\r
450 <xsl:param name="refname"/>
\r
451 <xsl:param name="info"/>
\r
452 <xsl:param name="prefs"/>
\r
454 </xsl:template></synopsis>
\r
456 <refsect1><title>Description</title>
\r
458 <para>A "source name" is one part of a (potentially) two-part
\r
459 <replaceable>Name</replaceable> <replaceable>Version</replaceable>
\r
460 source field. For more details, see the documentation for the
\r
461 <function>get.refentry.source</function> template.</para>
\r
463 </refsect1><refsect1><title>Parameters</title>
\r
467 <term>refname</term>
\r
470 <para>The first <tag>refname</tag> in the refentry</para>
\r
478 <para>A set of info nodes (from a <tag>refentry</tag>
\r
479 element and its ancestors)</para>
\r
487 <para>A node containing users preferences (from global
\r
488 stylesheet parameters)</para>
\r
494 </refsect1><refsect1><title>Returns</title>
\r
496 <para>Depending on what output method is used for the
\r
497 current stylesheet, either returns a text node or possibly an element
\r
498 node, containing "source name" data.</para>
\r
500 </refsect1></refentry>
\r
502 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="template.get.refentry.version">
\r
504 <refname>get.refentry.version</refname>
\r
505 <refpurpose>Gets version metadata for a refentry</refpurpose>
\r
508 <synopsis><xsl:template name="get.refentry.version">
\r
509 <xsl:param name="refname"/>
\r
510 <xsl:param name="info"/>
\r
511 <xsl:param name="prefs"/>
\r
513 </xsl:template></synopsis>
\r
515 <refsect1><title>Description</title>
\r
517 <para>A "version" is one part of a (potentially) two-part
\r
518 <replaceable>Name</replaceable> <replaceable>Version</replaceable>
\r
519 source field. For more details, see the documentation for the
\r
520 <function>get.refentry.source</function> template.</para>
\r
522 </refsect1><refsect1><title>Parameters</title>
\r
526 <term>refname</term>
\r
529 <para>The first <tag>refname</tag> in the refentry</para>
\r
537 <para>A set of info nodes (from a <tag>refentry</tag>
\r
538 element and its ancestors)</para>
\r
546 <para>A node containing users preferences (from global
\r
547 stylesheet parameters)</para>
\r
553 </refsect1><refsect1><title>Returns</title>
\r
555 <para>Depending on what output method is used for the
\r
556 current stylesheet, either returns a text node or possibly an element
\r
557 node, containing "version" data.</para>
\r
559 </refsect1></refentry>
\r
561 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="template.get.refentry.manual">
\r
563 <refname>get.refentry.manual</refname>
\r
564 <refpurpose>Gets source metadata for a refentry</refpurpose>
\r
567 <synopsis><xsl:template name="get.refentry.manual">
\r
568 <xsl:param name="refname"/>
\r
569 <xsl:param name="info"/>
\r
570 <xsl:param name="prefs"/>
\r
572 </xsl:template></synopsis>
\r
574 <refsect1><title>Description</title>
\r
576 <para>The <literal>man(7)</literal> man page describes this as "the
\r
577 title of the manual (e.g., <citetitle>Linux Programmer's
\r
578 Manual</citetitle>)". Here are some examples from existing man pages:
\r
583 <para><citetitle>dpkg utilities</citetitle>
\r
584 (<command>dpkg-name</command>)</para>
\r
589 <para><citetitle>User Contributed Perl Documentation</citetitle>
\r
590 (<command>GET</command>)</para>
\r
595 <para><citetitle>GNU Development Tools</citetitle>
\r
596 (<command>ld</command>)</para>
\r
601 <para><citetitle>Emperor Norton Utilities</citetitle>
\r
602 (<command>ddate</command>)</para>
\r
607 <para><citetitle>Debian GNU/Linux manual</citetitle>
\r
608 (<command>faked</command>)</para>
\r
613 <para><citetitle>GIMP Manual Pages</citetitle>
\r
614 (<command>gimp</command>)</para>
\r
619 <para><citetitle>KDOC Documentation System</citetitle>
\r
620 (<command>qt2kdoc</command>)</para>
\r
629 <para>The <literal>solbook(5)</literal> man page describes
\r
630 something very much like what <literal>man(7)</literal> calls
\r
631 "manual", except that <literal>solbook(5)</literal> names it
\r
632 "sectdesc" and describes it like this:
\r
635 <para>This is the section title of the reference page; for
\r
636 example <literal>User Commands</literal>.</para>
\r
642 </refsect1><refsect1><title>Parameters</title>
\r
646 <term>refname</term>
\r
649 <para>The first <tag>refname</tag> in the refentry</para>
\r
657 <para>A set of info nodes (from a <tag>refentry</tag>
\r
658 element and its ancestors)</para>
\r
666 <para>A node containing users preferences (from global
\r
667 stylesheet parameters)</para>
\r
673 </refsect1><refsect1><title>Returns</title>
\r
675 <para>Returns a <tag>manual</tag> node.</para>
\r
677 </refsect1></refentry>
\r
679 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="template.get.refentry.metadata.prefs">
\r
681 <refname>get.refentry.metadata.prefs</refname>
\r
682 <refpurpose>Gets user preferences for refentry metadata gathering</refpurpose>
\r
685 <synopsis><xsl:template name="get.refentry.metadata.prefs"/></synopsis>
\r
687 <refsect1><title>Description</title>
\r
689 <para>The DocBook XSL stylesheets include several user-configurable
\r
690 global stylesheet parameters for controlling <tag>refentry</tag>
\r
691 metadata gathering. Those parameters are not read directly by the
\r
692 other <tag>refentry</tag> metadata-gathering
\r
693 templates. Instead, they are read only by the
\r
694 <function>get.refentry.metadata.prefs</function> template,
\r
695 which assembles them into a structure that is then passed to
\r
696 the other <tag>refentry</tag> metadata-gathering
\r
701 <para>So the, <function>get.refentry.metadata.prefs</function>
\r
702 template is the only interface to collecting stylesheet parameters for
\r
703 controlling <tag>refentry</tag> metadata gathering.</para>
\r
705 </refsect1><refsect1><title>Parameters</title>
\r
707 <para>There are no local parameters for this template; however, it
\r
708 does rely on a number of global parameters.</para>
\r
710 </refsect1><refsect1><title>Returns</title>
\r
712 <para>Returns a <tag>manual</tag> node.</para>
\r
714 </refsect1></refentry>
\r
716 <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="template.set.refentry.metadata">
\r
718 <refname>set.refentry.metadata</refname>
\r
719 <refpurpose>Sets content of a refentry metadata item</refpurpose>
\r
722 <synopsis><xsl:template name="set.refentry.metadata">
\r
723 <xsl:param name="refname"/>
\r
724 <xsl:param name="info"/>
\r
725 <xsl:param name="contents"/>
\r
726 <xsl:param name="context"/>
\r
727 <xsl:param name="preferred"/>
\r
729 </xsl:template></synopsis>
\r
731 <refsect1><title>Description</title>
\r
733 <para>The <function>set.refentry.metadata</function> template is
\r
734 called each time a suitable source element is found for a certain
\r
735 metadata field.</para>
\r
737 </refsect1><refsect1><title>Parameters</title>
\r
741 <term>refname</term>
\r
744 <para>The first <tag>refname</tag> in the refentry</para>
\r
752 <para>A single *info node that contains the selected source element.</para>
\r
757 <term>contents</term>
\r
760 <para>A node containing the selected source element.</para>
\r
765 <term>context</term>
\r
768 <para>A string describing the metadata context in which the
\r
769 <function>set.refentry.metadata</function> template was
\r
770 called: either "date", "source", "version", or "manual".</para>
\r
776 </refsect1><refsect1><title>Returns</title>
\r
778 <para>Returns formatted contents of a selected source element.</para>
\r
779 </refsect1></refentry>
\r