<!-- ==================================================================== -->
-<xsl:import href="../html/docbook.xsl"/>
-<xsl:include href="param.xsl"/>
-<xsl:include href="general.xsl"/>
-<xsl:include href="refentry.xsl"/>
-<xsl:include href="block.xsl"/>
-<xsl:include href="inline.xsl"/>
-<xsl:include href="synop.xsl"/>
-<xsl:include href="lists.xsl"/>
-<xsl:include href="xref.xsl"/>
-
-<!-- Needed for chunker.xsl (for now): -->
-<xsl:param name="chunker.output.method" select="'text'"/>
-<xsl:param name="chunker.output.encoding" select="'ISO-8859-1'"/>
-
-<xsl:output method="text"
- encoding="ISO-8859-1"
- indent="no"/>
-
-<!-- if document does not contain at least one refentry, then emit a -->
-<!-- message and stop -->
-<xsl:template match="/">
- <xsl:choose>
- <xsl:when test="//refentry">
- <xsl:apply-templates select="//refentry"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message>No refentry elements!</xsl:message>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<!-- ============================================================== -->
-
-<xsl:template match="refentry">
-
- <xsl:variable name="get.metadata">
- <xsl:call-template name="get.metadata"/>
- </xsl:variable>
-
- <xsl:variable name="metadata" select="exsl:node-set($get.metadata)"/>
-
- <xsl:call-template name="write.text.chunk">
- <xsl:with-param name="filename" select="$metadata/filename"/>
- <xsl:with-param name="content">
-
- <!-- page header (commented-out at top of roff source) -->
- <xsl:call-template name="page.header"/>
-
- <!-- .TH line (sets title stuff and begin and end)-->
- <xsl:call-template name="TH.title.section">
- <xsl:with-param name="reftitle" select="$metadata/reftitle"/>
- <xsl:with-param name="section" select="$metadata/section"/>
- <xsl:with-param name="date" select="$metadata/date"/>
- <xsl:with-param name="productname" select="$metadata/productname"/>
- <xsl:with-param name="extra3" select="$metadata/extra3"/>
- </xsl:call-template>
-
- <!-- main body of man page -->
- <xsl:call-template name="main.body"/>
-
- <!-- AUTHOR section (at end of man page) -->
- <xsl:call-template name="author.section"/>
-
- </xsl:with-param>
- </xsl:call-template>
- <!-- Now generate stub include pages for every page documented in
- this refentry (except the page itself) -->
- <xsl:for-each select="refnamediv/refname">
- <xsl:if test=". != $metadata/name">
- <xsl:call-template name="write.text.chunk">
- <xsl:with-param name="filename"
- select="concat(normalize-space(.), '.',
- $metadata/section)"/>
- <xsl:with-param
- name="content"
- select="concat('.so man',
- $metadata/section,
- '/',
- $metadata/name,
- '.',
- $metadata/section,
- ' ')"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:for-each>
-</xsl:template>
-
-<xsl:template match="refmeta"></xsl:template>
-<xsl:template match="title"></xsl:template>
-<xsl:template match="abstract"></xsl:template>
-
-<!-- ============================================================== -->
-
-<!-- Named templates for each part of output page -->
-
-<!-- ============================================================== -->
-
-<!-- * page header comment part at top of roff source; unrendered -->
-<!-- * TH line "title" lines at top/botton of rendered page~ -->
-<!-- * main body the bulk of the rendered page -->
-<!-- * AUTHOR section last part of rendered page (usually)-->
-
-<!-- ============================================================== -->
-
-<xsl:template name="page.header">
- <xsl:text>.\"Generated by db2man.xsl. Don't modify this, modify the source. </xsl:text>
-</xsl:template>
-
-<xsl:template name="TH.title.section">
- <xsl:param name="reftitle"/>
- <xsl:param name="section"/>
- <xsl:param name="date"/>
- <xsl:param name="productname"/>
- <xsl:param name="extra3"/>
-
- <xsl:text>.\" "TITLE" "SECTION NUMBER" "DATE" "PRODUCT" "GROUP TITLE"</xsl:text>
- <xsl:text> </xsl:text>
- <xsl:text>.TH "</xsl:text>
- <xsl:value-of select="translate($reftitle,
- 'abcdefghijklmnopqrstuvwxyz',
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
- <xsl:text>" </xsl:text>
- <xsl:value-of select="$section"/>
- <xsl:text> "</xsl:text>
- <xsl:value-of select="normalize-space($date)"/>
- <xsl:text>" "</xsl:text>
- <xsl:value-of select="normalize-space($productname)"/>
- <xsl:text>" "</xsl:text>
- <xsl:value-of select="normalize-space($extra3)"/>
- <xsl:text>" </xsl:text>
-</xsl:template>
-
-<xsl:template name="main.body">
- <xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template name="author.section">
- <xsl:choose>
- <xsl:when test="info//author">
- <xsl:apply-templates select="info" mode="authorsect"/>
- </xsl:when>
- <xsl:when test="refentryinfo//author">
- <xsl:apply-templates select="refentryinfo" mode="authorsect"/>
- </xsl:when>
- <xsl:when test="/book/bookinfo//author">
- <xsl:apply-templates select="/book/bookinfo" mode="authorsect"/>
- </xsl:when>
- <xsl:when test="/article/articleinfo//author">
- <xsl:apply-templates select="/article/articleinfo" mode="authorsect"/>
- </xsl:when>
- </xsl:choose>
-</xsl:template>
-
-<!-- ============================================================== -->
-
-<!-- Named template for getting metadata -->
-
-<!-- ============================================================== -->
-
-<xsl:template name="get.metadata">
-
- <xsl:variable name="name" select="refnamediv/refname[1]"/>
-
- <xsl:variable name="section">
+ <xsl:import href="../html/docbook.xsl"/>
+ <xsl:include href="param.xsl"/>
+ <xsl:include href="general.xsl"/>
+ <xsl:include href="info.xsl"/>
+ <xsl:include href="refentry.xsl"/>
+ <xsl:include href="block.xsl"/>
+ <xsl:include href="inline.xsl"/>
+ <xsl:include href="synop.xsl"/>
+ <xsl:include href="lists.xsl"/>
+ <xsl:include href="xref.xsl"/>
+
+ <!-- * Needed for chunker.xsl (for now): -->
+ <xsl:param name="chunker.output.method" select="'text'"/>
+ <xsl:param name="chunker.output.encoding" select="'ISO-8859-1'"/>
+
+ <xsl:output method="text"
+ encoding="ISO-8859-1"
+ indent="no"/>
+
+ <!-- * if document does not contain at least one refentry, then emit a -->
+ <!-- * message and stop -->
+ <xsl:template match="/">
<xsl:choose>
- <xsl:when test="refmeta/manvolnum">
- <xsl:value-of select="refmeta/manvolnum[1]"/>
+ <xsl:when test="//refentry">
+ <xsl:apply-templates select="//refentry"/>
</xsl:when>
- <xsl:when test=".//funcsynopsis">3</xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
+ <xsl:otherwise>
+ <xsl:message>No refentry elements!</xsl:message>
+ </xsl:otherwise>
</xsl:choose>
- </xsl:variable>
+ </xsl:template>
+
+ <!-- ============================================================== -->
+
+ <xsl:template match="refentry">
+
+ <xsl:variable name="get.metadata">
+ <xsl:call-template name="get.metadata"/>
+ </xsl:variable>
+
+ <xsl:variable name="metadata" select="exsl:node-set($get.metadata)"/>
+
+ <xsl:call-template name="write.text.chunk">
+ <xsl:with-param name="filename" select="$metadata/filename"/>
+ <xsl:with-param name="content">
+
+ <!-- * top.comment = commented-out section at top of roff source -->
+ <xsl:call-template name="top.comment"/>
+
+ <!-- * TH.title.line = title line in header/footer of man page -->
+ <xsl:call-template name="TH.title.line">
+
+ <!-- * .TH "TITLE" "SECTION" "extra1" "extra2" "extra3" -->
+ <!-- * -->
+ <!-- * extra1 = date of publication of the man page (almost universally) -->
+ <!-- * extra2 = version and/or name of some kind (usually) -->
+ <!-- * extra3 = context description (e.g., often a description of the -->
+ <!-- * group of related applications that the item documented -->
+ <!-- * in the man page belongs to -->
+ <!-- * -->
+ <!-- * .TH TITLE SECTION DATE VERSION/NAME CONTEXT -->
+ <!-- * -->
+ <!-- * If you want to chenge how the .TH line is constructed, change the -->
+ <!-- * order/content of the values of the "select" attributes below. -->
+
+ <xsl:with-param name="title" select="$metadata/title"/>
+ <xsl:with-param name="section" select="$metadata/section"/>
+ <xsl:with-param name="extra1" select="$metadata/date"/>
+ <xsl:with-param name="extra2" select="$metadata/versionorname"/>
+ <xsl:with-param name="extra3" select="$metadata/othermetadata"/>
+ </xsl:call-template>
+
+ <!-- * main body of man page -->
+ <xsl:apply-templates/>
+
+ <!-- * AUTHOR section (at end of man page) -->
+ <xsl:call-template name="author.section"/>
+
+ </xsl:with-param>
+ </xsl:call-template>
- <section>
- <xsl:value-of select="$section"/>
- </section>
-
- <filename>
- <xsl:call-template name="replace-string">
- <!-- replace spaces in source filename with underscores in output filename -->
- <xsl:with-param name="content"
- select="concat(normalize-space ($name), '.', $section)"/>
- <xsl:with-param name="replace" select="' '"/>
- <xsl:with-param name="with" select="'_'"/>
+ <!-- generate "stub" pages (if any) -->
+ <xsl:call-template name="write.stubs">
+ <xsl:with-param name="metadata" select="$metadata"/>
</xsl:call-template>
- </filename>
- <xsl:variable name="reftitle">
- <xsl:choose>
- <xsl:when test="refmeta/refentrytitle">
- <xsl:copy>
- <xsl:apply-templates select="refmeta/refentrytitle/node()"/>
- </xsl:copy>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="$name"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
+ </xsl:template>
- <reftitle>
- <xsl:value-of select="substring($reftitle, 1, 20)"/>
- </reftitle>
+ <!-- * ============================================================== -->
+ <!-- * -->
+ <!-- * top comment comment part at top of roff source; unrendered -->
+ <!-- * TH title line rendererd "title" lines in header/footer of page -->
+ <!-- * -->
+ <!-- * ============================================================== -->
- <date>
- <xsl:choose>
- <xsl:when test="info/date">
- <xsl:copy>
- <xsl:apply-templates select="info/date/node()"/>
- </xsl:copy>
- </xsl:when>
- <xsl:when test="refentryinfo/date">
- <xsl:copy>
- <xsl:apply-templates select="refentryinfo/date/node()"/>
- </xsl:copy>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy>
- <xsl:apply-templates select="../referenceinfo/date/node()"/>
- </xsl:copy>
- </xsl:otherwise>
- </xsl:choose>
- </date>
-
- <productname>
- <xsl:choose>
- <xsl:when test="info/productname">
- <xsl:apply-templates select="info/productname/node()"/>
- </xsl:when>
- <xsl:when test="refentryinfo/productname">
- <xsl:apply-templates select="refentryinfo/productnam/node()"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="../referenceinfo/productname/node()"/>
- </xsl:otherwise>
- </xsl:choose>
- </productname>
-
- <extra3></extra3>
-
-</xsl:template>
-
-<!-- ============================================================== -->
-
-<xsl:template match="info|articleinfo|bookinfo|refentryinfo" mode="authorsect">
- <xsl:text>.SH "</xsl:text>
- <xsl:call-template name="string.upper">
- <xsl:with-param name="string">
- <xsl:call-template name="gentext">
- <xsl:with-param name="key" select="'Author'"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- <xsl:text>" </xsl:text>
-
- <xsl:for-each select=".//author">
- <xsl:if test="position() > 1">
- <xsl:text>, </xsl:text>
- </xsl:if>
- <xsl:apply-templates select="."/>
- </xsl:for-each>
- <xsl:text>. </xsl:text>
- <xsl:if test=".//editor">
- <xsl:text>.br </xsl:text>
- <xsl:apply-templates select=".//editor"/>
- <xsl:text>. (man page) </xsl:text>
- </xsl:if>
- <xsl:for-each select="address">
- <xsl:text>.br </xsl:text>
- <xsl:apply-templates/>
+ <xsl:template name="top.comment">
+ <xsl:text>.\" Generated by: DocBook XSL Stylesheets V</xsl:text>
+ <xsl:value-of select="$VERSION"/>
<xsl:text> </xsl:text>
- </xsl:for-each>
-</xsl:template>
-
-<xsl:template match="author|editor">
- <xsl:call-template name="person.name"/>
- <xsl:if test=".//email">
- <xsl:text> </xsl:text>
- <xsl:apply-templates select=".//email"/>
- </xsl:if>
-</xsl:template>
-
-<xsl:template match="email">
- <xsl:text><</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>></xsl:text>
-</xsl:template>
-
-<xsl:template match="copyright">
- <xsl:text>Copyright \(co </xsl:text>
- <xsl:apply-templates select="./year" />
- <xsl:text>.Sp </xsl:text>
-</xsl:template>
+ <xsl:text>.\" ** Do not edit this file ** </xsl:text>
+ <xsl:text>.\" Instead, edit the DocBook XML source and then use the </xsl:text>
+ <xsl:text>.\" DocBook XSL Stylesheets to regenerate this. </xsl:text>
+ </xsl:template>
+
+ <xsl:template name="TH.title.line">
+
+ <!-- * FYI: Here is how the .TH contents show up in a rendered man page: -->
+ <!-- * -->
+ <!-- * title(section) extra3 title(section) <- page header -->
+ <!-- * -->
+ <!-- * extra2 extra1 title(section) <- page footer-->
+ <!-- * -->
+ <!-- * Note the while extra1, extra2, and extra3 are all optional, almost all -->
+ <!-- * pages include an "extra1", which is almost always a date. -->
+
+ <!-- * Here are a couple of examples of real-world man pages that have -->
+ <!-- * useful page headers/footers: -->
+ <!-- * -->
+ <!-- * GIMP(1) GIMP Manual Pages GIMP(1) -->
+ <!-- * Version 2.2.6 March 23 2004 GIMP(1) -->
+ <!-- * -->
+ <!-- * QT2KDOC(1) KDOC Documentation System QT2KDOC(1) -->
+ <!-- * 2.0a54 2002-03-18 QT2KDOC(1) -->
+ <!-- * -->
+ <!-- * In those examples, extra2 has version data, while extra3 has "context" -->
+ <!-- * data about some larger system the documented item belongs to -->
+
+ <xsl:param name="title"/>
+ <xsl:param name="section"/>
+ <xsl:param name="extra1"/>
+ <xsl:param name="extra2"/>
+ <xsl:param name="extra3"/>
+
+ <!-- * FIXME: th.title.max.length needs to be made into a documented -->
+ <!-- * user-configurable parameter -->
+ <xsl:variable name="th.title.max.length" select="'20'"/>
+
+ <xsl:text>.TH "</xsl:text>
+ <xsl:value-of select="translate(
+ substring($title, 1, $th.title.max.length),
+ 'abcdefghijklmnopqrstuvwxyz',
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ )"/>
+ <xsl:text>" </xsl:text>
+ <xsl:value-of select="$section"/>
+ <xsl:text> "</xsl:text>
+ <xsl:value-of select="normalize-space($extra1)"/>
+ <xsl:text>" "</xsl:text>
+ <xsl:value-of select="normalize-space($extra2)"/>
+ <xsl:text>" "</xsl:text>
+ <xsl:value-of select="normalize-space($extra3)"/>
+ <xsl:text>" </xsl:text>
+ </xsl:template>
+
+ <!-- ============================================================== -->
+
+ <!-- A "stub" is sort of alias for another file - it's simply a file whose -->
+ <!-- complete contents are just a single line of the following form: -->
+ <!-- * -->
+ <!-- * .so manX/realname.X -->
+ <!-- * -->
+ <!-- * "realname" is a name of another man-page file. That .so line is -->
+ <!-- * basically a *roff "include" statement. When the man command finds it, -->
+ <!-- * it includes and displays the contents of the manX/realqname.X file. -->
+ <!-- * -->
+ <!-- * If a refentry has multiple refnames, we generate a "stub" page for -->
+ <!-- * additional refname found. -->
+
+ <xsl:template name="write.stubs">
+ <xsl:param name="metadata"/>
+ <xsl:for-each select="refnamediv/refname">
+ <xsl:if test=". != $metadata/name">
+ <xsl:call-template name="write.text.chunk">
+ <xsl:with-param name="filename"
+ select="concat(normalize-space(.), '.',
+ $metadata/section)"/>
+ <xsl:with-param
+ name="content"
+ select="concat('.so man', $metadata/section, '/',
+ $metadata/name, '.', $metadata/section, ' ')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+
+ <!-- ============================================================== -->
+
+ <xsl:template match="refmeta"></xsl:template>
+ <xsl:template match="title"></xsl:template>
+ <xsl:template match="abstract"></xsl:template>
</xsl:stylesheet>
--- /dev/null
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exsl="http://exslt.org/common"
+ xmlns:date="http://exslt.org/dates-and-times"
+ exclude-result-prefixes="exsl date"
+ version='1.0'>
+
+<!-- ********************************************************************
+ $Id$
+ ********************************************************************
+
+ This file is part of the XSL DocBook Stylesheet distribution.
+ See ../README or http://docbook.sf.net/release/xsl/current/ for
+ copyright and other information.
+
+ ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+ <xsl:template name="get.metadata">
+
+ <!-- * $name & <name> = "real name" of the documented item; for example, in -->
+ <!-- * the case of a command, the <name> is what you would type in on the -->
+ <!-- * command line to run it. -->
+ <xsl:variable name="name" select="refnamediv[1]/refname[1]"/>
+ <name>
+ <xsl:value-of select="$name"/>
+ </name>
+
+ <!-- * $section & <section> = the man "section" that the documented item -->
+ <!-- * is in; if a manvolnum is not 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"] -->
+ <xsl:variable name="section">
+ <xsl:choose>
+ <xsl:when test="refmeta/manvolnum">
+ <xsl:value-of select="refmeta/manvolnum"/>
+ </xsl:when>
+ <xsl:when test=".//funcsynopsis">3</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <section>
+ <xsl:value-of select="$section"/>
+ </section>
+
+ <!-- * <filename> = name.section; for example: xsltproc.1 -->
+ <filename>
+ <xsl:call-template name="replace-string">
+ <!-- replace spaces in source filename with underscores in output filename -->
+ <xsl:with-param name="content"
+ select="concat(normalize-space ($name), '.', $section)"/>
+ <xsl:with-param name="replace" select="' '"/>
+ <xsl:with-param name="with" select="'_'"/>
+ </xsl:call-template>
+ </filename>
+
+ <!-- * <title> = differs from <name> in that, if the refentry has a -->
+ <!-- * refentrytitle, we use that as the <title>; otherwise, we just use the -->
+ <!-- * <name>, which is the first refname in the first refnamediv in the -->
+ <!-- * source; see above -->
+ <title>
+ <xsl:choose>
+ <xsl:when test="refmeta/refentrytitle">
+ <xsl:copy>
+ <xsl:apply-templates select="refmeta/refentrytitle/node()"/>
+ </xsl:copy>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="$name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </title>
+
+ <!-- * <date> is a date :-) If we can't find one, we add one; see below -->
+ <date>
+ <xsl:call-template name="replace-entities">
+ <xsl:with-param name="content">
+ <xsl:choose>
+ <xsl:when test="info/date">
+ <xsl:copy>
+ <xsl:apply-templates select="info/date/node()"/>
+ </xsl:copy>
+ </xsl:when>
+ <xsl:when test="info/pubdate">
+ <xsl:copy>
+ <xsl:apply-templates select="info/pubdate/node()"/>
+ </xsl:copy>
+ </xsl:when>
+ <xsl:when test="refentryinfo/date">
+ <xsl:copy>
+ <xsl:apply-templates select="refentryinfo/date/node()"/>
+ </xsl:copy>
+ </xsl:when>
+ <xsl:when test="refentryinfo/pubdate">
+ <xsl:copy>
+ <xsl:apply-templates select="refentryinfo/pubdate/node()"/>
+ </xsl:copy>
+ </xsl:when>
+ <xsl:when test="../info/date">
+ <xsl:copy>
+ <xsl:apply-templates select="../info/date/node()"/>
+ </xsl:copy>
+ </xsl:when>
+ <xsl:when test="../info/pubdate">
+ <xsl:copy>
+ <xsl:apply-templates select="../info/pubdate/node()"/>
+ </xsl:copy>
+ </xsl:when>
+ <xsl:when test="../referenceinfo/date">
+ <xsl:copy>
+ <xsl:apply-templates select="../referenceinfo/date/node()"/>
+ </xsl:copy>
+ </xsl:when>
+ <xsl:when test="../referenceinfo/pubdate">
+ <xsl:copy>
+ <xsl:apply-templates select="../referenceinfo/pubdate/node()"/>
+ </xsl:copy>
+ </xsl:when>
+ <!-- * If we can't find a date, then we generate a date. -->
+ <!-- * And we make it an appropriately localized date. -->
+ <xsl:otherwise>
+ <xsl:call-template name="datetime.format">
+ <xsl:with-param name="date">
+ <xsl:choose>
+ <xsl:when test="function-available('date:date-time')">
+ <xsl:value-of select="date:date-time()"/>
+ </xsl:when>
+ <xsl:when test="function-available('date:dateTime')">
+ <!-- Xalan quirk -->
+ <xsl:value-of select="date:dateTime()"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:with-param>
+ <xsl:with-param name="format">
+ <xsl:call-template name="gentext.template">
+ <xsl:with-param name="context" select="'datetime'"/>
+ <xsl:with-param name="name" select="'format'"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:with-param>
+ </xsl:call-template>
+ </date>
+
+ <!-- * <versionorname> = (in the best case) we just want to find some kind -->
+ <!-- * of version number. If we can't find that, we try to find a product -->
+ <!-- * name. If we can't find that, we try to find some other kind of info. -->
+ <!-- * And if that fails, well, then we just leave it empty. -->
+ <versionorname>
+ <xsl:choose>
+ <xsl:when test="info/productnumber">
+ <xsl:apply-templates select="info/productnumber/node()"/>
+ </xsl:when>
+ <xsl:when test="refentryinfo/productnumber">
+ <xsl:apply-templates select="refentryinfo/productnumber/node()"/>
+ </xsl:when>
+ <xsl:when test="refmeta/refmiscinfo[@class = 'version']">
+ <xsl:apply-templates select="refmeta/refmiscinfo/node()"/>
+ </xsl:when>
+ <xsl:when test="../info/productnumber">
+ <xsl:apply-templates select="../info/productnumber/node()"/>
+ </xsl:when>
+ <xsl:when test="../referenceinfo/productnumber">
+ <xsl:apply-templates select="../referenceinfo/productnumber/node()"/>
+ </xsl:when>
+ <xsl:when test="info/productname">
+ <xsl:apply-templates select="info/productname/node()"/>
+ </xsl:when>
+ <xsl:when test="refentryinfo/productname">
+ <xsl:apply-templates select="refentryinfo/productnam/node()"/>
+ </xsl:when>
+ <xsl:when test="../info/productname">
+ <xsl:apply-templates select="../info/productnam/node()"/>
+ </xsl:when>
+ <xsl:when test="../referenceinfo/productname">
+ <xsl:apply-templates select="../referenceinfo/productname/node()"/>
+ </xsl:when>
+ <xsl:when test="refmeta/refmiscinfo">
+ <xsl:apply-templates select="refmeta/refmiscinfo[1]/node()"/>
+ </xsl:when>
+ <xsl:when test="refnamediv/refclass">
+ <xsl:apply-templates select="refnamediv[1]/refclass[1]/node()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- found nothing, so leave it empty -->
+ </xsl:otherwise>
+ </xsl:choose>
+ </versionorname>
+
+ <!-- * The <othermetadata> element holds information other than the title, -->
+ <!-- * section number, date, or application/product version/name; typically, -->
+ <!-- * what we want in <othermetadata> is some kind of "context description" -->
+ <!-- * about the item - for example, it is often a description of the -->
+ <!-- * "superset" of applications/functions, etc., that the item documented in -->
+ <!-- * the man page belongs to -->
+ <!-- * -->
+ <!-- * Examples: -->
+ <!-- * -->
+ <!-- * PROGRAM CONTEXT INFO (in TH "extra3") -->
+ <!-- * ======= - ==================================== -->
+ <!-- * dpkg-name - "dpkg utilities" -->
+ <!-- * GET - "User Contributed Perl Documentation" -->
+ <!-- * ld - "GNU Development Tools" -->
+ <!-- * ddate - "Emperor Norton Utilities" -->
+ <!-- * dh_clean - "Debhelper" -->
+ <!-- * faked - "Debian GNU/Linux manual" -->
+ <!-- * gimp - "GIMP Manual Pages" -->
+ <!-- * qt2kdoc - "KDOC Documentation System" -->
+ <!-- * -->
+ <!-- * We just leave it empty if we can't find anything to use -->
+ <othermetadata>
+ <xsl:choose>
+ <xsl:when test="../info/title">
+ <xsl:apply-templates select="../info/title/node()"/>
+ </xsl:when>
+ <xsl:when test="../referenceinfo/title">
+ <xsl:apply-templates select="../referenceinfo/title/node()"/>
+ </xsl:when>
+ <xsl:when test="../title">
+ <xsl:apply-templates select="../title/node()"/>
+ </xsl:when>
+ <xsl:when test="refnamediv/refclass">
+ <xsl:apply-templates select="refnamediv[1]/refclass[1]/node()"/>
+ </xsl:when>
+ <xsl:when test="refmeta/refmiscinfo">
+ <xsl:apply-templates select="refmeta/refmiscinfo[1]/node()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- found nothing, so leave it empty -->
+ </xsl:otherwise>
+ </xsl:choose>
+ </othermetadata>
+
+ </xsl:template>
+
+ <!-- * ============================================================== -->
+
+ <xsl:template name="author.section">
+ <xsl:choose>
+ <xsl:when test="info//author">
+ <xsl:apply-templates select="info" mode="authorsect"/>
+ </xsl:when>
+ <xsl:when test="refentryinfo//author">
+ <xsl:apply-templates select="refentryinfo" mode="authorsect"/>
+ </xsl:when>
+ <xsl:when test="/book/bookinfo//author">
+ <xsl:apply-templates select="/book/bookinfo" mode="authorsect"/>
+ </xsl:when>
+ <xsl:when test="/article/articleinfo//author">
+ <xsl:apply-templates select="/article/articleinfo" mode="authorsect"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="info|articleinfo|bookinfo|refentryinfo" mode="authorsect">
+ <xsl:text>.SH "</xsl:text>
+ <xsl:call-template name="string.upper">
+ <xsl:with-param name="string">
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key" select="'Author'"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ <xsl:text>" </xsl:text>
+
+ <xsl:for-each select=".//author">
+ <xsl:if test="position() > 1">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ <xsl:apply-templates select="."/>
+ </xsl:for-each>
+ <xsl:text>. </xsl:text>
+ <xsl:if test=".//editor">
+ <xsl:text>.br </xsl:text>
+ <xsl:apply-templates select=".//editor"/>
+ <xsl:text>. (man page) </xsl:text>
+ </xsl:if>
+ <xsl:for-each select="address">
+ <xsl:text>.br </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text> </xsl:text>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template match="author|editor">
+ <xsl:call-template name="person.name"/>
+ <xsl:if test=".//email">
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates select=".//email"/>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="email">
+ <xsl:text><</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>></xsl:text>
+ </xsl:template>
+
+ <xsl:template match="copyright">
+ <xsl:text>Copyright \(co </xsl:text>
+ <xsl:apply-templates select="./year" />
+ <xsl:text>.Sp </xsl:text>
+ </xsl:template>
+
+</xsl:stylesheet>