Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60811 - trunk/tools/boostbook/xsl
From: daniel_james_at_[hidden]
Date: 2010-03-24 16:27:33


Author: danieljames
Date: 2010-03-24 16:27:32 EDT (Wed, 24 Mar 2010)
New Revision: 60811
URL: http://svn.boost.org/trac/boost/changeset/60811

Log:
Revert Steven's patches.

Sorry, I was on the wrong git branch when I checked in my unordered
change and accidentally checked in Steven's optimization patches at the
same time.
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/lookup.xsl | 350 ++++++++++++++++++--------------
   trunk/tools/boostbook/xsl/navbar.xsl | 3
   trunk/tools/boostbook/xsl/source-highlight.xsl | 143 ++++++++-----
   7 files changed, 309 insertions(+), 621 deletions(-)

Modified: trunk/tools/boostbook/xsl/admon.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/admon.xsl (original)
+++ trunk/tools/boostbook/xsl/admon.xsl 2010-03-24 16:27:32 EDT (Wed, 24 Mar 2010)
@@ -10,9 +10,7 @@
                 version="1.0">
 
 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/admon.xsl"/>
-
-<!-- Already included in the main style sheet -->
-<!-- <xsl:import href="relative-href.xsl"/> -->
+<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 16:27:32 EDT (Wed, 24 Mar 2010)
@@ -10,9 +10,7 @@
                 version="1.0">
 
 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/callout.xsl"/>
-
-<!-- Already included in the main style sheet -->
-<!-- <xsl:import href="relative-href.xsl"/> -->
+<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 16:27:32 EDT (Wed, 24 Mar 2010)
@@ -13,8 +13,7 @@
 <xsl:import
     href="http://docbook.sourceforge.net/release/xsl/current/html/chunk-common.xsl"/>
 
-<!-- Already included in the main stylesheet -->
-<!-- <xsl:import href="relative-href.xsl"/> -->
+<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 16:27:32 EDT (Wed, 24 Mar 2010)
@@ -8,7 +8,6 @@
   -->
 <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 -->
@@ -17,23 +16,14 @@
   <xsl:import
     href="http://docbook.sourceforge.net/release/xsl/current/html/math.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: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"/>
+
   <xsl:param name="html.stylesheet">
     <xsl:choose>
       <xsl:when test = "$boost.defaults = 'Boost'">
@@ -69,7 +59,14 @@
             select = "concat($boost.root, '/doc/html/images/')"/>
   <xsl:param name = "callout.graphics.path"
             select = "concat($boost.root, '/doc/src/images/callouts/')"/>
- <xsl:param name="l10n.gentext.language" select="'en'"/>
+
+
+ <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="generate.toc">
 appendix toc,title
@@ -282,394 +279,8 @@
         <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/lookup.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/lookup.xsl (original)
+++ trunk/tools/boostbook/xsl/lookup.xsl 2010-03-24 16:27:32 EDT (Wed, 24 Mar 2010)
@@ -7,7 +7,6 @@
    http://www.boost.org/LICENSE_1_0.txt)
   -->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:exsl="http://exslt.org/common"
                 version="1.0">
 
   <!-- Maximum length of directory and file names is 31 characters.
@@ -155,73 +154,40 @@
   <xsl:template name="build-fully-qualified-name">
     <xsl:param name="is.id" select="false()" />
 
+ <!-- The depth of qualified name element that we will print now-->
+ <xsl:param name="depth" select="1"/>
+
     <!-- Determine the set of ancestor namespaces -->
     <xsl:variable name="ancestors"
       select="ancestor::namespace|
                   ancestor::class|ancestor::struct|ancestor::union|
                   ancestor::class-specialization|ancestor::struct-specialization|ancestor::union-specialization"/>
 
- <xsl:variable name="is-free-function-group" select="boolean(ancestor::free-function-group)"/>
-
- <xsl:for-each select="$ancestors">
- <xsl:if test="not($is-free-function-group) or name(.)='namespace'">
- <xsl:apply-templates select="." mode="fast-print-id-part">
+ <xsl:choose>
+ <xsl:when test="$depth &gt; count($ancestors)">
+ <xsl:apply-templates select="." mode="print-id-part">
           <xsl:with-param name="is.id" select="$is.id"/>
         </xsl:apply-templates>
