BoostBook doc subdirectories support

[SVN r25626]
This commit is contained in:
Aleksey Gurtovoy 2004-10-08 17:39:49 +00:00
parent 85e19289db
commit 9b6909c57c
5 changed files with 215 additions and 37 deletions

View File

@ -122,9 +122,9 @@ std::cout << f(5, 3) >> std::endl;
libxml2 and libxslt packages</para> libxml2 and libxslt packages</para>
</listitem> </listitem>
<listitem> <listitem>
<para>Without Cygwin, you can <ulink <para>Without Cygwin, you need a patched version of the tools available from
url="http://www.zlatkovic.com/pub/libxml/">download the <ulink url="http://www.meta-comm.com/engineering/boost/xsltproc-win32.zip">
libxml2, libxslt, and iconv binaries</ulink>.</para> here</ulink>.</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
</listitem> </listitem>

79
xsl/chunk-common.xsl Normal file
View File

@ -0,0 +1,79 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- Import the HTML chunking stylesheet -->
<xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/html/chunk-common.xsl"/>
<xsl:import href="relative-href.xsl"/>
<!-- ==================================================================== -->
<xsl:template match="*" mode="recursive-chunk-filename">
<xsl:param name="recursive" select="false()"/>
<xsl:variable name="their">
<xsl:apply-imports mode="recursive-chunk-filename" select="."/>
</xsl:variable>
<xsl:variable name="basename" select="substring-before( $their, $html.ext )"/>
<xsl:choose>
<xsl:when test="not($recursive)">
<xsl:value-of select="translate( $basename, '.', '/' )"/>
<xsl:value-of select="$html.ext"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$basename"/>
<xsl:value-of select="'.'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template name="navig.content">
<xsl:param name="direction" select="next"/>
<xsl:variable name="navtext">
<xsl:choose>
<xsl:when test="$direction = 'prev'">
<xsl:call-template name="gentext.nav.prev"/>
</xsl:when>
<xsl:when test="$direction = 'next'">
<xsl:call-template name="gentext.nav.next"/>
</xsl:when>
<xsl:when test="$direction = 'up'">
<xsl:call-template name="gentext.nav.up"/>
</xsl:when>
<xsl:when test="$direction = 'home'">
<xsl:call-template name="gentext.nav.home"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>xxx</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$navig.graphics != 0">
<img>
<xsl:attribute name="src">
<xsl:call-template name="href.target.relative">
<xsl:with-param name="target" select="$navig.graphics.path"/>
</xsl:call-template>
<xsl:value-of select="$direction"/>
<xsl:value-of select="$navig.graphics.extension"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="$navtext"/>
</xsl:attribute>
</img>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$navtext"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@ -7,6 +7,7 @@
<xsl:import <xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/> href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/>
<xsl:import href="chunk-common.xsl"/>
<xsl:import href="docbook-layout.xsl"/> <xsl:import href="docbook-layout.xsl"/>
<xsl:import href="navbar.xsl"/> <xsl:import href="navbar.xsl"/>

View File

