source: stylesheets/lfs-xsl/docbook-xsl-1.78.1/eclipse/eclipse.xsl@ b1a51ac1

7.5-systemd 7.6-systemd 7.7-systemd 7.8-systemd 7.9-systemd
Last change on this file since b1a51ac1 was b1a51ac1, checked in by Krejzi <krejzi@…>, 11 years ago

Import new branch

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/systemd/BOOK@10389 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 11.9 KB
Line 
1<?xml version="1.0"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:ng="http://docbook.org/docbook-ng"
4 xmlns:db="http://docbook.org/ns/docbook"
5 xmlns:exsl="http://exslt.org/common"
6 version="1.0"
7 exclude-result-prefixes="exsl db ng">
8
9<xsl:import href="../html/chunk.xsl"/>
10
11<!-- ********************************************************************
12 $Id: eclipse.xsl 9149 2011-11-12 00:12:07Z bobstayton $
13 ********************************************************************
14
15 This file is part of the XSL DocBook Stylesheet distribution.
16 See ../README or http://docbook.sf.net/release/xsl/current/ for
17 copyright and other information.
18
19 ******************************************************************** -->
20
21<xsl:template match="/">
22 <!-- * Get a title for current doc so that we let the user -->
23 <!-- * know what document we are processing at this point. -->
24 <xsl:variable name="doc.title">
25 <xsl:call-template name="get.doc.title"/>
26 </xsl:variable>
27 <xsl:choose>
28 <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
29 toss the namespace and continue. Use the docbook5 namespaced
30 stylesheets for DocBook5 if you don't want to use this feature.-->
31 <!-- include extra test for Xalan quirk -->
32 <xsl:when test="$exsl.node.set.available != 0
33 and (*/self::ng:* or */self::db:*)">
34 <xsl:call-template name="log.message">
35 <xsl:with-param name="level">Note</xsl:with-param>
36 <xsl:with-param name="source" select="$doc.title"/>
37 <xsl:with-param name="context-desc">
38 <xsl:text>namesp. cut</xsl:text>
39 </xsl:with-param>
40 <xsl:with-param name="message">
41 <xsl:text>stripped namespace before processing</xsl:text>
42 </xsl:with-param>
43 </xsl:call-template>
44 <xsl:variable name="nons">
45 <xsl:apply-templates mode="stripNS"/>
46 </xsl:variable>
47 <xsl:call-template name="log.message">
48 <xsl:with-param name="level">Note</xsl:with-param>
49 <xsl:with-param name="source" select="$doc.title"/>
50 <xsl:with-param name="context-desc">
51 <xsl:text>namesp. cut</xsl:text>
52 </xsl:with-param>
53 <xsl:with-param name="message">
54 <xsl:text>processing stripped document</xsl:text>
55 </xsl:with-param>
56 </xsl:call-template>
57 <xsl:apply-templates select="exsl:node-set($nons)"/>
58 </xsl:when>
59 <xsl:otherwise>
60 <xsl:choose>
61 <xsl:when test="$rootid != ''">
62 <xsl:choose>
63 <xsl:when test="count(key('id',$rootid)) = 0">
64 <xsl:message terminate="yes">
65 <xsl:text>ID '</xsl:text>
66 <xsl:value-of select="$rootid"/>
67 <xsl:text>' not found in document.</xsl:text>
68 </xsl:message>
69 </xsl:when>
70 <xsl:otherwise>
71 <xsl:if test="$collect.xref.targets = 'yes' or
72 $collect.xref.targets = 'only'">
73 <xsl:apply-templates select="key('id', $rootid)"
74 mode="collect.targets"/>
75 </xsl:if>
76 <xsl:if test="$collect.xref.targets != 'only'">
77 <xsl:message>Formatting from <xsl:value-of
78 select="$rootid"/></xsl:message>
79 <xsl:apply-templates select="key('id',$rootid)"
80 mode="process.root"/>
81 <xsl:call-template name="etoc"/>
82 <xsl:call-template name="plugin.xml"/>
83 <xsl:call-template name="helpidx"/>
84 </xsl:if>
85 </xsl:otherwise>
86 </xsl:choose>
87 </xsl:when>
88 <xsl:otherwise>
89 <xsl:if test="$collect.xref.targets = 'yes' or
90 $collect.xref.targets = 'only'">
91 <xsl:apply-templates select="/" mode="collect.targets"/>
92 </xsl:if>
93 <xsl:if test="$collect.xref.targets != 'only'">
94 <xsl:apply-templates select="/" mode="process.root"/>
95 <xsl:call-template name="etoc"/>
96 <xsl:call-template name="plugin.xml"/>
97 <xsl:call-template name="helpidx"/>
98 </xsl:if>
99 </xsl:otherwise>
100 </xsl:choose>
101</xsl:otherwise>
102</xsl:choose>
103</xsl:template>
104
105<xsl:template name="etoc">
106 <xsl:call-template name="write.chunk">
107 <xsl:with-param name="filename">
108 <xsl:if test="$manifest.in.base.dir != 0">
109 <xsl:value-of select="$chunk.base.dir"/>
110 </xsl:if>
111 <xsl:value-of select="'toc.xml'"/>
112 </xsl:with-param>
113 <xsl:with-param name="method" select="'xml'"/>
114 <xsl:with-param name="encoding" select="'utf-8'"/>
115 <xsl:with-param name="indent" select="'yes'"/>
116 <xsl:with-param name="quiet" select="$chunk.quietly"/>
117 <xsl:with-param name="content">
118 <xsl:choose>
119
120 <xsl:when test="$rootid != ''">
121 <xsl:variable name="title">
122 <xsl:if test="$eclipse.autolabel=1">
123 <xsl:variable name="label.markup">
124 <xsl:apply-templates select="key('id',$rootid)" mode="label.markup"/>
125 </xsl:variable>
126 <xsl:if test="normalize-space($label.markup)">
127 <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
128 </xsl:if>
129 </xsl:if>
130 <xsl:apply-templates select="key('id',$rootid)" mode="title.markup"/>
131 </xsl:variable>
132 <xsl:variable name="href">
133 <xsl:call-template name="href.target.with.base.dir">
134 <xsl:with-param name="object" select="key('id',$rootid)"/>
135 </xsl:call-template>
136 </xsl:variable>
137
138 <toc label="{normalize-space($title)}" topic="{$href}">
139 <xsl:apply-templates select="key('id',$rootid)/*" mode="etoc"/>
140 </toc>
141 </xsl:when>
142
143 <xsl:otherwise>
144 <xsl:variable name="title">
145 <xsl:if test="$eclipse.autolabel=1">
146 <xsl:variable name="label.markup">
147 <xsl:apply-templates select="/*" mode="label.markup"/>
148 </xsl:variable>
149 <xsl:if test="normalize-space($label.markup)">
150 <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
151 </xsl:if>
152 </xsl:if>
153 <xsl:apply-templates select="/*" mode="title.markup"/>
154 </xsl:variable>
155 <xsl:variable name="href">
156 <xsl:call-template name="href.target.with.base.dir">
157 <xsl:with-param name="object" select="/"/>
158 </xsl:call-template>
159 </xsl:variable>
160
161 <toc label="{normalize-space($title)}" topic="{$href}">
162 <xsl:apply-templates select="/*/*" mode="etoc"/>
163 </toc>
164 </xsl:otherwise>
165
166 </xsl:choose>
167 </xsl:with-param>
168 </xsl:call-template>
169</xsl:template>
170
171<xsl:template match="book|part|reference|preface|chapter|bibliography|appendix|article|glossary|section|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index" mode="etoc">
172 <xsl:variable name="title">
173 <xsl:if test="$eclipse.autolabel=1">
174 <xsl:variable name="label.markup">
175 <xsl:apply-templates select="." mode="label.markup"/>
176 </xsl:variable>
177 <xsl:if test="normalize-space($label.markup)">
178 <xsl:value-of select="concat($label.markup,$autotoc.label.separator)"/>
179 </xsl:if>
180 </xsl:if>
181 <xsl:apply-templates select="." mode="title.markup"/>
182 </xsl:variable>
183
184 <xsl:variable name="href">
185 <xsl:call-template name="href.target.with.base.dir">
186 <xsl:with-param name="context" select="/"/> <!-- Generate links relative to the location of root file/toc.xml file -->
187 </xsl:call-template>
188 </xsl:variable>
189
190 <topic label="{normalize-space($title)}" href="{$href}">
191 <xsl:apply-templates select="part|reference|preface|chapter|bibliography|appendix|article|glossary|section|sect1|sect2|sect3|sect4|sect5|refentry|colophon|bibliodiv|index" mode="etoc"/>
192 </topic>
193
194</xsl:template>
195
196<xsl:template match="text()" mode="etoc"/>
197
198<xsl:template name="plugin.xml">
199 <xsl:call-template name="write.chunk">
200 <xsl:with-param name="filename">
201 <xsl:if test="$manifest.in.base.dir != 0">
202 <xsl:value-of select="$chunk.base.dir"/>
203 </xsl:if>
204 <xsl:value-of select="'plugin.xml'"/>
205 </xsl:with-param>
206 <xsl:with-param name="method" select="'xml'"/>
207 <xsl:with-param name="encoding" select="'utf-8'"/>
208 <xsl:with-param name="indent" select="'yes'"/>
209 <xsl:with-param name="quiet" select="$chunk.quietly"/>
210 <xsl:with-param name="content">
211 <plugin name="{$eclipse.plugin.name}"
212 id="{$eclipse.plugin.id}"
213 version="1.0"
214 provider-name="{$eclipse.plugin.provider}">
215
216 <extension point="org.eclipse.help.toc">
217 <toc file="toc.xml" primary="true"/>
218 </extension>
219 <extension point="org.eclipse.help.index">
220 <index file="index.xml"/>
221 </extension>
222 </plugin>
223 </xsl:with-param>
224 </xsl:call-template>
225</xsl:template>
226
227<!-- ==================================================================== -->
228<!-- The following templates come from the javahelp xsls with modifications needed to make them generate and ecilpse index.xml file -->
229
230<xsl:template name="helpidx">
231 <xsl:call-template name="write.chunk.with.doctype">
232 <xsl:with-param name="filename" select="concat($chunk.base.dir, 'index.xml')"/>
233 <xsl:with-param name="method" select="'xml'"/>
234 <xsl:with-param name="indent" select="'yes'"/>
235 <xsl:with-param name="doctype-public" select="''"/>
236 <xsl:with-param name="doctype-system" select="''"/>
237 <xsl:with-param name="encoding" select="'utf-8'"/>
238 <xsl:with-param name="quiet" select="$chunk.quietly"/>
239 <xsl:with-param name="content">
240 <xsl:call-template name="helpidx.content"/>
241 </xsl:with-param>
242 </xsl:call-template>
243</xsl:template>
244
245 <xsl:template name="helpidx.content">
246 <index>
247 <xsl:choose>
248 <xsl:when test="$rootid != ''">
249 <xsl:apply-templates select="key('id',$rootid)//indexterm" mode="idx">
250 <xsl:sort select="normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = '']))"/>
251 <xsl:sort select="normalize-space(concat(secondary/@sortas, secondary[not(@sortas) or @sortas = '']))"/>
252 <xsl:sort select="normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas) or @sortas = '']))"/>
253 </xsl:apply-templates>
254 </xsl:when>
255 <xsl:otherwise>
256 <xsl:apply-templates select="//indexterm" mode="idx">
257 <xsl:sort select="normalize-space(concat(primary/@sortas, primary[not(@sortas) or @sortas = '']))"/>
258 <xsl:sort select="normalize-space(concat(secondary/@sortas, secondary[not(@sortas) or @sortas = '']))"/>
259 <xsl:sort select="normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas) or @sortas = '']))"/>
260 </xsl:apply-templates>
261 </xsl:otherwise>
262 </xsl:choose>
263 </index>
264 </xsl:template>
265
266 <xsl:template match="indexterm[@class='endofrange']" mode="idx"/>
267
268 <xsl:template match="indexterm|primary|secondary|tertiary" mode="idx">
269
270 <xsl:variable name="href">
271 <xsl:call-template name="href.target.with.base.dir">
272 <xsl:with-param name="context" select="/"/> <!-- Generate links relative to the location of root file/toc.xml file -->
273 </xsl:call-template>
274 </xsl:variable>
275
276 <xsl:variable name="text">
277 <xsl:value-of select="normalize-space(.)"/>
278 <xsl:if test="following-sibling::*[1][self::see]">
279 <xsl:text> (</xsl:text><xsl:call-template name="gentext">
280 <xsl:with-param name="key" select="'see'"/>
281 </xsl:call-template><xsl:text> </xsl:text>
282 <xsl:value-of select="following-sibling::*[1][self::see]"/>)</xsl:if>
283 </xsl:variable>
284
285 <xsl:choose>
286 <xsl:when test="self::indexterm">
287 <xsl:apply-templates select="primary" mode="idx"/>
288 </xsl:when>
289 <xsl:when test="self::primary">
290 <entry keyword="{$text}">
291 <topic href="{$href}"/>
292 <xsl:apply-templates select="following-sibling::secondary" mode="idx"/>
293 </entry>
294 </xsl:when>
295 <xsl:otherwise>
296 <entry keyword="{$text}">
297 <topic href="{$href}"/>
298 <xsl:apply-templates select="following-sibling::tertiary" mode="idx"/>
299 </entry>
300 </xsl:otherwise>
301 </xsl:choose>
302 </xsl:template>
303
304 <!-- ==================================================================== -->
305
306</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.