- <xsl:choose>
- <xsl:when test="$is.id">
- <xsl:text>.</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>::</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:for-each>
- <xsl:apply-templates select="." mode="fast-print-id-part">
- <xsl:with-param name="is.id" select="$is.id"/>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:variable name="elements-with-ids">
- <xsl:apply-templates select="namespace|class|struct|union|class-specialization|struct-specialization|union-specialization"
- mode="preprocess-ids"/>
- </xsl:variable>
-
- <xsl:variable name="fast-elements" select="exsl:node-set($elements-with-ids)"/>
-
- <xsl:template match="*" mode="preprocess-ids">
- <element>
- <xsl:attribute name="id">
- <xsl:value-of select="generate-id()"/>
- </xsl:attribute>
- <xsl:attribute name="part-id">
- <xsl:call-template name="print-id-part"/>
- </xsl:attribute>
- </element>
- </xsl:template>
-
- <xsl:template name="print-id-part">
- <xsl:apply-templates select="." mode="print-id-part"/>
- </xsl:template>
-
- <xsl:template match="*" mode="fast-print-id-part">
- <xsl:param name="is.id"/>
- <xsl:choose>
- <xsl:when test="not($is.id)">
- <xsl:apply-templates select="." mode="print-name"/>
- </xsl:when>
- <xsl:when test="$fast-elements[@id=generate-id()]">
- <xsl:value-of select="$fast-elements[@id=generate-id()]/@part-id"/>
       </xsl:when>
       <xsl:otherwise>
- <xsl:apply-templates select="." mode="print-id-part">
+ <xsl:if test="name($ancestors[$depth])='namespace' or
+ count(ancestor::free-function-group)=0">
+ <xsl:apply-templates select="$ancestors[$depth]" mode="print-id-part">
+ <xsl:with-param name="is.id" select="$is.id"/>
+ </xsl:apply-templates>
+ <xsl:choose>
+ <xsl:when test="$is.id"><xsl:text>.</xsl:text></xsl:when>
+ <xsl:otherwise><xsl:text>::</xsl:text></xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:call-template name="build-fully-qualified-name">
           <xsl:with-param name="is.id" select="$is.id"/>
- </xsl:apply-templates>
+ <xsl:with-param name="depth" select="$depth + 1"/>
+ </xsl:call-template>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
-
+
   <!-- Print the part of a fully qualified name for a single element -->
   <xsl:template match="*" mode="print-id-part">
     <xsl:param name="is.id"/>
@@ -286,93 +252,167 @@
     <xsl:apply-templates select="specialization/template-arg" mode="print-name"/>
     <xsl:text>&gt;</xsl:text>
   </xsl:template>
-
- <xsl:template name="concat-directives">
- <xsl:param name="directives"/>
- <xsl:for-each select="$directives">
- <xsl:apply-templates select="." mode="print-name"/>
- <xsl:text>::</xsl:text>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="get-name-qualifiers">
- <xsl:param name="name"/>
- <xsl:param name="node"/>
-
- <!-- Find the name of the node -->
- <xsl:variable name="qualified-name">
- <xsl:call-template name="fully-qualified-name">
- <xsl:with-param name="node" select="$node"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:if test="not(string-length($name) &gt; string-length($qualified-name)) and
- substring($qualified-name, string-length($qualified-name) - string-length($name) + 1) = $name">
- <xsl:text>::</xsl:text>
- <xsl:value-of select="substring($qualified-name, 1, string-length($qualified-name) - string-length($name))"/>
- </xsl:if>
 
- </xsl:template>
-
- <xsl:template name="find-nodes-matching-name">
+ <xsl:template name="name-matches-node">
     <!-- The name we are looking for -->
     <xsl:param name="name"/>
 
+ <!-- The name to display -->
+ <xsl:param name="display-name" select="$name"/>
+
     <!-- The context in which this name occurs -->
     <xsl:param name="context"/>
 
     <!-- The node that we are checking against -->
