Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60804 - trunk/tools/boostbook/xsl
From: daniel_james_at_[hidden]
Date: 2010-03-24 04:48:30


Author: danieljames
Date: 2010-03-24 04:48:28 EDT (Wed, 24 Mar 2010)
New Revision: 60804
URL: http://svn.boost.org/trac/boost/changeset/60804

Log:
Steven's docbook patch.
Text files modified:
   trunk/tools/boostbook/xsl/admon.xsl | 4
   trunk/tools/boostbook/xsl/callout.xsl | 4
   trunk/tools/boostbook/xsl/chunk-common.xsl | 3
   trunk/tools/boostbook/xsl/html.xsl | 423 ++++++++++++++++++++++++++++++++++++++-
   trunk/tools/boostbook/xsl/navbar.xsl | 3
   5 files changed, 416 insertions(+), 21 deletions(-)

Modified: trunk/tools/boostbook/xsl/admon.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/admon.xsl (original)
+++ trunk/tools/boostbook/xsl/admon.xsl 2010-03-24 04:48:28 EDT (Wed, 24 Mar 2010)
@@ -10,7 +10,9 @@
                 version="1.0">
 
 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/admon.xsl"/>
-<xsl:import href="relative-href.xsl"/>
+
+<!-- Already included in the main style sheet -->
+<!-- <xsl:import href="relative-href.xsl"/> -->
 
 <xsl:template name="admon.graphic">
     <xsl:param name="node" select="."/>

Modified: trunk/tools/boostbook/xsl/callout.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/callout.xsl (original)
+++ trunk/tools/boostbook/xsl/callout.xsl 2010-03-24 04:48:28 EDT (Wed, 24 Mar 2010)
@@ -10,7 +10,9 @@
                 version="1.0">
 
 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/callout.xsl"/>
-<xsl:import href="relative-href.xsl"/>
+
+<!-- Already included in the main style sheet -->
+<!-- <xsl:import href="relative-href.xsl"/> -->
 
 <xsl:template name="callout-bug">
   <xsl:param name="conum" select='1'/>

Modified: trunk/tools/boostbook/xsl/chunk-common.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/chunk-common.xsl (original)
+++ trunk/tools/boostbook/xsl/chunk-common.xsl 2010-03-24 04:48:28 EDT (Wed, 24 Mar 2010)
@@ -13,7 +13,8 @@
 <xsl:import
     href="http://docbook.sourceforge.net/release/xsl/current/html/chunk-common.xsl"/>
 
-<xsl:import href="relative-href.xsl"/>
+<!-- Already included in the main stylesheet -->
+<!-- <xsl:import href="relative-href.xsl"/> -->
 
 <!-- ==================================================================== -->
 

Modified: trunk/tools/boostbook/xsl/html.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/html.xsl (original)
+++ trunk/tools/boostbook/xsl/html.xsl 2010-03-24 04:48:28 EDT (Wed, 24 Mar 2010)
@@ -8,6 +8,7 @@
   -->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"
+ xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
                 version="1.0">
 
   <!-- Import the HTML chunking stylesheet -->
@@ -16,14 +17,23 @@
   <xsl:import
     href="http://docbook.sourceforge.net/release/xsl/current/html/math.xsl"/>
 
- <xsl:import href="chunk-common.xsl"/>
- <xsl:import href="docbook-layout.xsl"/>
- <xsl:import href="navbar.xsl"/>
- <xsl:import href="admon.xsl"/>
- <xsl:import href="xref.xsl"/>
- <xsl:import href="relative-href.xsl"/>
- <xsl:import href="callout.xsl"/>
-
+ <!-- Bring in the fast chunking overrides. There's nothing
+ that we need to override, so include instead of importing it. -->
+ <xsl:include
+ href="http://docbook.sourceforge.net/release/xsl/current/html/chunkfast.xsl"/>
+
+ <!-- We have to make sure that our templates override all
+ docbook templates. Therefore, we include our own templates
+ instead of importing them. In order for this to work,
+ the stylesheets included here cannot also include each other -->
+ <xsl:include href="chunk-common.xsl"/>
+ <xsl:include href="docbook-layout.xsl"/>
+ <xsl:include href="navbar.xsl"/>
+ <xsl:include href="admon.xsl"/>
+ <xsl:include href="xref.xsl"/>
+ <xsl:include href="relative-href.xsl"/>
+ <xsl:include href="callout.xsl"/>
+
   <xsl:param name="html.stylesheet">
     <xsl:choose>
       <xsl:when test = "$boost.defaults = 'Boost'">
