1<?xml version="1.0"?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 3 version="1.0"> 4 5<xsl:import href="/html/chunk.xsl"/> 6 7<!-- ******************************************************************** 8 $Id: eclipse.xsl,v 1.3 2005/04/10 18:09:50 bobstayton Exp $ 9 ******************************************************************** 10 11 This file is part of the XSL DocBook Stylesheet distribution. 12 See /README or http://nwalsh.com/docbook/xsl/ for copyright 13 and other information. 14 15 ******************************************************************** --> 16 17<xsl:template match="/"> 18 <xsl:choose> 19 <xsl:when test="$rootid != ''"> 20 <xsl:choose> 21 <xsl:when test="count(key('id',$rootid)) = 0"> 22 <xsl:message terminate="yes"> 23 <xsl:text>ID '</xsl:text> 24 <xsl:value-of select="$rootid"/> 25 <xsl:text>' not found in document.</xsl:text> 26 </xsl:message> 27 </xsl:when> 28 <xsl:otherwise> 29 <xsl:if test="$collect.xref.targets = 'yes' or 30 $collect.xref.targets = 'only'"> 31 <xsl:apply-templates select="key('id', $rootid)" 32 mode="collect.targets"/> 33 </xsl:if> 34 <xsl:if test="$collect.xref.targets != 'only'"> 35 <xsl:message>Formatting from <xsl:value-of 36 select="$rootid"/></xsl:message> 37 <xsl:apply-templates select="key('id',$rootid)" 38 mode="process.root"/> 39 <xsl:call-template name="etoc"/> 40 <xsl:call-template name="plugin.xml"/> 41 </xsl:if> 42 </xsl:otherwise> 43 </xsl:choose> 44 </xsl:when> 45 <xsl:otherwise> 46 <xsl:if test="$collect.xref.targets = 'yes' or 47 $collect.xref.targets = 'only'"> 48 <xsl:apply-templates select="/" mode="collect.targets"/> 49 </xsl:if> 50 <xsl:if test="$collect.xref.targets != 'only'"> 51 <xsl:apply-templates select="/" mode="process.root"/> 52 <xsl:call-template name="etoc"/> 53 <xsl:call-template name="plugin.xml"/> 54 </xsl:if> 55 </xsl:otherwise> 56 </xsl:choose> 57 58 59</xsl:template> 60 61<xsl:template name="etoc"> 62 <xsl:call-template name="write.chunk"> 63 <xsl:with-param name="filename"> 64 <xsl:if test="$manifest.in.base.dir != 0"> 65 <xsl:value-of select="$base.dir"/> 66 </xsl:if> 67 <xsl:value-of select="'toc.xml'"/> 68 </xsl:with-param> 69 <xsl:with-param name="method" select="'xml'"/> 70 <xsl:with-param name="encoding" select="'utf-8'"/> 71 <xsl:with-param name="indent" select="'yes'"/> 72 <xsl:with-param name="content"> 73 <xsl:choose> 74 75 <xsl:when test="$rootid != ''"> 76 <xsl:variable name="title"> 77 <xsl:if test="$eclipse.autolabel=1"> 78 <xsl:variable name="label.markup"> 79 <xsl:apply-templates select="key('id',$rootid)" mode="label.markup"/> 80 </xsl:variable> 81 <xsl:if test="normalize-space($label.markup)"> 82 <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/> 83 </xsl:if> 84 </xsl:if> 85 <xsl:apply-templates select="key('id',$rootid)" mode="title.markup"/> 86 </xsl:variable> 87 <xsl:variable name="href"> 88 <xsl:call-template name="href.target.with.base.dir"> 89 <xsl:with-param name="object" select="key('id',$rootid)"/> 90 </xsl:call-template> 91 </xsl:variable> 92 93 <toc label="{$title}" topic="{$href}"> 94 <xsl:apply-templates select="key('id',$rootid)/*" mode="etoc"/> 95 </toc> 96 </xsl:when> 97 98 <xsl:otherwise> 99 <xsl:variable name="title"> 100 <xsl:if test="$eclipse.autolabel=1"> 101 <xsl:variable name="label.markup"> 102 <xsl:apply-templates select="/*" mode="label.markup"/> 103 </xsl:variable> 104 <xsl:if test="normalize-space($label.markup)"> 105 <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/> 106 </xsl:if> 107 </xsl:if> 108 <xsl:apply-templates select="/*" mode="title.markup"/> 109 </xsl:variable> 110 <xsl:variable name="href"> 111 <xsl:call-template name="href.target.with.base.dir"> 112 <xsl:with-param name="object" select="/"/> 113 </xsl:call-template> 114 </xsl:variable> 115 116 <toc label="{$title}" topic="{$href}"> 117 <xsl:apply-templates select="/*/*" mode="etoc"/> 118 </toc> 119 </xsl:otherwise> 120 121 </xsl:choose> 122 </xsl:with-param> 123 </xsl:call-template> 124</xsl:template> 125 126<xsl:template match="book|part|reference|preface|chapter|bibliography|appendix|article|glossary|section|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index" mode="etoc"> 127 <xsl:variable name="title"> 128 <xsl:if test="$eclipse.autolabel=1"> 129 <xsl:variable name="label.markup"> 130 <xsl:apply-templates select="." mode="label.markup"/> 131 </xsl:variable> 132 <xsl:if test="normalize-space($label.markup)"> 133 <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/> 134 </xsl:if> 135 </xsl:if> 136 <xsl:apply-templates select="." mode="title.markup"/> 137 </xsl:variable> 138 139 <xsl:variable name="href"> 140 <xsl:call-template name="href.target.with.base.dir"/> 141 </xsl:variable> 142 143 <topic label="{$title}" href="{$href}"> 144 <xsl:apply-templates select="part|reference|preface|chapter|bibliography|appendix|article|glossary|section|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index" mode="etoc"/> 145 </topic> 146 147</xsl:template> 148 149<xsl:template match="text()" mode="etoc"/> 150 151<xsl:template name="plugin.xml"> 152 <xsl:call-template name="write.chunk"> 153 <xsl:with-param name="filename"> 154 <xsl:if test="$manifest.in.base.dir != 0"> 155 <xsl:value-of select="$base.dir"/> 156 </xsl:if> 157 <xsl:value-of select="'plugin.xml'"/> 158 </xsl:with-param> 159 <xsl:with-param name="method" select="'xml'"/> 160 <xsl:with-param name="encoding" select="'utf-8'"/> 161 <xsl:with-param name="indent" select="'yes'"/> 162 <xsl:with-param name="content"> 163 <plugin name="{$eclipse.plugin.name}" 164 id="{$eclipse.plugin.id}" 165 version="1.0" 166 provider-name="{$eclipse.plugin.provider}"> 167 168 <extension point="org.eclipse.help.toc"> 169 <toc file="toc.xml" primary="true"/> 170 </extension> 171 172 </plugin> 173 </xsl:with-param> 174 </xsl:call-template> 175</xsl:template> 176 177</xsl:stylesheet> 178