- <xsl:param name="nodes"/>
+ <xsl:param name="node"/>
+
+ <!-- The mode we are in. Can be one of:
+ matches: emits the matches as they are found (for debugging)
+ link: link to the node that was found
+ -->
+ <xsl:param name="mode" select="'matches'"/>
+
+ <!-- The index into the list of using directives for the context node -->
+ <xsl:param name="index" select="1"/>
+
+ <!-- The prefix we should append to the name when checking this node -->
+ <xsl:param name="prefix" select="''"/>
+
+ <xsl:choose>
+ <xsl:when test="count($node) &gt; 1">
+ <xsl:variable name="matches">
+ <xsl:call-template name="count-matches">
+ <xsl:with-param name="name" select="$name"/>
+ <xsl:with-param name="context" select="$context"/>
+ <xsl:with-param name="nodes" select="$node[position() = 1]"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="$matches = 0">
+ <xsl:call-template name="name-matches-node">
+ <xsl:with-param name="name" select="$name"/>
+ <xsl:with-param name="display-name" select="$display-name"/>
+ <xsl:with-param name="context" select="$context"/>
+ <xsl:with-param name="node" select="$node[position() &gt; 1]"/>
+ <xsl:with-param name="mode" select="$mode"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="name-matches-node">
+ <xsl:with-param name="name" select="$name"/>
+ <xsl:with-param name="display-name" select="$display-name"/>
+ <xsl:with-param name="context" select="$context"/>
+ <xsl:with-param name="node" select="$node[position() = 1]"/>
+ <xsl:with-param name="mode" select="$mode"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="count($node) = 1">
+ <!-- The fully-qualified name of the node we are checking against -->
+ <xsl:variable name="fully-qualified-name">
+ <xsl:call-template name="fully-qualified-name">
+ <xsl:with-param name="node" select="$node"/>
+ </xsl:call-template>
+ </xsl:variable>
 
- <!-- The set of using directives for this context node -->
- <xsl:variable name="directives"
- select="$context/ancestor::*/using-namespace |
+ <!-- The set of using directives for this context node -->
+ <xsl:variable name="directives"
+ select="$context/ancestor::*/using-namespace |
                   $context/ancestor::namespace |
                   $context/ancestor::*/using-class |
                   $context/ancestor::class |
                   $context/ancestor::struct"/>
 
- <xsl:variable name="directives-str">
- <xsl:text>::</xsl:text>
- <xsl:call-template name="concat-directives">
- <xsl:with-param name="directives" select="$directives"/>
- </xsl:call-template>
- </xsl:variable>
+ <!-- The name of the current directive -->
+ <xsl:variable name="this-context">
+ <xsl:apply-templates select="$directives[$index]" mode="print-name"/>
+ </xsl:variable>
 
- <xsl:apply-templates select="$nodes" mode="generate-cxx-links">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="directives-str" select="$directives-str"/>
- </xsl:apply-templates>
+ <!-- Check if we have a match -->
+ <xsl:variable name="have-match"
+ select="$fully-qualified-name = concat($prefix, $name)"/>
+
+ <xsl:if test="$have-match">
+ <xsl:choose>
+ <xsl:when test="$mode='matches'">
+ Match in namespace ::<xsl:value-of select="$prefix"/>
+ </xsl:when>
+ <xsl:when test="$mode='link'">
+ <xsl:call-template name="internal-link">
+ <xsl:with-param name="to">
+ <xsl:call-template name="generate.id">
+ <xsl:with-param name="node" select="$node"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ <xsl:with-param name="text" select="$display-name"/>
+ </xsl:call-template>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+
+ <xsl:if test="(not($index &gt; count($directives))) and
+ (not($have-match) or ($mode = 'matches'))">
+ <xsl:variable name="first-branch">
+ <xsl:if test="not ($prefix = '')">
+ <!-- Recurse and append the current context node to the prefix -->
+ <xsl:call-template name="name-matches-node">
+ <xsl:with-param name="name" select="$name"/>
+ <xsl:with-param name="display-name" select="$display-name"/>
+ <xsl:with-param name="context" select="$context"/>
+ <xsl:with-param name="node" select="$node"/>
+ <xsl:with-param name="mode" select="$mode"/>
+ <xsl:with-param name="index" select="$index + 1"/>
+ <xsl:with-param name="prefix"
+ select="concat($prefix, $this-context, '::')"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="string($first-branch) != ''">
+ <xsl:copy-of select="$first-branch"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Recurse with just the current context node -->
+ <xsl:call-template name="name-matches-node">
+ <xsl:with-param name="name" select="$name"/>
+ <xsl:with-param name="display-name" select="$display-name"/>
+ <xsl:with-param name="context" select="$context"/>
+ <xsl:with-param name="node" select="$node"/>
+ <xsl:with-param name="mode" select="$mode"/>
+ <xsl:with-param name="index" select="$index + 1"/>
+ <xsl:with-param name="prefix"
+ select="concat($this-context, '::')"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:when>
+ </xsl:choose>
   </xsl:template>
