<xsl:value-of select="normalize-space($content)"/>
<xsl:text> </xsl:text>
</xsl:template>
-
+
+<!-- ============================================================== -->
+
+<!-- ** Everything starts here. ** -->
+
<xsl:template match="refentry">
<xsl:variable name="section">
</xsl:choose>
</xsl:variable>
- <!-- replace spaces with underscores in the filename -->
<xsl:variable name="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:call-template name="write.text.chunk">
<xsl:with-param name="filename" select="$filename"/>
<xsl:with-param name="content">
+
+ <!-- generated commented-out page header -->
+ <xsl:call-template name="page.header"/>
+
+ <!-- generate .TH line -->
+ <xsl:call-template name="TH.title.section">
+ <xsl:with-param name="reftitle" select="$reftitle"/>
+ <xsl:with-param name="section" select="$section"/>
+ <xsl:with-param name="date" select="$date"/>
+ <xsl:with-param name="productname" select="$productname"/>
+ <xsl:with-param name="title" select="$title"/>
+ </xsl:call-template>
+
+ <!-- generate main body of man page -->
+ <xsl:apply-templates/>
+
+ <!-- generate AUTHOR section at end of man page -->
+
+ </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=". != $name">
+ <xsl:call-template name="write.text.chunk">
+ <xsl:with-param name="filename"
+ select="concat(normalize-space(.), '.', $section)"/>
+ <xsl:with-param name="content" select="concat('.so man',
+ $section, '/', $name, '.', $section, ' ')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template name="page.header">
<xsl:text>.\"Generated by db2man.xsl. Don't modify this, modify the source.
-.de Sh \" Subsection
+.\"
+. \"---------------------------------------------------
+.de Sh \" - a second-level section (a DocBook refsect2)
.br
.if t .Sp
.ne 5
\fB\\$1\fR
.PP
-..
-.de Sp \" Vertical space (when we can't use .PP)
+..\"---------------------------------------------------
+.de Sp \" - vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
-..
-.de Ip \" List item
+..\"---------------------------------------------------
+.de Ip \" - a list item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
-..
-.TH "</xsl:text>
- <xsl:value-of select="translate($reftitle,'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+..\"---------------------------------------------------
+.\"</xsl:text>
+<xsl:text> </xsl:text>
+</xsl:template>
+
+<xsl:template name="TH.title.section">
+ <xsl:param name="title"/>
+ <xsl:param name="reftitle"/>
+ <xsl:param name="section"/>
+ <xsl:param name="date"/>
+ <xsl:param name="productname"/>
+
+ <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($productname)"/>
<xsl:text>" "</xsl:text>
<xsl:value-of select="$title"/>
- <xsl:text>"
-</xsl:text>
- <xsl:apply-templates/>
-
- <!-- Author section -->
- <xsl:choose>
- <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:text>" </xsl:text>
+</xsl:template>
- </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=". != $name">
- <xsl:call-template name="write.text.chunk">
- <xsl:with-param name="filename"
- select="concat(normalize-space(.), '.', $section)"/>
- <xsl:with-param name="content" select="concat('.so man',
- $section, '/', $name, '.', $section, ' ')"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:for-each>
+<xsl:template name="author.section">
+ <xsl:choose>
+ <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="refmeta"></xsl:template>
<xsl:template match="title"></xsl:template>
<xsl:template match="abstract"></xsl:template>
+<!-- ============================================================== -->
+
<xsl:template match="articleinfo|bookinfo|refentryinfo" mode="authorsect">
<xsl:text>.SH "</xsl:text>
<xsl:call-template name="string.upper">