@@ -59,14 +69,7 @@
             select = "concat($boost.root, '/doc/html/images/')"/>
   <xsl:param name = "callout.graphics.path"
             select = "concat($boost.root, '/doc/src/images/callouts/')"/>
-
-
- <xsl:param name="admon.style">
- <!-- Remove the style. Let the CSS do the styling -->
-</xsl:param>
-
-<!-- Always have graphics -->
-<xsl:param name="admon.graphics" select="1"/>
+ <xsl:param name="l10n.gentext.language" select="'en'"/>
 
   <xsl:param name="generate.toc">
 appendix toc,title
@@ -279,8 +282,394 @@
         <xsl:apply-templates/>
      </div>
   </xsl:template>
+
+ <!-- Override some unbearably slow docbook templates -->
+
+ <xsl:template name="l10n.language">
+ <xsl:param name="target" select="."/>
+ <xsl:param name="xref-context" select="false()"/>
+ <xsl:value-of select="'en'"/>
+ </xsl:template>
+
+ <xsl:param name="l10n.xml" select="document('http://docbook.sourceforge.net/release/xsl/current/common/l10n.xml')"/>
+ <xsl:param name="local.l10n.xml" select="document('')"/>
+
+ <xsl:key name="l10n"
+ match="l:i18n/l:l10n/l:context/l:template"
+ use="concat(../../@language, '#', ../@name, '#', @name, '#', @style)"/>
+
+ <xsl:template name="gentext.template">
+ <xsl:param name="context" select="'default'"/>
+ <xsl:param name="name" select="'default'"/>
+ <xsl:param name="origname" select="$name"/>
+ <xsl:param name="purpose"/>
+ <xsl:param name="xrefstyle"/>
+ <xsl:param name="referrer"/>
+ <xsl:param name="lang">
+ <xsl:call-template name="l10n.language"/>
+ </xsl:param>
+ <xsl:param name="verbose" select="1"/>
+
+ <xsl:variable name="key1" select="concat($lang, '#', $context, '#', $name, '#', $xrefstyle)"/>
+ <xsl:variable name="key2" select="concat($lang, '#', $context, '#', $name, '#')"/>
+
+ <xsl:for-each select="$local.l10n.xml">
+ <xsl:choose>
+ <xsl:when test="key('l10n', $key2)/@text">
+ <xsl:value-of select="key('l10n', $key2)/@text"/>
+ </xsl:when>
+ <xsl:when test="key('l10n', $key1)/@text">
+ <xsl:value-of select="key('l10n', $key1)/@text"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="$l10n.xml">
+ <xsl:choose>
+ <xsl:when test="key('l10n', $key2)/@text">
+ <xsl:value-of select="key('l10n', $key2)/@text"/>
+ </xsl:when>
+ <xsl:when test="key('l10n', $key1)/@text">
+ <xsl:value-of select="key('l10n', $key1)/@text"/>
+ </xsl:when>
+ <xsl:when test="contains($name, '/')">
+ <xsl:call-template name="gentext.template">
+ <xsl:with-param name="context" select="$context"/>
+ <xsl:with-param name="name" select="substring-after($name, '/')"/>
+ <xsl:with-param name="origname" select="$origname"/>
+ <xsl:with-param name="purpose" select="$purpose"/>
+ <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+ <xsl:with-param name="referrer" select="$referrer"/>
+ <xsl:with-param name="lang" select="$lang"/>
+ <xsl:with-param name="verbose" select="$verbose"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:when test="$verbose = 0">
+ <!-- silence -->
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>
+ <xsl:text>No template for "</xsl:text>
+ <xsl:value-of select="$origname"/>
+ <xsl:text>" (or any of its leaves) exists
+in the context named "</xsl:text>
+ <xsl:value-of select="$context"/>
+ <xsl:text>" in the "</xsl:text>
+ <xsl:value-of select="$lang"/>
+ <xsl:text>" localization.</xsl:text>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template>
+
+ <!-- Generate a title attribute for the context node -->
+ <xsl:template match="*" mode="html.title.attribute">
+
+ <xsl:variable name="lang">
+ <xsl:call-template name="l10n.language"/>
+ </xsl:variable>
+
+ <xsl:variable name="name" select="local-name(.)"/>
+
+ <xsl:variable name="key.title" select="concat($lang, '#', 'title', '#', $name, '#')"/>
+ <xsl:variable name="key.title-numbered" select="concat($lang, '#', 'title-numbered', '#', $name, '#')"/>
+ <xsl:variable name="key.title-unnumbered" select="concat($lang, '#', 'title-unnumbered', '#', $name, '#')"/>
+
+ <xsl:variable name="is.title.any">
+ <xsl:for-each select="$local.l10n.xml">
+ <xsl:choose>
+ <xsl:when test="key('l10n', $key.title)/@text">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="key('l10n', $key.title-numbered)/@text">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="key('l10n', $key.title-unnumbered)/@text">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="$l10n.xml">
+ <xsl:choose>
+ <xsl:when test="key('l10n', $key.title)/@text">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="key('l10n', $key.title-numbered)/@text">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:when test="key('l10n', $key.title-unnumbered)/@text">
+ <xsl:value-of select="1"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:variable name="has.title.markup">
+ <xsl:apply-templates select="." mode="title.markup">
+ <xsl:with-param name="verbose" select="0"/>
+ </xsl:apply-templates>
+ </xsl:variable>
+
+ <xsl:variable name="gentext.title">
+ <xsl:if test="$has.title.markup != '???TITLE???' and
+ ($is.title.any != 0)">
+ <xsl:apply-templates select="."
+ mode="object.title.markup.textonly"/>
+ </xsl:if>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="string-length($gentext.title) != 0">
+ <xsl:attribute name="title">
+ <xsl:value-of select="$gentext.title"/>
+ </xsl:attribute>
+ </xsl:when>
+ <!-- Fall back to alt if available -->
+ <xsl:when test="alt">
+ <xsl:attribute name="title">
+ <xsl:value-of select="normalize-space(alt)"/>
+ </xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
 