-
- <xsl:template match="*" mode="generate-cxx-links">
+
+ <!-- Count the number of nodes in the set that match the given name and
+ lookup context -->
+ <xsl:template name="count-matches">
     <xsl:param name="name"/>
- <xsl:param name="directives-str"/>
+ <xsl:param name="context"/>
+ <xsl:param name="nodes"/>
 
- <xsl:variable name="qualifiers">
- <xsl:call-template name="get-name-qualifiers">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
+ <xsl:variable name="match-string">
+ <xsl:for-each select="$nodes">
+ <xsl:variable name="does-match">
+ <xsl:call-template name="name-matches-node">
+ <xsl:with-param name="name" select="$name"/>
+ <xsl:with-param name="context" select="$context"/>
+ <xsl:with-param name="node" select="."/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="not($does-match='')">X</xsl:if>
+ </xsl:for-each>
     </xsl:variable>
-
- <!-- Check if this node matches any visible namespace -->
- <xsl:if test="string-length($qualifiers) != 0 and contains($directives-str, $qualifiers)">
- <xsl:variable name="myid">
- <xsl:call-template name="generate.id">
- <xsl:with-param name="node" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <cxx-link-helper>
- <xsl:attribute name="id">
- <xsl:value-of select="$myid"/>
- </xsl:attribute>
- <xsl:attribute name="namespace">
- <xsl:value-of select="$qualifiers"/>
- </xsl:attribute>
- <xsl:text>random text</xsl:text>
- </cxx-link-helper>
- </xsl:if>
+ <xsl:value-of select="string-length($match-string)"/>
   </xsl:template>
 
   <xsl:template name="cxx-link-name">
@@ -393,20 +433,18 @@
 
     <!-- The list of nodes that match the lookup node in both name and type -->
     <xsl:param name="nodes"/>
-
- <!-- Filter the nodes to leave only the ones that are in scope. -->
- <xsl:variable name="matches1">
- <xsl:call-template name="find-nodes-matching-name">
+
+ <!-- Count the number of nodes that match -->
+ <xsl:variable name="matches">
+ <xsl:call-template name="count-matches">
         <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="nodes" select="$nodes"/>
         <xsl:with-param name="context" select="$lookup"/>
+ <xsl:with-param name="nodes" select="$nodes"/>
       </xsl:call-template>
     </xsl:variable>
-
- <xsl:variable name="matches" select="exsl:node-set($matches1)//cxx-link-helper"/>
 
     <xsl:choose>
- <xsl:when test="count($matches) = 0">
+ <xsl:when test="$matches = 0">
         <xsl:message>
           <xsl:text>Cannot find </xsl:text>
           <xsl:value-of select="$type"/>
@@ -416,27 +454,39 @@
         </xsl:message>
         <xsl:value-of select="$display-name"/>
       </xsl:when>
+ <xsl:when test="$matches = 1">
+ <xsl:for-each select="$nodes">
+ <xsl:call-template name="name-matches-node">
+ <xsl:with-param name="name" select="$name"/>
+ <xsl:with-param name="display-name" select="$display-name"/>
+ <xsl:with-param name="context" select="$lookup"/>
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="mode" select="'link'"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:when>
       <xsl:otherwise>