@ -1,8 +1,9 @@
<?xml version = "1.0" encoding = "utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:import href="relative-href.xsl"/>
<xsl:stylesheet version = "1.0"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
>
<!-- <!--
how to render the Home | Libraries | ... | More contents how to render the Home | Libraries | ... | More contents
none - do not display ("standalone" mode) none - do not display ("standalone" mode)
@ -55,9 +56,13 @@
<xsl:if test = "$nav.border = 'Boost'"> <xsl:if test = "$nav.border = 'Boost'">
<xsl:attribute name = "style">background-color: white; width: 50%;</xsl:attribute> <xsl:attribute name = "style">background-color: white; width: 50%;</xsl:attribute>
</xsl:if> </xsl:if>
<img src = "{$boost.image.src}" alt = "{$boost.image.alt}" <img alt="{$boost.image.alt}" width="{$boost.image.w}" height="{$boost.image.h}">
width = "{$boost.image.w}" height = "{$boost.image.h}" <xsl:attribute name="src">
/> <xsl:call-template name="href.target.relative">
<xsl:with-param name="target" select="$boost.image.src"/>
</xsl:call-template>
</xsl:attribute>
</img>
</td><xsl:choose> </td><xsl:choose>
<xsl:when test = "$nav.layout = 'horizontal'"> <xsl:when test = "$nav.layout = 'horizontal'">
<xsl:call-template name = "header.navdata-horiz"/> <xsl:call-template name = "header.navdata-horiz"/>
@ -92,48 +97,89 @@
</xsl:template> </xsl:template>
<xsl:template name = "header.navdata-horiz"> <xsl:template name = "header.navdata-horiz">
<xsl:variable name="home_link">
<xsl:call-template name="href.target.relative">
<xsl:with-param name="target" select="concat( $boost.root, '/index.htm' )"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="libraries_link">
<xsl:call-template name="href.target.relative">
<xsl:with-param name="target" select="$boost.libraries"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="people_link">
<xsl:call-template name="href.target.relative">
<xsl:with-param name="target" select="concat( $boost.root, '/people/people.htm' )"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="faq_link">
<xsl:call-template name="href.target.relative">
<xsl:with-param name="target" select="concat( $boost.root, '/more/faq.htm' )"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="more_link">
<xsl:call-template name="href.target.relative">
<xsl:with-param name="target" select="concat( $boost.root, '/more/index.htm' )"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose> <xsl:choose>
<xsl:when test = "$nav.border = 'Boost'"> <xsl:when test = "$nav.border = 'Boost'">
<td align = "center" class = "boost-headtd"> <td align = "center" class = "boost-headtd"><a href = "{$home_link}" class = "boost-headelem">Home</a></td>
<a href = "{$boost.root}/index.htm" class = "boost-headelem">Home</a> <td align = "center" class = "boost-headtd"><a href = "{$libraries_link}" class = "boost-headelem">Libraries</a></td>
</td><td align = "center" class = "boost-headtd"> <td align = "center" class = "boost-headtd"><a href = "{$people_link}" class = "boost-headelem">People</a></td>
<a href = "{$boost.libraries}" class = "boost-headelem">Libraries</a> <td align = "center" class = "boost-headtd"><a href = "{$faq_link}" class = "boost-headelem">FAQ</a></td>
</td><td align = "center" class = "boost-headtd"> <td align = "center" class = "boost-headtd"><a href = "{$more_link}" class = "boost-headelem">More</a></td>
<a href = "{$boost.root}/people/people.htm" class = "boost-headelem">People</a>
</td><td align = "center" class = "boost-headtd">
<a href = "{$boost.root}/more/faq.htm" class = "boost-headelem">FAQ</a>
</td><td align = "center" class = "boost-headtd">
<a href = "{$boost.root}/more/index.htm" class = "boost-headelem">More</a>
</td>
</xsl:when><xsl:otherwise> </xsl:when><xsl:otherwise>
<td align = "center"> <td align = "center"><a href = "{$home_link}">Home</a></td>
<a href = "{$boost.root}/index.htm">Home</a> <td align = "center"><a href = "{$libraries_link}">Libraries</a></td>
</td><td align = "center"> <td align = "center"><a href = "{$people_link}">People</a></td>
<a href = "{$boost.libraries}">Libraries</a> <td align = "center"><a href = "{$faq_link}">FAQ</a></td>
</td><td align = "center"> <td align = "center"><a href = "{$more_link}">More</a></td>
<a href = "{$boost.root}/people/people.htm">People</a>
</td><td align = "center">
<a href = "{$boost.root}/more/faq.htm">FAQ</a>
</td><td align = "center">
<a href = "{$boost.root}/more/index.htm">More</a>
</td>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
<xsl:template name = "header.navdata-vert"> <xsl:template name = "header.navdata-vert">
<xsl:variable name="home_link">
<xsl:call-template name="href.target.relative">
<xsl:with-param name="target" select="concat( $boost.root, '/index.htm' )"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="libraries_link">
<xsl:call-template name="href.target.relative">
<xsl:with-param name="target" select="$boost.libraries"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="people_link">
<xsl:call-template name="href.target.relative">
<xsl:with-param name="target" select="concat( $boost.root, '/people/people.htm' )"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="faq_link">
<xsl:call-template name="href.target.relative">
<xsl:with-param name="target" select="concat( $boost.root, '/more/faq.htm' )"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="more_link">
<xsl:call-template name="href.target.relative">
<xsl:with-param name="target" select="concat( $boost.root, '/more/index.htm' )"/>
</xsl:call-template>
</xsl:variable>
<td><div> <td><div>
<xsl:if test = "$nav.border != 'Boost'"> <xsl:if test = "$nav.border != 'Boost'">
<xsl:attribute name = "class">boost-toc</xsl:attribute> <xsl:attribute name = "class">boost-toc</xsl:attribute>
</xsl:if> </xsl:if>
<div><a href = "{$boost.root}/index.htm">Home</a></div> <div><a href = "{$home_link}">Home</a></div>
<div><a href = "{$boost.libraries}">Libraries</a></div> <div><a href = "{$libraries_link}">Libraries</a></div>
<div><a href = "{$boost.root}/people/people.htm">People</a></div> <div><a href = "{$people_link}">People</a></div>
<div><a href = "{$boost.root}/more/faq.htm">FAQ</a></div> <div><a href = "{$faq_link}">FAQ</a></div>
<div><a href = "{$boost.root}/more/index.htm">More</a></div> <div><a href = "{$more_link}">More</a></div>
</div></td> </div></td>
</xsl:template> </xsl:template>
<!-- footer --> <!-- footer -->
<xsl:template name = "footer.navigation"> <xsl:template name = "footer.navigation">

52
xsl/relative-href.xsl Normal file
View File

@ -0,0 +1,52 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/lib/lib.xsl"/>
<!-- ==================================================================== -->
<xsl:template name="href.target.relative">
<xsl:param name="target"/>
<xsl:variable name="href.to.uri" select="$target"/>
<xsl:variable name="href.from.uri">
<xsl:call-template name="href.target.uri"/>
</xsl:variable>
<xsl:variable name="href.to">
<xsl:call-template name="trim.common.uri.paths">
<xsl:with-param name="uriA" select="$href.to.uri"/>
<xsl:with-param name="uriB" select="$href.from.uri"/>
<xsl:with-param name="return" select="'A'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="href.from">
<xsl:call-template name="trim.common.uri.paths">
<xsl:with-param name="uriA" select="$href.to.uri"/>
<xsl:with-param name="uriB" select="$href.from.uri"/>
<xsl:with-param name="return" select="'B'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="depth">
<xsl:call-template name="count.uri.path.depth">
<xsl:with-param name="filename" select="$href.from"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="href">
<xsl:call-template name="copy-string">
<xsl:with-param name="string" select="'../'"/>
<xsl:with-param name="count" select="$depth"/>
</xsl:call-template>
<xsl:value-of select="$href.to"/>
</xsl:variable>
<xsl:value-of select="$href"/>
</xsl:template>
</xsl:stylesheet>