svn commit: r42341 - projects/db5/share/xsl
Gabor Kovesdan
gabor at FreeBSD.org
Sun Jul 21 11:18:52 UTC 2013
Author: gabor
Date: Sun Jul 21 11:18:51 2013
New Revision: 42341
URL: http://svnweb.freebsd.org/changeset/doc/42341
Log:
- Factor out parts that are reusable for FO output
Modified:
projects/db5/share/xsl/freebsd-common.xsl
projects/db5/share/xsl/freebsd-xhtml-common.xsl
Modified: projects/db5/share/xsl/freebsd-common.xsl
==============================================================================
--- projects/db5/share/xsl/freebsd-common.xsl Sun Jul 21 09:33:05 2013 (r42340)
+++ projects/db5/share/xsl/freebsd-common.xsl Sun Jul 21 11:18:51 2013 (r42341)
@@ -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() < (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>
Modified: projects/db5/share/xsl/freebsd-xhtml-common.xsl
==============================================================================
--- projects/db5/share/xsl/freebsd-xhtml-common.xsl Sun Jul 21 09:33:05 2013 (r42340)
+++ projects/db5/share/xsl/freebsd-xhtml-common.xsl Sun Jul 21 11:18:51 2013 (r42341)
@@ -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>&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() < (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"/>
More information about the svn-doc-projects
mailing list