- <!-- If we found more than one, print a message and take the first -->
- <xsl:if test="count($matches) &gt; 1">
- <xsl:message>
- <xsl:text>Reference to </xsl:text>
- <xsl:value-of select="$type"/>
- <xsl:text> '</xsl:text>
- <xsl:value-of select="$name"/>
- <xsl:text>' is ambiguous. Found:</xsl:text>
- <xsl:for-each select="$matches">
- <xsl:text>
- Match in namespace </xsl:text>
- <xsl:value-of select="@namespace"/>
- </xsl:for-each>
- </xsl:message>
- </xsl:if>
- <xsl:call-template name="internal-link">
- <xsl:with-param name="to">
- <xsl:value-of select="$matches[position() = 1]/@id"/>
- </xsl:with-param>
- <xsl:with-param name="text" select="$display-name"/>
+ <xsl:message>
+ <xsl:text>Reference to </xsl:text>
+ <xsl:value-of select="$type"/>
+ <xsl:text> '</xsl:text>
+ <xsl:value-of select="$name"/>
+ <xsl:text>' is ambiguous. Found:</xsl:text>
+ <xsl:for-each select="$nodes">
+ <xsl:call-template name="name-matches-node">
+ <xsl:with-param name="name" select="$name"/>
+ <xsl:with-param name="context" select="$lookup"/>
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="mode" select="'matches'"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:message>
+ <xsl:call-template name="name-matches-node">
+ <xsl:with-param name="name" select="$name"/>
+ <xsl:with-param name="display-name" select="$display-name"/>
+ <xsl:with-param name="context" select="$lookup"/>
+ <xsl:with-param name="node" select="$nodes"/>
+ <xsl:with-param name="mode" select="'link'"/>
         </xsl:call-template>
       </xsl:otherwise>
     </xsl:choose>

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

Modified: trunk/tools/boostbook/xsl/source-highlight.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/source-highlight.xsl (original)
+++ trunk/tools/boostbook/xsl/source-highlight.xsl 2010-03-24 16:27:32 EDT (Wed, 24 Mar 2010)
@@ -23,79 +23,112 @@
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
-
- <xsl:variable name="id-chars" select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_'"/>
- <xsl:variable name="keywords"
- select="' asm auto bool break case catch char class const const_cast continue default delete do double dynamic_cast else enum explicit export extern false float for friend goto if inline int long mutable namespace new operator private protected public register reinterpret_cast return short signed sizeof static static_cast struct switch template this throw true try typedef typeid typename union unsigned using virtual void volatile wchar_t while '"/>
+
+ <!-- Perform C++ keyword highlighting on the given text -->
+ <xsl:template name="highlight-text">
+ <xsl:param name="text" select="."/>
+ <xsl:param name="keywords"
+ select="'asm auto bool break case catch char class const const_cast continue default delete do double dynamic_cast else enum explicit export extern false float for friend goto if inline int long mutable namespace new operator private protected public register reinterpret_cast return short signed sizeof static static_cast struct switch template this throw true try typedef typeid typename union unsigned using virtual void volatile wchar_t while'"/>
+ <xsl:param name="best-match" select="''"/>
     
+ <!-- Determine the current keyword -->
+ <xsl:variable name="keyword">
+ <xsl:choose>
+ <xsl:when test="contains($keywords, ' ')">
+ <xsl:value-of select="substring-before($keywords, ' ')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$keywords"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- Determine the set of keywords that are left -->
+ <xsl:variable name="keywords-left">
+ <xsl:if test="contains($keywords, ' ')">
+ <xsl:value-of select="substring-after($keywords, ' ')"/>
+ </xsl:if>
+ </xsl:variable>
+
+ <!-- The set of characters that can be identifiers -->
+ <xsl:variable name="id-chars" select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'"/>
+
+ <xsl:variable name="X" select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'"/>
 
- <xsl:template name="highlight-identifier">
- <xsl:param name="identifier"/>
     <xsl:choose>
- <xsl:when test="contains($keywords, concat(' ', $identifier, ' '))">
+ <!-- Have we exhausted all keywords without finding any to highlight? -->
+ <xsl:when test="$keyword='' and $best-match=''">
+ <!-- Just copy the text -->
+ <xsl:copy-of select="$text"/>
+ </xsl:when>
+
+ <!-- Have we exhausted all keywords, but have one to highlight? If so,
+ make sure we didn't just find part of an identifier. -->
+ <xsl:when
+ test="$keyword='' and
+ not (starts-with(translate(substring-after($text, $best-match),
+ $id-chars, $X), 'X')) and
+ not (substring(translate(substring-before($text, $best-match),
+ $id-chars, $X),
+ string-length(substring-before($text,
+ $best-match)),
+ 1) = 'X')">
+ <!-- Copy text before this keyword -->
+ <xsl:value-of select="substring-before($text, $best-match)"/>
+
+ <!-- Highlight the keyword -->
         <xsl:call-template name="highlight-keyword">
