boostbook/xsl/chunk-common.xsl
Daniel James 68bc7fa4dc Merge in improved ids in boostbook.
Merged revisions 44958,45130-45131,45152-45153,45366 via svnmerge from 
https://svn.boost.org/svn/boost/branches/doc

........
  r44958 | danieljames | 2008-05-01 00:08:20 +0100 (Thu, 01 May 2008) | 2 lines
  
  Don't generated file names with spaces, and replace multiple consecutive underscores with a single underscore. Refs #1705
........
  r45130 | danieljames | 2008-05-05 12:37:04 +0100 (Mon, 05 May 2008) | 2 lines
  
  Combine the two alternative versions of the function generate.id
........
  r45131 | danieljames | 2008-05-05 12:37:18 +0100 (Mon, 05 May 2008) | 2 lines
  
  Deal with generated ids that contain dots which aren't separators.
........
  r45152 | danieljames | 2008-05-05 21:28:44 +0100 (Mon, 05 May 2008) | 2 lines
  
  Only add the id to fully qualified ids inside specializations - so that we're not adding generated ids on to the end of generated ids.
........
  r45153 | danieljames | 2008-05-05 21:28:56 +0100 (Mon, 05 May 2008) | 2 lines
  
  If the same macro appears twice, generated unique ids.
........
  r45366 | danieljames | 2008-05-14 21:39:14 +0100 (Wed, 14 May 2008) | 2 lines
  
  Avoid removing underscores that are part of a class or function name.
........


[SVN r45577]
2008-05-20 15:49:55 +00:00

120 lines
3.7 KiB
XML

<?xml version="1.0"?>
<!--
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
-->
<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)">
<!-- translate dots into directory separators, and replace illegal file path characters with underscores -->
<xsl:value-of select="translate(normalize-space(translate($basename, '.&lt;&gt;\:*?&quot;|', '/ ' )), ' ', '_')"/>
<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:template match="@fileref">
<xsl:choose>
<xsl:when test="contains(., ':')">
<xsl:value-of select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="href.target.relative">
<xsl:with-param name="target" select="."/>
<xsl:with-param name="context" select=".."/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="@url">
<xsl:choose>
<xsl:when test="contains(., ':')">
<xsl:value-of select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:text>XXX</xsl:text>
<xsl:value-of select="."/>
<xsl:text>XXX</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>