$Id$
The DocBook Project2005-2007The DocBook ProjectRefentry Metadata-Gathering Template ReferenceIntroductionThis is technical reference documentation for the "refentry
metadata gathering" templates in the DocBook XSL Stylesheets.This is not intended to be user documentation. It is provided
for developers writing customization layers for the
stylesheets.Currently, only the manpages stylesheets make use of these
templates. They are, however, potentially useful elsewhere.Gathers metadata from a refentry and its ancestorsReference documentation for particular commands, functions,
etc., is sometimes viewed in isolation from its greater "context". For
example, users view Unix man pages as, well, individual pages, not as
part of a "book" of some kind. Therefore, it is sometimes necessary to
embed "context" information in output for each refentry.However, one problem is that different users mark up that
context information in different ways. Often (usually), the
context information is not actually part of the content of the
refentry itself, but instead part of the content of a
parent or ancestor element to the the refentry. And
even then, DocBook provides a variety of elements that users might
potentially use to mark up the same kind of information. One user
might use the productnumber element to mark up version
information about a particular product, while another might use
the releaseinfo element.Taking all that in mind, the
get.refentry.metadata template tries to gather
metadata from a refentry element and its ancestor
elements in an intelligent and user-configurable way. The basic
mechanism used in the XPath expressions throughout this stylesheet
is to select the relevant metadata from the *info element that is
closest to the actual refentry – either on the
refentry itself, or on its nearest ancestor.The get.refentry.metadata
template is actually just sort of a "driver" template; it
calls other templates that do the actual data collection,
then returns the data as a set.refnameThe first refname in the refentryinfoA set of info nodes (from a refentry
element and its ancestors)prefsA node containing user preferences (from global
stylesheet parameters)Returns a node set with the following elements. The
descriptions are verbatim from the man(7) man
page.
titlethe title of the man page (e.g., MAN)sectionthe section number the man page should be placed in (e.g.,
7)datethe date of the last revisionsourcethe source of the commandmanualthe title of the manual (e.g., Linux
Programmer's Manual)Gets title metadata for a refentryThe man(7) man page describes this as "the
title of the man page (e.g., MAN). This differs
from refname in that, if the refentry has a
refentrytitle, we use that as the title;
otherwise, we just use first refname in the first
refnamediv in the source.refnameThe first refname in the refentryReturns a title node.Gets section metadata for a refentryThe man(7) man page describes this as "the
section number the man page should be placed in (e.g.,
7)". If we do not find a manvolnum
specified in the source, and we find that the refentry is
for a function, we use the section number 3
["Library calls (functions within program libraries)"]; otherwise, we
default to using 1 ["Executable programs or shell
commands"].refnameThe first refname in the refentryquietIf non-zero, no "missing" message is emittedReturns a string representing a section number.Notemeta manvolno refentry/refmeta/manvolnumNotemeta manvolsee http://docbook.sf.net/el/manvolnumNotemeta manvolSetting man section to 331Gets date metadata for a refentryThe man(7) man page describes this as "the
date of the last revision". If we cannot find a date in the source, we
generate one.refnameThe first refname in the refentryinfoA set of info nodes (from a refentry
element and its ancestors)prefsA node containing users preferences (from global stylesheet parameters)Returns a date node.Notemeta dateno date; using generated dateNotemeta datesee http://docbook.sf.net/el/dateGets source metadata for a refentryThe man(7) man page describes this as "the
source of the command", and provides the following examples:
For binaries, use something like: GNU, NET-2, SLS
Distribution, MCC Distribution.For system calls, use the version of the kernel that you are
currently looking at: Linux 0.99.11.For library calls, use the source of the function: GNU, BSD
4.3, Linux DLL 4.4.1.The solbook(5) man page describes
something very much like what man(7) calls
"source", except that solbook(5) names it
"software" and describes it like this:
This is the name of the software product that the topic
discussed on the reference page belongs to. For example UNIX
commands are part of the SunOS x.x
release.
In practice, there are many pages that simply have a version
number in the "source" field. So, it looks like what we have is a
two-part field,
NameVersion,
where:
Nameproduct name (e.g., BSD) or org. name (e.g., GNU)Versionversion name
Each part is optional. If the Name is a
product name, then the Version is probably
the version of the product. Or there may be no
Name, in which case, if there is a
Version, it is probably the version of the
item itself, not the product it is part of. Or, if the
Name is an organization name, then there
probably will be no Version.
refnameThe first refname in the refentryinfoA set of info nodes (from a refentry
element and its ancestors)prefsA node containing users preferences (from global
stylesheet parameters)Returns a source node.Warnmeta sourceno valid fallback for source; leaving emptyWarnmeta sourceno source fallback specified; leaving emptyGets source-name metadata for a refentryA "source name" is one part of a (potentially) two-part
NameVersion
source field. For more details, see the documentation for the
get.refentry.source template.refnameThe first refname in the refentryinfoA set of info nodes (from a refentry
element and its ancestors)prefsA node containing users preferences (from global
stylesheet parameters)Depending on what output method is used for the
current stylesheet, either returns a text node or possibly an element
node, containing "source name" data.sourcesourceproductnamesourceproductnamesourceproductnamesourceproductnamesourceproductnameNotemeta sourceno *info/productname or alternativeNotemeta sourcesee http://docbook.sf.net/el/productnameNotemeta sourceno refentry/refmeta/refmiscinfo@class=sourceNotemeta sourcesee http://docbook.sf.net/el/refmiscinfoGets version metadata for a refentryA "version" is one part of a (potentially) two-part
NameVersion
source field. For more details, see the documentation for the
get.refentry.source template.refnameThe first refname in the refentryinfoA set of info nodes (from a refentry
element and its ancestors)prefsA node containing users preferences (from global
stylesheet parameters)Depending on what output method is used for the
current stylesheet, either returns a text node or possibly an element
node, containing "version" data.versionversionproductnumberversionproductnumberNotemeta versionno *info/productnumber or alternativeNotemeta versionsee http://docbook.sf.net/el/productnumberNotemeta versionno refentry/refmeta/refmiscinfo@class=versionNotemeta versionsee http://docbook.sf.net/el/refmiscinfoGets source metadata for a refentryThe man(7) man page describes this as "the
title of the manual (e.g., Linux Programmer's
Manual)". Here are some examples from existing man pages:
dpkg utilities
(dpkg-name)User Contributed Perl Documentation
(GET)GNU Development Tools
(ld)Emperor Norton Utilities
(ddate)Debian GNU/Linux manual
(faked)GIMP Manual Pages
(gimp)KDOC Documentation System
(qt2kdoc)The solbook(5) man page describes
something very much like what man(7) calls
"manual", except that solbook(5) names it
"sectdesc" and describes it like this:
This is the section title of the reference page; for
example User Commands.
refnameThe first refname in the refentryinfoA set of info nodes (from a refentry
element and its ancestors)prefsA node containing users preferences (from global
stylesheet parameters)Returns a manual node.manualmanualNotemeta manualno titled ancestor of refentryNotemeta manualno refentry/refmeta/refmiscinfo@class=manualNotemeta manualsee http://docbook.sf.net/el/refmiscinfoWarnmeta manualno valid fallback for manual; leaving emptyWarnmeta manualno manual fallback specified; leaving emptyGets user preferences for refentry metadata gatheringThe DocBook XSL stylesheets include several user-configurable
global stylesheet parameters for controlling refentry
metadata gathering. Those parameters are not read directly by the
other refentry metadata-gathering
templates. Instead, they are read only by the
get.refentry.metadata.prefs template,
which assembles them into a structure that is then passed to
the other refentry metadata-gathering
templates.So the, get.refentry.metadata.prefs
template is the only interface to collecting stylesheet parameters for
controlling refentry metadata gathering.There are no local parameters for this template; however, it
does rely on a number of global parameters.Returns a manual node.Sets content of a refentry metadata itemThe set.refentry.metadata template is
called each time a suitable source element is found for a certain
metadata field.refnameThe first refname in the refentryinfoA single *info node that contains the selected source element.contentsA node containing the selected source element.contextA string describing the metadata context in which the
set.refentry.metadata template was
called: either "date", "source", "version", or "manual".Returns formatted contents of a selected source element.NoteNoteno refentry/refmeta/refmiscinfo@class=Note