- <xsl:with-param name="keyword" select="$identifier"/>
+ <xsl:with-param name="keyword" select="$best-match"/>
         </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$identifier"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="highlight-text-impl-ident">
- <xsl:param name="text"/>
- <xsl:param name="pos"/>
- <xsl:choose>
- <xsl:when test="string-length($text) + 1 = $pos">
- <xsl:call-template name="highlight-identifier">
- <xsl:with-param name="identifier" select="substring($text, 1, $pos - 1)"/>
+
+ <!-- Recurse on the rest of the text -->
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text"
+ select="substring-after($text, $best-match)"/>
         </xsl:call-template>
       </xsl:when>
- <xsl:when test="contains($id-chars, substring($text, $pos, 1))">
- <xsl:call-template name ="highlight-text-impl-ident">
- <xsl:with-param name="text" select="$text"/>
- <xsl:with-param name="pos" select="$pos + 1"/>
+
+ <!-- We thought we had a keyword to highlight, but it was part of an
+ identifier. So output all of the text up to (but not including!)
+ the last letter of the identifier, and try again to
+ highlight. -->
+ <xsl:when test="$keyword=''">
+ <xsl:value-of select="substring-before($text, $best-match)"/>
+ <xsl:value-of
+ select="substring($best-match, 1, string-length($best-match)-1)"/>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text"
+ select="concat(substring($best-match, string-length($best-match),
+ 1), substring-after($text, $best-match))"/>
         </xsl:call-template>
       </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="highlight-identifier">
- <xsl:with-param name="identifier" select="substring($text, 1, $pos - 1)"/>
- </xsl:call-template>
- <xsl:call-template name ="highlight-text-impl-root">
- <xsl:with-param name="text" select="substring($text, $pos)"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="highlight-text-impl-root">
- <xsl:param name="text"/>
- <xsl:choose>
- <xsl:when test="string-length($text) = 0"/>
- <xsl:when test="contains($id-chars, substring($text, 1, 1))">
- <xsl:call-template name="highlight-text-impl-ident">
+
+ <!-- Does the text contain this keyword with a better match than we
+ previously had? -->
+ <xsl:when
+ test="contains($text, $keyword) and
+ (($best-match = '') or
+ (string-length(substring-before($text, $keyword)) &lt;
+ string-length(substring-before($text, $best-match))))">
+ <!-- Recurse with the current keyword as the new best match -->
+ <xsl:call-template name="highlight-text">
           <xsl:with-param name="text" select="$text"/>
- <xsl:with-param name="pos" select="2"/>
+ <xsl:with-param name="keywords" select="$keywords-left"/>
+ <xsl:with-param name="best-match" select="$keyword"/>
         </xsl:call-template>
       </xsl:when>
+
+ <!-- Text does not contain this keyword. Just recurse normally -->
       <xsl:otherwise>
- <xsl:value-of select="substring($text, 1, 1)"/>
- <xsl:call-template name="highlight-text-impl-root">
- <xsl:with-param name="text" select="substring($text, 2)"/>
+ <xsl:call-template name="highlight-text">
+ <xsl:with-param name="text" select="$text"/>
+ <xsl:with-param name="keywords" select="$keywords-left"/>
+ <xsl:with-param name="best-match" select="$best-match"/>
         </xsl:call-template>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
 
- <!-- Perform C++ keyword highlighting on the given text -->
- <xsl:template name="highlight-text">
- <xsl:param name="text" select="."/>
- <xsl:call-template name="highlight-text-impl-root">
- <xsl:with-param name="text" select="$text"/>
- </xsl:call-template>
- </xsl:template>
-
   <xsl:template match="*" mode="highlight">
     <xsl:element name="{name(.)}">
       <xsl:for-each select="./@*">


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