- Factor out parts that are reusable for FO output

This commit is contained in:
Gabor Kovesdan 2013-07-21 11:18:51 +00:00
parent 7e90dd62e8
commit 879f8d35d2
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/projects/db5/; revision=42341
2 changed files with 106 additions and 83 deletions

View file

@ -4,6 +4,8 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:db="http://docbook.org/ns/docbook"
xmlns:str="http://exslt.org/strings"
extension-element-prefixes="str"
exclude-result-prefixes="db"
version='1.0'>
@ -39,4 +41,101 @@
<xsl:template match="db:refentrytitle" mode="no.anchor.mode">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="db:contrib">
<xsl:apply-templates/>
</xsl:template>
<xsl:template name="titlepage.pubdate">
<xsl:variable name="pubdate">
<xsl:choose>
<xsl:when test="contains(., '$FreeBSD')">
<xsl:value-of select="str:split(., ' ')[4]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="committer">
<xsl:if test="contains(., '$FreeBSD')">
<xsl:value-of select="str:split(., ' ')[6]"/>
</xsl:if>
</xsl:variable>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Lastmodified'"/>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'on'"/>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
<xsl:value-of select="$pubdate"/>
<xsl:if test="$committer">
<xsl:call-template name="gentext.space"/>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'by'"/>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
<xsl:value-of select="$committer"/>
</xsl:if>
<xsl:text>.</xsl:text>
</xsl:template>
<xsl:template name="svnref.genlink"/>
<xsl:template name="titlepage.releaseinfo">
<xsl:variable name="rev" select="str:split(., ' ')[3]"/>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Revision'"/>
</xsl:call-template>
<xsl:text>:</xsl:text>
<xsl:call-template name="gentext.space"/>
<xsl:call-template name="svnref.genlink">
<xsl:with-param name="repo" select="'doc'"/>
<xsl:with-param name="rev" select="$rev"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="freebsd.authorgroup">
<!-- XXX: our docs use a quirky semantics for this -->
<xsl:if test="(db:contrib|db:author/db:contrib)[1]">
<xsl:apply-templates select="(db:contrib|db:author/db:contrib)[1]"/>
</xsl:if>
<xsl:for-each select="db:author">
<xsl:apply-templates select="."/>
<xsl:choose>
<xsl:when test="position() &lt; (last() - 1)">
<xsl:text>, </xsl:text>
</xsl:when>
<xsl:when test="position() = (last() - 1)">
<xsl:call-template name="gentext.space"/>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'and'"/>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<xsl:text>. </xsl:text>
</xsl:template>
<xsl:template match="db:contrib">
<xsl:apply-templates/>
</xsl:template>
<xsl:template name="freebsd.author">
<xsl:if test="contrib">
<xsl:apply-templates select="db:contrib"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:apply-templates select="*[not(self::db:contrib)]"/>
</xsl:template>
</xsl:stylesheet>

View file

@ -186,9 +186,9 @@
<xsl:template name="generate.citerefentry.link">
<xsl:text>http://www.FreeBSD.org/cgi/man.cgi?query=</xsl:text>
<xsl:value-of select="refentrytitle"/>
<xsl:value-of select="db:refentrytitle"/>
<xsl:text>&#38;amp;sektion=</xsl:text>
<xsl:value-of select="manvolnum"/>
<xsl:value-of select="db:manvolnum"/>
</xsl:template>
<xsl:template name="nongraphical.admonition">
@ -214,53 +214,16 @@
</div>
</xsl:template>
<xsl:template name="freebsd.authorgroup">
<xsl:template name="chapter.authorgroup">
<span class="authorgroup">
<!-- XXX: our docs use a quirky semantics for this -->
<xsl:if test="(contrib|author/contrib)[1]">
<xsl:apply-templates select="(contrib|author/contrib)[1]"/>
</xsl:if>
<xsl:for-each select="author">
<xsl:apply-templates select="."/>
<xsl:choose>
<xsl:when test="position() &lt; (last() - 1)">
<xsl:text>, </xsl:text>
</xsl:when>
<xsl:when test="position() = (last() - 1)">
<xsl:call-template name="gentext.space"/>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'and'"/>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<xsl:text>. </xsl:text>
<xsl:call-template name="freebsd.authorgroup"/>
</span>
</xsl:template>
<xsl:template match="db:contrib">
<xsl:apply-templates/>
</xsl:template>
<xsl:template name="freebsd.author">
<xsl:if test="contrib">
<xsl:apply-templates select="contrib"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:apply-templates select="*[not(self::contrib)]"/>
</xsl:template>
<xsl:template name="chapter.authorgroup">
<xsl:call-template name="freebsd.authorgroup"/>
</xsl:template>
<xsl:template name="section.authorgroup">
<xsl:call-template name="freebsd.authorgroup"/>
<span class="authorgroup">
<xsl:call-template name="freebsd.authorgroup"/>
</span>
</xsl:template>
<xsl:template name="chapter.author">
@ -285,45 +248,6 @@
</xsl:call-template>
</xsl:template>
<xsl:template name="titlepage.pubdate">
<xsl:variable name="pubdate">
<xsl:choose>
<xsl:when test="contains(., '$FreeBSD')">
<xsl:value-of select="str:split(., ' ')[4]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="committer">
<xsl:if test="contains(., '$FreeBSD')">
<xsl:value-of select="str:split(., ' ')[6]"/>
</xsl:if>
</xsl:variable>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Lastmodified'"/>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'on'"/>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
<xsl:value-of select="$pubdate"/>
<xsl:if test="$committer">
<xsl:call-template name="gentext.space"/>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'by'"/>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
<xsl:value-of select="$committer"/>
</xsl:if>
<xsl:text>.</xsl:text>
</xsl:template>
<!-- Hook in format navigation at the end of the titlepage -->
<xsl:template name="book.titlepage.separator">
<xsl:call-template name="docformatnav"/>