-<!-- ============================================================ -->
+ <xsl:template name="html.head">
+ <xsl:param name="prev" select="/foo"/>
+ <xsl:param name="next" select="/foo"/>
+ <xsl:variable name="this" select="."/>
+ <xsl:variable name="home" select="/*[1]"/>
+ <xsl:variable name="up" select="parent::*"/>
+
+ <head>
+ <xsl:call-template name="system.head.content"/>
+ <xsl:call-template name="head.content"/>
+
+ <xsl:if test="$home">
+ <link rel="home">
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="object" select="$home"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:apply-templates select="$home"
+ mode="object.title.markup.textonly"/>
+ </xsl:attribute>
+ </link>
+ </xsl:if>
+
+ <xsl:if test="$up">
+ <link rel="up">
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="object" select="$up"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
+ </xsl:attribute>
+ </link>
+ </xsl:if>
+
+ <xsl:if test="$prev">
+ <link rel="prev">
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="object" select="$prev"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
+ </xsl:attribute>
+ </link>
+ </xsl:if>
+
+ <xsl:if test="$next">
+ <link rel="next">
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="object" select="$next"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
+ </xsl:attribute>
+ </link>
+ </xsl:if>
+
+ <xsl:if test="$html.extra.head.links != 0">
+ <xsl:for-each select="//part
+ |//reference
+ |//preface
+ |//chapter
+ |//article
+ |//refentry
+ |//appendix[not(parent::article)]|appendix
+ |//glossary[not(parent::article)]|glossary
+ |//index[not(parent::article)]|index">
+ <link rel="{local-name(.)}">
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="context" select="$this"/>
+ <xsl:with-param name="object" select="."/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
+ </xsl:attribute>
+ </link>
+ </xsl:for-each>
+
+ <xsl:for-each select="section|sect1|refsection|refsect1">
+ <link>
+ <xsl:attribute name="rel">
+ <xsl:choose>
+ <xsl:when test="local-name($this) = 'section'
+ or local-name($this) = 'refsection'">
+ <xsl:value-of select="'subsection'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="'section'"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="context" select="$this"/>
+ <xsl:with-param name="object" select="."/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
+ </xsl:attribute>
+ </link>
+ </xsl:for-each>
+
+ <xsl:for-each select="sect2|sect3|sect4|sect5|refsect2|refsect3">
+ <link rel="subsection">
+ <xsl:attribute name="href">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="context" select="$this"/>
+ <xsl:with-param name="object" select="."/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
+ </xsl:attribute>
+ </link>
+ </xsl:for-each>
+ </xsl:if>
+
+ <!-- * if we have a legalnotice and user wants it output as a -->
+ <!-- * separate page and $html.head.legalnotice.link.types is -->
+ <!-- * non-empty, we generate a link or links for each value in -->
+ <!-- * $html.head.legalnotice.link.types -->
+ <xsl:if test="not($generate.legalnotice.link = 0)
+ and not($html.head.legalnotice.link.types = '')
+ and //legalnotice">
+ <xsl:call-template name="make.legalnotice.head.links"/>
+ </xsl:if>
+
+ <xsl:call-template name="user.head.content"/>
+ </head>
+ </xsl:template>
+
+ <xsl:template name="href.target">
+ <xsl:param name="context" select="."/>
+ <xsl:param name="object" select="."/>
+ <xsl:param name="toc-context" select="."/>
+ <xsl:variable name="href.to.uri">
+ <xsl:call-template name="href.target.uri">
+ <xsl:with-param name="object" select="$object"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="href.from.uri">
+ <xsl:choose>
+ <xsl:when test="not($toc-context = .)">
+ <xsl:call-template name="href.target.uri">
+ <xsl:with-param name="object" select="$toc-context"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="href.target.uri">
+ <xsl:with-param name="object" select="$context"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </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:template match="footnote" mode="footnote.number">
+ <xsl:choose>
+ <xsl:when test="string-length(@label) != 0">
+ <xsl:value-of select="@label"/>
+ </xsl:when>
+ <xsl:when test="ancestor::tgroup">
+ <xsl:variable name="tfnum">
+ <xsl:number level="any" from="table|informaltable" format="1"/>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="string-length($table.footnote.number.symbols) &gt;= $tfnum">
+ <xsl:value-of select="substring($table.footnote.number.symbols, $tfnum, 1)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:number level="any" from="tgroup"
+ format="{$table.footnote.number.format}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="pfoot" select="preceding::footnote[not(@label) and not(ancestor::tgroup)]"/>
+ <xsl:variable name="fnum" select="count($pfoot) + 1"/>
+
+ <xsl:choose>
+ <xsl:when test="string-length($footnote.number.symbols) &gt;= $fnum">
+ <xsl:value-of select="substring($footnote.number.symbols, $fnum, 1)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:number value="$fnum" format="{$footnote.number.format}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- ============================================================ -->
 
 <xsl:template name="output.html.stylesheets">
     <xsl:param name="stylesheets" select="''"/>

Modified: trunk/tools/boostbook/xsl/navbar.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/navbar.xsl (original)
+++ trunk/tools/boostbook/xsl/navbar.xsl 2010-03-24 04:48:28 EDT (Wed, 24 Mar 2010)
@@ -9,7 +9,8 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 version="1.0">
 
-<xsl:import href="relative-href.xsl"/>
+<!-- Already included in the main style sheet -->
+<!-- <xsl:import href="relative-href.xsl"/> -->
 
    <!--
       boost.defaults:


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk