summaryrefslogtreecommitdiffstats
path: root/kdoctools/docbook/xsl/html/maketoc.xsl
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kdoctools/docbook/xsl/html/maketoc.xsl
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdoctools/docbook/xsl/html/maketoc.xsl')
-rw-r--r--kdoctools/docbook/xsl/html/maketoc.xsl83
1 files changed, 83 insertions, 0 deletions
diff --git a/kdoctools/docbook/xsl/html/maketoc.xsl b/kdoctools/docbook/xsl/html/maketoc.xsl
new file mode 100644
index 000000000..d4d63fbec
--- /dev/null
+++ b/kdoctools/docbook/xsl/html/maketoc.xsl
@@ -0,0 +1,83 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
+ version="1.0"
+ exclude-result-prefixes="doc">
+
+<!-- ********************************************************************
+ $Id$
+ ********************************************************************
+
+ This file is part of the XSL DocBook Stylesheet distribution.
+ See ../README or http://nwalsh.com/docbook/xsl/ for copyright
+ and other information.
+
+ ******************************************************************** -->
+
+<!-- ==================================================================== -->
+
+<xsl:import href="docbook.xsl"/>
+<xsl:import href="chunk.xsl"/>
+
+<xsl:output method="xml" indent="no" encoding='utf-8'/>
+
+<xsl:param name="toc.list.type" select="'tocentry'"/>
+
+<!-- refentry in autotoc.xsl does not use subtoc, so must
+ handle it explicitly here. -->
+<xsl:template match="refentry" mode="toc">
+ <xsl:param name="toc-context" select="."/>
+
+ <xsl:call-template name="subtoc">
+ <xsl:with-param name="toc-context" select="$toc-context"/>
+ </xsl:call-template>
+</xsl:template>
+
+
+<xsl:template name="subtoc">
+ <xsl:param name="nodes" select="NOT-AN-ELEMENT"/>
+ <xsl:variable name="filename">
+ <xsl:apply-templates select="." mode="chunk-filename"/>
+ </xsl:variable>
+
+ <xsl:variable name="chunk">
+ <xsl:call-template name="chunk"/>
+ </xsl:variable>
+
+ <xsl:if test="$chunk != 0">
+ <xsl:call-template name="indent-spaces"/>
+ <tocentry linkend="{@id}">
+ <xsl:processing-instruction name="dbhtml">
+ <xsl:text>filename="</xsl:text>
+ <xsl:value-of select="$filename"/>
+ <xsl:text>"</xsl:text>
+ </xsl:processing-instruction>
+ <xsl:text>&#xA;</xsl:text>
+ <xsl:apply-templates mode="toc" select="$nodes"/>
+ <xsl:call-template name="indent-spaces"/>
+ </tocentry>
+ <xsl:text>&#xA;</xsl:text>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="indent-spaces">
+ <xsl:param name="node" select="."/>
+ <xsl:text> </xsl:text>
+ <xsl:if test="$node/parent::*">
+ <xsl:call-template name="indent-spaces">
+ <xsl:with-param name="node" select="$node/parent::*"/>
+ </xsl:call-template>
+ </xsl:if>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="/" priority="-1">
+ <xsl:text>&#xA;</xsl:text>
+ <toc role="chunk-toc">
+ <xsl:text>&#xA;</xsl:text>
+ <xsl:apply-templates select="/" mode="toc"/>
+ </toc>
+ <xsl:text>&#xA;</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>