summaryrefslogtreecommitdiffstats
path: root/kdoctools/docbook/xsl/manpages
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kdoctools/docbook/xsl/manpages
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdoctools/docbook/xsl/manpages')
-rw-r--r--kdoctools/docbook/xsl/manpages/ChangeLog128
-rw-r--r--kdoctools/docbook/xsl/manpages/README10
-rw-r--r--kdoctools/docbook/xsl/manpages/docbook.xsl586
-rw-r--r--kdoctools/docbook/xsl/manpages/lists.xsl143
-rw-r--r--kdoctools/docbook/xsl/manpages/sect23.xsl147
-rw-r--r--kdoctools/docbook/xsl/manpages/synop.xsl197
-rw-r--r--kdoctools/docbook/xsl/manpages/xref.xsl44
7 files changed, 1255 insertions, 0 deletions
diff --git a/kdoctools/docbook/xsl/manpages/ChangeLog b/kdoctools/docbook/xsl/manpages/ChangeLog
new file mode 100644
index 000000000..4cd3815a3
--- /dev/null
+++ b/kdoctools/docbook/xsl/manpages/ChangeLog
@@ -0,0 +1,128 @@
+2004-11-22 <twaugh@users.sourceforge.net>
+
+ * docbook.xsl: Use ASCII escape sequence for '&nbsp;'.
+
+2004-10-21 Michael Smith <xmldoc@users.sourceforge.net>
+
+ * docbook.xsl: Bug #1049155 (support Emphasis tag in man/groff output)
+
+ Added support for converting <emphasis>foo</emphasis> to groff italic
+ and <emphasis role='bold'>foo</emphasis> to bold.
+
+ Controlled by emphasis.propagates.style param, but not documented
+ yet using litprog system. Will do that next (planning to add some
+ other parameter-controllable options for hyphenation and
+ handling of line spacing).
+
+2004-02-04 <twaugh@users.sourceforge.net>
+
+ * docbook.xsl, lists.xsl: Place-holder implementation for simplelist.
+
+2004-01-30 <twaugh@users.sourceforge.net>
+
+ * docbook.xsl: Add replacement dingbat characters.
+
+2003-12-24 <twaugh@users.sourceforge.net>
+
+ * lists.xsl: .RS/.RE doesn't nest precisely. Use .IP to fix up the environment. Part of
+ bug #852714.
+
+ * lists.xsl: Handle comments inside lists (part of bug #852714).
+
+2003-12-15 <twaugh@users.sourceforge.net>
+
+ * lists.xsl: Fix nested lists properly.
+
+2003-12-13 <twaugh@users.sourceforge.net>
+
+ * docbook.xsl: Use .nf environment for literallayout.
+
+ * docbook.xsl: Prevent duplicate .nf environments inside informalexample or screen. All
+ fiftenn allowed contained element in these elements will provide its own.
+
+2003-12-12 <twaugh@users.sourceforge.net>
+
+ * docbook.xsl: Last commit reverted a previous change -- redo it.
+
+2003-12-11 <twaugh@users.sourceforge.net>
+
+ * docbook.xsl: Remove unused rule.
+
+ * docbook.xsl: Fix literallayout inside para.
+
+ * lists.xsl: Fix singly-nested lists.
+
+2003-12-10 <twaugh@users.sourceforge.net>
+
+ * docbook.xsl: Don't mess up roff markup in tables.
+
+2003-11-06 <twaugh@users.sourceforge.net>
+
+ * lists.xsl, synop.xsl: 2003-11-06 Tim Waugh <twaugh@redhat.com>
+
+ * lists.xsl: Normalize space in itemizedlist/listitem.
+ * synop.xsl: Likewise.
+
+2003-05-23 <twaugh@users.sourceforge.net>
+
+ * synop.xsl: Only escape option spaces once when args are nested.
+
+2003-05-15 <twaugh@users.sourceforge.net>
+
+ * docbook.xsl: Handle refsection as well as refsect1|refsect2 in the manpages stylesheet.
+
+2003-05-09 Norman Walsh <nwalsh@users.sourceforge.net>
+
+ * synop.xsl, synop.xsl: Patch from Tim Waugh
+
+2003-04-12 Norman Walsh <nwalsh@users.sourceforge.net>
+
+ * docbook.xsl, synop.xsl: Patches from Tim Waugh
+
+2003-03-15 <jorton@users.sourceforge.net>
+
+ * docbook.xsl: If the refmeta contains no manvolnum, then:
+ - if the refentry contains a funcsynopsis, default to section 3
+ - otherwise, default to section 1
+
+ * docbook.xsl: Don't try and generate man pages with spaces in the filename; replace
+ spaces with underscores.
+
+2003-01-05 <jorton@users.sourceforge.net>
+
+ * docbook.xsl: Second half of fix for #628888: add template for <optional>.
+
+ * docbook.xsl: Add replacement ulink template from xmlto, fixing bug #619500.
+ Written by Tim Waugh.
+
+ * docbook.xsl: First part of fix for #628888:
+ - don't use generic italic/bold templates for things like <replaceable>,
+ since <replaceable> can contain other elements, but the templates discard
+ any non-PCDATA content.
+
+ * docbook.xsl: Prevent a line beginning with a '.' character being interpreted as a
+ troff macro by inserting \& (a zero-width space) before every '.' in text.
+
+ * xref.xsl: Make xref work again, though I'm not sure why it stopped working.
+
+2002-09-20 Norman Walsh <nwalsh@users.sourceforge.net>
+
+ * synop.xsl: Joe Orton: Use replace-string from lib.xsl
+
+2002-09-18 Norman Walsh <nwalsh@users.sourceforge.net>
+
+ * db2man.xsl, docbook.xsl: Renamed
+
+ * docbook.xsl: Joe Orton: patch to get rid of extra whitespace in author names
+
+2002-09-17 Norman Walsh <nwalsh@users.sourceforge.net>
+
+ * db2man.xsl: Another patch from Joe Orton
+
+ * db2man.xsl, synop.xsl: Patch from Joe Orton
+
+2002-07-04 Norman Walsh <nwalsh@users.sourceforge.net>
+
+ * README, db2man.xsl, lists.xsl, sect23.xsl, synop.xsl, xref.xsl:
+ New file.
+
diff --git a/kdoctools/docbook/xsl/manpages/README b/kdoctools/docbook/xsl/manpages/README
new file mode 100644
index 000000000..36368cdce
--- /dev/null
+++ b/kdoctools/docbook/xsl/manpages/README
@@ -0,0 +1,10 @@
+README for db2man by Martijn van Beers (lotr@users.sourceforge.net)
+
+I've been working on some stylesheets to convert <refentry>s to man
+format. I thought I'd submit what I have for inclusion in the
+docbook-xsl package.
+
+See also:
+
+ http://sourceforge.net/tracker/index.php?func=detail&aid=468779&group_id=21935&atid=373749
+
diff --git a/kdoctools/docbook/xsl/manpages/docbook.xsl b/kdoctools/docbook/xsl/manpages/docbook.xsl
new file mode 100644
index 000000000..d0f4367b8
--- /dev/null
+++ b/kdoctools/docbook/xsl/manpages/docbook.xsl
@@ -0,0 +1,586 @@
+<?xml version='1.0'?>
+<!-- vim:set sts=2 shiftwidth=2 syntax=sgml: -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version='1.0'>
+
+<xsl:import href="../html/docbook.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"/>
+
+<!--
+ named templates for bold and italic. call like:
+
+ <xsl:apply-templates mode="bold" select="node-you-want" />
+-->
+<xsl:template mode="bold" match="*">
+ <xsl:variable name="content">
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:text>\fB</xsl:text>
+ <xsl:value-of select="$content"/>
+ <xsl:text>\fR</xsl:text>
+</xsl:template>
+
+<xsl:template mode="italic" match="*">
+ <xsl:variable name="content">
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:text>\fI</xsl:text>
+ <xsl:value-of select="$content"/>
+ <xsl:text>\fR</xsl:text>
+</xsl:template>
+
+<xsl:template match="caution|important|note|tip|warning">
+ <xsl:text>&#10;.RS&#10;.Sh "</xsl:text>
+ <!-- capitalize word -->
+ <xsl:value-of
+ select="translate (substring (name(.), 1, 1), 'cintw', 'CINTW')" />
+ <xsl:value-of select="substring (name(), 2)" />
+ <xsl:if test="title">
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="title[1]"/>
+ </xsl:if>
+ <xsl:text>"&#10;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>&#10;.RE&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="refsection|refsect1">
+ <xsl:choose>
+ <xsl:when test="ancestor::refsection">
+ <xsl:text>&#10;.SS "</xsl:text>
+ <xsl:value-of select="title[1]"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>&#10;.SH "</xsl:text>
+ <xsl:value-of select="translate(title[1],'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>"&#10;</xsl:text>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="refsect2">
+ <xsl:text>&#10;.SS "</xsl:text>
+ <xsl:value-of select="title[1]"/>
+ <xsl:text>"&#10;</xsl:text>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="refsynopsisdiv">
+ <xsl:text>&#10;.SH "SYNOPSIS"&#10;</xsl:text>
+ <xsl:apply-templates/>
+</xsl:template>
+
+
+<xsl:template match="para">
+ <xsl:text>&#10;.PP&#10;</xsl:text>
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="self::literallayout|self::informaltable|self::screen|
+ self::programlisting|self::itemizedlist|
+ self::orderedlist|self::variablelist|self::simplelist">
+ <xsl:text>&#10;</xsl:text>
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::text()">
+ <xsl:if test="starts-with(translate(.,'&#10;',' '), ' ') and
+ preceding-sibling::node()[name(.)!='']">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ <xsl:variable name="content">
+ <xsl:apply-templates select="."/>
+ </xsl:variable>
+ <xsl:value-of select="normalize-space($content)"/>
+ <xsl:if
+ test="translate(substring(., string-length(.), 1),'&#10;',' ') = ' ' and
+ following-sibling::node()[name(.)!='']">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="content">
+ <xsl:apply-templates select="."/>
+ </xsl:variable>
+ <xsl:value-of select="normalize-space($content)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:text>&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="simpara">
+ <xsl:variable name="content">
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:text>&#10;&#10;</xsl:text>
+ <xsl:value-of select="normalize-space($content)"/>
+ <xsl:text>
+</xsl:text>
+</xsl:template>
+
+
+<xsl:template match="refentry">
+
+ <xsl:variable name="section">
+ <xsl:choose>
+ <xsl:when test="refmeta/manvolnum">
+ <xsl:value-of select="refmeta/manvolnum[1]"/>
+ </xsl:when>
+ <xsl:when test=".//funcsynopsis">3</xsl:when>
+ <xsl:otherwise>1</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="name" select="refnamediv/refname[1]"/>
+
+ <!-- standard man page width is 64 chars; 6 chars needed for the two
+ (x) volume numbers, and 2 spaces, leaves 56 -->
+ <xsl:variable name="twidth" select="(56 - string-length(refmeta/refentrytitle)) div 2"/>
+
+ <xsl:variable name="reftitle"
+ select="substring(refmeta/refentrytitle, 1, $twidth)"/>
+
+ <xsl:variable name="title">
+ <xsl:choose>
+ <xsl:when test="refentryinfo/title">
+ <xsl:value-of select="refentryinfo/title"/>
+ </xsl:when>
+ <xsl:when test="../referenceinfo/title">
+ <xsl:value-of select="../referenceinfo/title"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="date">
+ <xsl:choose>
+ <xsl:when test="refentryinfo/date">
+ <xsl:value-of select="refentryinfo/date"/>
+ </xsl:when>
+ <xsl:when test="../referenceinfo/date">
+ <xsl:value-of select="../referenceinfo/date"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="productname">
+ <xsl:choose>
+ <xsl:when test="refentryinfo/productname">
+ <xsl:value-of select="refentryinfo/productname"/>
+ </xsl:when>
+ <xsl:when test="../referenceinfo/productname">
+ <xsl:value-of select="../referenceinfo/productname"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- replace spaces with underscores in the filename -->
+ <xsl:variable name="filename">
+ <xsl:call-template name="replace-string">
+ <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>
+ </xsl:variable>
+
+ <xsl:call-template name="write.text.chunk">
+ <xsl:with-param name="filename" select="$filename"/>
+ <xsl:with-param name="content">
+ <xsl:text>.\"Generated by db2man.xsl. Don't modify this, modify the source.
+.de Sh \" Subsection
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Ip \" 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: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="$title"/>
+ <xsl:text>"
+</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>&#10;</xsl:text>
+
+ <!-- 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: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, '&#10;')"/>
+ </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:template match="articleinfo|bookinfo|refentryinfo" mode="authorsect">
+ <xsl:text>.SH AUTHOR</xsl:text>
+ <xsl:if test="count(.//author)>1">
+ <xsl:text>S</xsl:text>
+ </xsl:if>
+ <xsl:text>&#10;</xsl:text>
+
+ <xsl:for-each select=".//author">
+ <xsl:if test="position() > 1">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ <xsl:variable name="author">
+ <xsl:apply-templates select="."/>
+ </xsl:variable>
+ <xsl:value-of select="normalize-space($author)"/>
+ </xsl:for-each>
+ <xsl:text>.&#10;</xsl:text>
+ <xsl:if test=".//editor">
+ <xsl:text>.br&#10;Man page edited by </xsl:text>
+ <xsl:apply-templates select=".//editor"/>
+ <xsl:text>.&#10;</xsl:text>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="author|editor">
+ <xsl:call-template name="person.name"/>
+ <xsl:apply-templates select="./affiliation/address/email" />
+</xsl:template>
+
+<xsl:template match="copyright">
+ <xsl:text>Copyright \(co </xsl:text>
+ <xsl:apply-templates select="./year" />
+ <xsl:text>&#10;.Sp&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="email">
+ <xsl:text> &lt;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>&gt;</xsl:text>
+</xsl:template>
+
+<xsl:template match="refnamediv">
+ <xsl:text>.SH NAME&#10;</xsl:text>
+ <xsl:for-each select="refname">
+ <xsl:if test="position()>1">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ <xsl:value-of select="."/>
+ </xsl:for-each>
+ <xsl:text> \- </xsl:text>
+ <xsl:value-of select="normalize-space (refpurpose)"/>
+</xsl:template>
+
+<xsl:template match="refentry/refentryinfo"></xsl:template>
+
+<xsl:template match="informalexample|screen">
+ <xsl:text>&#10;.IP&#10;</xsl:text>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="filename|replaceable|varname">
+ <xsl:text>\fI</xsl:text><xsl:apply-templates/><xsl:text>\fR</xsl:text>
+</xsl:template>
+
+<xsl:template match="option|userinput|envar|errorcode|constant|type">
+ <xsl:text>\fB</xsl:text><xsl:apply-templates/><xsl:text>\fR</xsl:text>
+</xsl:template>
+
+<xsl:template match="emphasis">
+ <xsl:choose>
+ <xsl:when test="@role = 'bold' and $emphasis.propagates.style != 0">
+ <xsl:text>\fB</xsl:text><xsl:apply-templates/><xsl:text>\fR</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>\fI</xsl:text><xsl:apply-templates/><xsl:text>\fR</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="quote">
+ <xsl:text>``</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>''</xsl:text>
+</xsl:template>
+
+<xsl:template match="programlisting|literallayout">
+ <xsl:text>&#10;.nf&#10;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>&#10;.fi&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="optional">
+ <xsl:value-of select="$arg.choice.opt.open.str"/>
+ <xsl:apply-templates/>
+ <xsl:value-of select="$arg.choice.opt.close.str"/>
+</xsl:template>
+
+<xsl:template name="do-citerefentry">
+ <xsl:param name="refentrytitle" select="''"/>
+ <xsl:param name="manvolnum" select="''"/>
+
+ <xsl:apply-templates mode="bold" select="$refentrytitle"/>
+ <xsl:text>(</xsl:text>
+ <xsl:value-of select="$manvolnum"/>
+ <xsl:text>)</xsl:text>
+</xsl:template>
+
+<xsl:template match="citerefentry">
+ <xsl:call-template name="do-citerefentry">
+ <xsl:with-param name="refentrytitle" select="refentrytitle"/>
+ <xsl:with-param name="manvolnum" select="manvolnum"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="ulink">
+ <xsl:variable name="content">
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:variable name="url" select="@url"/>
+ <xsl:choose>
+ <xsl:when test="$url=$content or $content=''">
+ <xsl:text>\fI</xsl:text>
+ <xsl:value-of select="$url"/>
+ <xsl:text>\fR</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$content"/>
+ <xsl:text>: \fI</xsl:text>
+ <xsl:value-of select="$url"/>
+ <xsl:text>\fR</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- Translate some entities to textual equivalents. -->
+<xsl:template name="replace-string">
+ <xsl:param name="content" select="''"/>
+ <xsl:param name="replace" select="''"/>
+ <xsl:param name="with" select="''"/>
+ <xsl:choose>
+ <xsl:when test="not(contains($content,$replace))">
+ <xsl:value-of select="$content"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before($content,$replace)"/>
+ <xsl:value-of select="$with"/>
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="content"
+ select="substring-after($content,$replace)"/>
+ <xsl:with-param name="replace" select="$replace"/>
+ <xsl:with-param name="with" select="$with"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template name="replace-dash">
+ <xsl:param name="content" select="''"/>
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="content" select="$content"/>
+ <xsl:with-param name="replace" select="'-'"/>
+ <xsl:with-param name="with" select="'\-'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="replace-ndash">
+ <xsl:param name="content" select="''"/>
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="content" select="$content"/>
+ <xsl:with-param name="replace" select="'&#8211;'"/>
+ <xsl:with-param name="with" select="'-'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="replace-mdash">
+ <xsl:param name="content" select="''"/>
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="content" select="$content"/>
+ <xsl:with-param name="replace" select="'&#8212;'"/>
+ <xsl:with-param name="with" select="'--'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="replace-hellip">
+ <xsl:param name="content" select="''"/>
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="content" select="$content"/>
+ <xsl:with-param name="replace" select="'&#8230;'"/>
+ <xsl:with-param name="with" select="'...'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="replace-setmn">
+ <xsl:param name="content" select="''"/>
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="content" select="$content"/>
+ <xsl:with-param name="replace" select="'&#8726;'"/>
+ <xsl:with-param name="with" select="'\\'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="replace-minus">
+ <xsl:param name="content" select="''"/>
+ <xsl:value-of select="translate($content,'&#8722;','-')"/>
+</xsl:template>
+
+<xsl:template name="replace-nbsp">
+ <xsl:param name="content" select="''"/>
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="content" select="$content"/>
+ <xsl:with-param name="replace" select="'&#x00a0;'"/>
+ <xsl:with-param name="with" select="'\~'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="replace-backslash">
+ <xsl:param name="content" select="''"/>
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="content" select="$content"/>
+ <xsl:with-param name="replace" select="'\'"/>
+ <xsl:with-param name="with" select="'\\'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- if a period character is output at the beginning of a line
+ it will be interpreted as a groff macro, so prefix all periods
+ with "\&", a zero-width space. -->
+<xsl:template name="replace-period">
+ <xsl:param name="content" select="''"/>
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="content" select="$content"/>
+ <xsl:with-param name="replace" select="'.'"/>
+ <xsl:with-param name="with" select="'\&#38;.'"/>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="replace-entities">
+ <xsl:param name="content" select="''"/>
+ <xsl:call-template name="replace-hellip">
+ <xsl:with-param name="content">
+ <xsl:call-template name="replace-minus">
+ <xsl:with-param name="content">
+ <xsl:call-template name="replace-mdash">
+ <xsl:with-param name="content">
+ <xsl:call-template name="replace-ndash">
+ <xsl:with-param name="content">
+ <xsl:call-template name="replace-dash">
+ <xsl:with-param name="content">
+ <xsl:call-template name="replace-setmn">
+ <xsl:with-param name="content">
+ <xsl:call-template name="replace-period">
+ <xsl:with-param name="content">
+ <xsl:call-template name="replace-nbsp">
+ <xsl:with-param name="content">
+ <xsl:call-template name="replace-backslash">
+ <xsl:with-param name="content" select="$content"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="dingbat.characters">
+ <!-- now that I'm using the real serializer, all that dingbat malarky -->
+ <!-- isn't necessary anymore... -->
+ <xsl:param name="dingbat">bullet</xsl:param>
+ <xsl:choose>
+ <xsl:when test="$dingbat='bullet'">\(bu</xsl:when>
+ <xsl:when test="$dingbat='copyright'">\(co</xsl:when>
+ <xsl:when test="$dingbat='trademark'">\(tm</xsl:when>
+ <xsl:when test="$dingbat='trade'">\(tm</xsl:when>
+ <xsl:when test="$dingbat='registered'">\(rg</xsl:when>
+ <xsl:when test="$dingbat='service'">(SM)</xsl:when>
+ <xsl:when test="$dingbat='nbsp'">\~</xsl:when>
+ <xsl:when test="$dingbat='ldquo'">\(lq</xsl:when>
+ <xsl:when test="$dingbat='rdquo'">\(rq</xsl:when>
+ <xsl:when test="$dingbat='lsquo'">`</xsl:when>
+ <xsl:when test="$dingbat='rsquo'">'</xsl:when>
+ <xsl:when test="$dingbat='em-dash'">\(em</xsl:when>
+ <xsl:when test="$dingbat='mdash'">\(em</xsl:when>
+ <xsl:when test="$dingbat='en-dash'">\(en</xsl:when>
+ <xsl:when test="$dingbat='ndash'">\(en</xsl:when>
+ <xsl:otherwise>
+ <xsl:text>\(bu</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="text()">
+ <xsl:call-template name="replace-entities">
+ <xsl:with-param name="content">
+ <xsl:value-of select="."/>
+ </xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<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:stylesheet>
diff --git a/kdoctools/docbook/xsl/manpages/lists.xsl b/kdoctools/docbook/xsl/manpages/lists.xsl
new file mode 100644
index 000000000..5e956d4dc
--- /dev/null
+++ b/kdoctools/docbook/xsl/manpages/lists.xsl
@@ -0,0 +1,143 @@
+<?xml version='1.0'?>
+<!-- vim:set sts=2 shiftwidth=2 syntax=sgml: -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version='1.0'>
+
+<xsl:template match="para[ancestor::listitem or ancestor::step]|
+ simpara[ancestor::listitem or ancestor::step]|
+ remark[ancestor::listitem or ancestor::step]">
+ <xsl:for-each select="node()">
+ <xsl:choose>
+ <xsl:when test="self::literallayout|self::screen|self::programlisting|
+ self::itemizedlist|self::orderedlist|self::variablelist|
+ self::simplelist">
+ <xsl:text>&#10;</xsl:text>
+ <xsl:apply-templates select="."/>
+ </xsl:when>
+ <xsl:when test="self::text()">
+ <xsl:if test="starts-with(translate(.,'&#10;',' '), ' ') and
+ preceding-sibling::node()[name(.)!='']">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ <xsl:variable name="content">
+ <xsl:apply-templates select="."/>
+ </xsl:variable>
+ <xsl:value-of select="normalize-space($content)"/>
+ <xsl:if
+ test="translate(substring(., string-length(.), 1),'&#10;',' ') = ' '
+ and following-sibling::node()[name(.)!='']">
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="content">
+ <xsl:apply-templates select="."/>
+ </xsl:variable>
+ <xsl:value-of select="normalize-space($content)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:text>&#10;</xsl:text>
+
+ <xsl:if test="following-sibling::para or
+ following-sibling::simpara or
+ following-sibling::remark">
+ <!-- Make sure multiple paragraphs within a list item don't -->
+ <!-- merge together. -->
+ <xsl:text>&#10;</xsl:text>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="varlistentry|glossentry">
+ <xsl:text>&#10;.TP&#10;</xsl:text>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="variablelist[ancestor::listitem or ancestor::step]|
+ glosslist[ancestor::listitem or ancestor::step]">
+ <xsl:text>&#10;.RS&#10;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>&#10;.RE&#10;.IP&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="varlistentry/term|glossterm">
+ <xsl:variable name="content">
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:value-of select="normalize-space($content)"/>
+ <xsl:text>, </xsl:text>
+</xsl:template>
+
+<xsl:template
+ match="varlistentry/term[position()=last()]|glossterm[position()=last()]"
+ priority="2">
+ <xsl:variable name="content">
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:value-of select="normalize-space($content)"/>
+</xsl:template>
+
+<xsl:template match="varlistentry/listitem|glossdef">
+ <xsl:text>&#10;</xsl:text>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="itemizedlist/listitem">
+ <xsl:text>\(bu&#10;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:if test="following-sibling::listitem">
+ <xsl:text>.TP&#10;</xsl:text>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="orderedlist/listitem|procedure/step">
+ <xsl:number format="1."/>
+ <xsl:text>&#10;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:if test="position()!=last()">
+ <xsl:text>.TP&#10;</xsl:text>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="itemizedlist|orderedlist|procedure">
+ <xsl:text>&#10;.TP 3&#10;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>.LP&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="itemizedlist[ancestor::listitem or ancestor::step]|
+ orderedlist[ancestor::listitem or ancestor::step]|
+ procedure[ancestor::listitem or ancestor::step]">
+ <xsl:text>&#10;.RS&#10;.TP 3&#10;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>.LP&#10;.RE&#10;.IP&#10;</xsl:text>
+</xsl:template>
+
+<!-- simplelist -->
+
+<xsl:template match="simplelist[@type='inline']">
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="simplelist[@type='inline']/member">
+ <xsl:apply-templates/>
+ <xsl:text>, </xsl:text>
+</xsl:template>
+
+<xsl:template match="simplelist[@type='inline']/member[position()=last()]"
+ priority="2">
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="simplelist[@type='vert' and @columns='1']">
+ <xsl:text>&#10;.IP&#10;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>.LP&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="simplelist[@type='vert' and @columns='1']/member">
+ <xsl:apply-templates/>
+ <xsl:text>&#10;&#10;</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/kdoctools/docbook/xsl/manpages/sect23.xsl b/kdoctools/docbook/xsl/manpages/sect23.xsl
new file mode 100644
index 000000000..a72514c66
--- /dev/null
+++ b/kdoctools/docbook/xsl/manpages/sect23.xsl
@@ -0,0 +1,147 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version='1.0'>
+
+<xsl:template match="refsect2">
+ <xsl:text>&#10;.Sh "</xsl:text>
+ <xsl:value-of select="substring-before(title[1],' ')"/>
+ <xsl:text>"&#10;</xsl:text>
+ <xsl:apply-templates/>
+</xsl:template>
+<xsl:template match="refsect2/title"></xsl:template>
+<xsl:template match="refsect2/programlisting"></xsl:template>
+
+<xsl:template match="funcsynopsis">
+ <xsl:text>&#10;.BI "</xsl:text>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="funcsynopsis/funcprototype">
+ <xsl:apply-templates/>
+ <xsl:text> );&#10;.br&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="funcsynopsis/funcprototype/funcdef">
+ <xsl:apply-templates/>
+ <xsl:value-of select="function"/>
+ <xsl:text> (</xsl:text>
+</xsl:template>
+<xsl:template match="funcsynopsis/funcprototype/funcdef/function"></xsl:template>
+
+<xsl:template match="funcsynopsis/funcprototype/paramdef">
+ <xsl:apply-templates/>
+ <xsl:text>" </xsl:text>
+ <xsl:value-of select="parameter"/>
+ <xsl:choose>
+ <xsl:when test="following-sibling::paramdef">
+ <xsl:text> ", </xsl:text>
+ </xsl:when>
+ </xsl:choose>
+</xsl:template>
+<xsl:template match="funcsynopsis/funcprototype/paramdef/parameter"></xsl:template>
+
+<xsl:template match="refsect2/informaltable/tgroup/tbody/row">
+ <xsl:text>.Ip "\(bu \s-1</xsl:text>
+ <xsl:value-of select="entry[1]/parameter[1]"/>
+ <xsl:text>\s0 \- </xsl:text>
+ <xsl:value-of select="normalize-space(entry[2])"/>
+ <xsl:text>"&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="refsect1">
+ <xsl:text>&#10;.SH "</xsl:text>
+ <xsl:value-of select="translate(title[1],'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+ <xsl:text>"&#10;</xsl:text>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="refsynopsisdiv">
+ <xsl:text>&#10;.SH "</xsl:text>
+ <xsl:value-of select="translate(title[1],'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
+ <xsl:text>"&#10;</xsl:text>
+ <xsl:apply-templates/>
+</xsl:template>
+<xsl:template match="refsynopsisdiv/title"></xsl:template>
+
+<xsl:template match="refsect1/title"></xsl:template>
+
+<xsl:template match="para">
+ <xsl:text>.PP&#10;</xsl:text>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="*"><xsl:apply-templates/></xsl:template>
+
+<xsl:template match="refentry">
+ <xsl:text>." DO NOT MODIFY THIS FILE!
+.de Sh \" Subsection
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Ip \" List item
+.br
+.ie \\n(.$>=3 .ne \\$3
+.el .ne 3
+.IP "\\$1" \\$2
+..
+.TH "</xsl:text>
+ <xsl:value-of select="refmeta/refentrytitle[1]"/>
+ <xsl:text>" </xsl:text>
+ <xsl:value-of select="refmeta/manvolnum[1]"/>
+ <xsl:text> "</xsl:text>
+ <xsl:value-of select="@revision"/>
+ <xsl:text>"&#10;</xsl:text>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="refmeta"></xsl:template>
+
+<xsl:template match="refnamediv">
+ <xsl:text>.SH NAME&#10;</xsl:text>
+ <xsl:value-of select="refname"/>
+ <xsl:text> \- </xsl:text>
+ <xsl:value-of select="refpurpose"/>
+</xsl:template>
+
+<xsl:template match="refentry/refentrytitle"></xsl:template>
+<xsl:template match="article/articleinfo/*"></xsl:template>
+
+<xsl:template match="term/option">
+ <xsl:text>\fB</xsl:text><xsl:apply-templates/><xsl:text>\fR</xsl:text>
+</xsl:template>
+
+<xsl:template match="varlistentry">
+ <xsl:text>&#10;.TP&#10;</xsl:text>
+<xsl:apply-templates select="./term"/>
+<xsl:apply-templates select="./listitem"/>
+</xsl:template>
+
+<xsl:template match="varlistentry/listitem/para">
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="filename">
+ <xsl:text>&#10;.FN </xsl:text><xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="userinput">
+ <xsl:text>&#10;.IP&#10;.B </xsl:text><xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="envar">
+ <xsl:text>\fB</xsl:text><xsl:apply-templates/><xsl:text>\fR</xsl:text>
+</xsl:template>
+
+<xsl:template match="filename">
+ <xsl:text>\fI</xsl:text><xsl:apply-templates/><xsl:text>\fR</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/kdoctools/docbook/xsl/manpages/synop.xsl b/kdoctools/docbook/xsl/manpages/synop.xsl
new file mode 100644
index 000000000..977866969
--- /dev/null
+++ b/kdoctools/docbook/xsl/manpages/synop.xsl
@@ -0,0 +1,197 @@
+<?xml version='1.0'?>
+<!-- vim:set sts=2 shiftwidth=2 syntax=sgml: -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version='1.0'>
+
+<xsl:template match="synopfragment">
+<xsl:text>&#10;.PP&#10;</xsl:text>
+<xsl:apply-templates/>
+</xsl:template>
+<!--
+ there's a bug were an <arg> that's not inside a <group> isn't made bold
+-->
+
+<xsl:template match="group|arg">
+ <xsl:variable name="choice" select="@choice"/>
+ <xsl:variable name="rep" select="@rep"/>
+ <xsl:variable name="sepchar">
+ <xsl:choose>
+ <xsl:when test="ancestor-or-self::*/@sepchar">
+ <xsl:value-of select="ancestor-or-self::*/@sepchar"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="position()>1"><xsl:value-of select="$sepchar"/></xsl:if>
+ <xsl:choose>
+ <xsl:when test="$choice='plain'">
+ <!-- do nothing -->
+ </xsl:when>
+ <xsl:when test="$choice='req'">
+ <xsl:value-of select="$arg.choice.req.open.str"/>
+ </xsl:when>
+ <xsl:when test="$choice='opt'">
+ <xsl:value-of select="$arg.choice.opt.open.str"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$arg.choice.def.open.str"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:variable name="arg">
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="local-name(.) = 'arg' and not(ancestor::arg)">
+ <!-- Prevent breaking up an argument by wrapping it -->
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="content" select="normalize-space($arg)"/>
+ <xsl:with-param name="replace" select="' '"/>
+ <xsl:with-param name="with" select="'\ '"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="normalize-space($arg)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$rep='repeat'">
+ <xsl:value-of select="$arg.rep.repeat.str"/>
+ </xsl:when>
+ <xsl:when test="$rep='norepeat'">
+ <xsl:value-of select="$arg.rep.norepeat.str"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$arg.rep.def.str"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$choice='plain'">
+ <xsl:if test='arg'>
+ <xsl:value-of select="$arg.choice.plain.close.str"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:when test="$choice='req'">
+ <xsl:value-of select="$arg.choice.req.close.str"/>
+ </xsl:when>
+ <xsl:when test="$choice='opt'">
+ <xsl:value-of select="$arg.choice.opt.close.str"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$arg.choice.def.close.str"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="group/arg">
+ <xsl:if test="position()>1">
+ <xsl:value-of select="$arg.or.sep"/>
+ </xsl:if>
+ <!-- Don't use the 'bold' named template here since there may be -->
+ <!-- child elements that require different markup (such as -->
+ <!-- <replaceable>). -->
+ <xsl:text>\fB</xsl:text>
+ <xsl:variable name="arg">
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="content" select="normalize-space($arg)"/>
+ <xsl:with-param name="replace" select="' '"/>
+ <xsl:with-param name="with" select="'\ '"/>
+ </xsl:call-template>
+ <xsl:text>\fR</xsl:text>
+</xsl:template>
+
+<xsl:template match="command">
+ <xsl:apply-templates mode="bold" select="."/>
+</xsl:template>
+
+<xsl:template match="function[not(ancestor::command)]">
+ <xsl:apply-templates mode="bold" select="."/>
+</xsl:template>
+
+<xsl:template match="parameter[not(ancestor::command)]">
+ <xsl:apply-templates mode="italic" select="."/>
+</xsl:template>
+
+<xsl:template match="sbr" />
+
+<xsl:template match="cmdsynopsis">
+ <xsl:text>.ad l&#10;.hy 0&#10;</xsl:text>
+ <xsl:text>.HP </xsl:text>
+ <xsl:value-of select="string-length (normalize-space (command)) + 1"/>
+ <xsl:text>&#10;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>&#10;.ad&#10;.hy&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="synopsis">
+ <xsl:text>&#10;.nf&#10;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>&#10;.fi&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="void">
+ <xsl:text>void</xsl:text>
+</xsl:template>
+
+<xsl:template match="varargs">
+ <xsl:text>...</xsl:text>
+</xsl:template>
+
+<xsl:template match="funcsynopsisinfo">
+ <xsl:text>&#10;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>&#10;.sp&#10;</xsl:text>
+</xsl:template>
+
+<!-- disable hyphenation, and use left-aligned filling for the duration
+ of the synopsis, so that line breaks only occur between
+ separate paramdefs. -->
+<xsl:template match="funcsynopsis">
+ <xsl:text>.ad l&#10;.hy 0&#10;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>.ad&#10;.hy&#10;</xsl:text>
+</xsl:template>
+
+<!-- TODO: Handle K&R-style parameter lists
+ Comment that used to go with the paramdef template, which
+ is now obsolete and thus deleted
+-->
+
+
+<!-- replaces all spaces within the funcdef/paramdef with non-breaking
+ spaces -->
+<xsl:template match="paramdef|funcdef">
+ <xsl:variable name="rcontent">
+ <xsl:apply-templates select="*|./*|text()"/>
+ </xsl:variable>
+ <xsl:variable name="content">
+ <xsl:value-of select="normalize-space($rcontent)"/>
+ </xsl:variable>
+ <xsl:call-template name="replace-string">
+ <xsl:with-param name="content" select="$content"/>
+ <xsl:with-param name="replace" select="' '"/>
+ <xsl:with-param name="with" select="'\ '"/>
+ </xsl:call-template>
+ <xsl:if test="local-name(.) = 'paramdef' and
+ (following-sibling::paramdef or following-sibling::varargs)">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="funcprototype">
+ <xsl:variable name="funcprototype">
+ <xsl:apply-templates select="funcdef"/>
+ </xsl:variable>
+ <xsl:text>.HP </xsl:text>
+ <xsl:value-of select="string-length (normalize-space ($funcprototype)) - 5"/>
+ <xsl:text>&#10;</xsl:text>
+ <xsl:value-of select="normalize-space ($funcprototype)"/>
+ <xsl:text>\ (</xsl:text>
+ <xsl:apply-templates select="void|paramdef|varargs"/>
+ <xsl:text>);&#10;</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/kdoctools/docbook/xsl/manpages/xref.xsl b/kdoctools/docbook/xsl/manpages/xref.xsl
new file mode 100644
index 000000000..671b87d93
--- /dev/null
+++ b/kdoctools/docbook/xsl/manpages/xref.xsl
@@ -0,0 +1,44 @@
+<?xml version='1.0'?>
+<!-- vim:set sts=2 shiftwidth=2 syntax=sgml: -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version='1.0'>
+
+<xsl:template match="xref">
+ <xsl:variable name="targets" select="key('id', @linkend)"/>
+ <xsl:variable name="target" select="$targets[1]"/>
+ <xsl:variable name="type" select="local-name($target)"/>
+
+ <xsl:choose>
+ <xsl:when test="$type=''">
+ <xsl:message>
+ <xsl:text>xref to nonexistent id </xsl:text>
+ <xsl:value-of select="@linkend"/>
+ </xsl:message>
+ </xsl:when>
+
+ <xsl:when test="$type='refentry'">
+ <xsl:call-template name="do-citerefentry">
+ <xsl:with-param name="refentrytitle"
+ select="$target/refmeta/refentrytitle[1]"/>
+ <xsl:with-param name="manvolnum"
+ select="$target/refmeta/manvolnum"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <xsl:when test="$type='refname'">
+ <xsl:call-template name="do-citerefentry">
+ <xsl:with-param name="refentrytitle" select="$target"/>
+ <xsl:with-param name="manvolnum"
+ select="$target/../../refmeta/manvolnum"/>
+ </xsl:call-template>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <xsl:text>[xref to </xsl:text>
+ <xsl:value-of select="$type"/>
+ <xsl:text>]</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>