1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
2 | <!-- This file is part of the DITA Open Toolkit project hosted on
|
---|
3 | Sourceforge.net. See the accompanying license.txt file for
|
---|
4 | applicable licenses.-->
|
---|
5 | <!-- (c) Copyright IBM Corp. 2006 All Rights Reserved. -->
|
---|
6 |
|
---|
7 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
---|
8 |
|
---|
9 | <xsl:import href="plugin:org.dita.base:xsl/common/output-message.xsl"/>
|
---|
10 |
|
---|
11 | <xsl:param name="version">0.0.0</xsl:param>
|
---|
12 | <xsl:param name="provider">DITA</xsl:param>
|
---|
13 | <xsl:param name="TOCROOT">toc</xsl:param>
|
---|
14 | <xsl:param name="osgi.symbolic.name" select="''"/>
|
---|
15 |
|
---|
16 | <xsl:param name="fragment.country" select="''"/>
|
---|
17 | <xsl:param name="fragment.lang" select="''"/>
|
---|
18 | <xsl:param name="dita.plugin.output" />
|
---|
19 | <xsl:param name="plugin"/>
|
---|
20 |
|
---|
21 | <xsl:variable name="newline">
|
---|
22 | <xsl:text> </xsl:text></xsl:variable>
|
---|
23 |
|
---|
24 |
|
---|
25 | <!-- Define the error message prefix identifier -->
|
---|
26 | <xsl:variable name="msgprefix">DOTX</xsl:variable>
|
---|
27 |
|
---|
28 | <xsl:template match="/">
|
---|
29 | <xsl:call-template name="eclipse.plugin.init"/>
|
---|
30 | </xsl:template>
|
---|
31 |
|
---|
32 | <xsl:template name="eclipse.plugin.init">
|
---|
33 | <xsl:if test="$dita.plugin.output !=''">
|
---|
34 | <xsl:choose>
|
---|
35 | <xsl:when test="$dita.plugin.output ='dita.eclipse.fragment'">
|
---|
36 | <xsl:apply-templates mode="eclipse.fragment"/>
|
---|
37 | </xsl:when>
|
---|
38 | <xsl:when test="$dita.plugin.output ='dita.eclipse.properties'">
|
---|
39 | <xsl:apply-templates mode="eclipse.properties"/>
|
---|
40 | </xsl:when>
|
---|
41 | <xsl:when test="$dita.plugin.output ='dita.eclipse.manifest'">
|
---|
42 | <xsl:apply-templates mode="eclipse.manifest"/>
|
---|
43 | </xsl:when>
|
---|
44 | <xsl:when test="$dita.plugin.output ='dita.eclipse.plugin'">
|
---|
45 | <xsl:apply-templates mode="eclipse.plugin"/>
|
---|
46 | </xsl:when>
|
---|
47 | <!-- XSLT 2.0 param value used to generate all eclipse plugin related files.-->
|
---|
48 | <xsl:when test="$dita.plugin.output ='dita.eclipse.all'">
|
---|
49 |
|
---|
50 | </xsl:when>
|
---|
51 | <!-- Produce the content for the plugin.xml file -->
|
---|
52 | <xsl:otherwise>
|
---|
53 | <xsl:apply-templates />
|
---|
54 | </xsl:otherwise>
|
---|
55 | </xsl:choose>
|
---|
56 | </xsl:if>
|
---|
57 |
|
---|
58 | <xsl:if test="$dita.plugin.output =''">
|
---|
59 | <xsl:apply-templates />
|
---|
60 | </xsl:if>
|
---|
61 |
|
---|
62 | </xsl:template>
|
---|
63 |
|
---|
64 | <!-- Depracated Template: Use the template with mode="eclipse.plugin" instead -->
|
---|
65 | <xsl:template match="*[contains(@class, ' map/map ')]">
|
---|
66 | <xsl:element name="plugin">
|
---|
67 | <xsl:attribute name="name">
|
---|
68 | <xsl:choose>
|
---|
69 | <xsl:when test="*[contains(@class, ' topic/title ')]">
|
---|
70 | <xsl:apply-templates select="*[contains(@class,' topic/title ')]" mode="text-only"/>
|
---|
71 | </xsl:when>
|
---|
72 | <xsl:when test="@title">
|
---|
73 | <xsl:value-of select="@title"/>
|
---|
74 | </xsl:when>
|
---|
75 | <xsl:otherwise>
|
---|
76 | <xsl:text>Sample Title</xsl:text>
|
---|
77 | </xsl:otherwise>
|
---|
78 | </xsl:choose>
|
---|
79 | </xsl:attribute>
|
---|
80 | <xsl:attribute name="id">
|
---|
81 | <xsl:choose>
|
---|
82 | <xsl:when test="@id">
|
---|
83 | <xsl:value-of select="@id"/>
|
---|
84 | </xsl:when>
|
---|
85 | <xsl:otherwise>
|
---|
86 | <xsl:text>org.sample.help.doc</xsl:text>
|
---|
87 | <xsl:call-template name="output-message">
|
---|
88 | <xsl:with-param name="msgnum">050</xsl:with-param>
|
---|
89 | <xsl:with-param name="msgsev">W</xsl:with-param>
|
---|
90 | </xsl:call-template>
|
---|
91 | </xsl:otherwise>
|
---|
92 | </xsl:choose>
|
---|
93 | </xsl:attribute>
|
---|
94 | <xsl:attribute name="version">
|
---|
95 | <xsl:value-of select="$version"/>
|
---|
96 | </xsl:attribute>
|
---|
97 | <xsl:attribute name="provider-name">
|
---|
98 | <xsl:value-of select="$provider"/>
|
---|
99 | </xsl:attribute>
|
---|
100 | <xsl:element name="extension">
|
---|
101 | <xsl:attribute name="point">
|
---|
102 | <xsl:text>org.eclipse.help.toc</xsl:text>
|
---|
103 | </xsl:attribute>
|
---|
104 | <xsl:element name="toc">
|
---|
105 | <xsl:attribute name="file">
|
---|
106 | <xsl:value-of select="$TOCROOT"/>
|
---|
107 | <xsl:text>.xml</xsl:text>
|
---|
108 | </xsl:attribute>
|
---|
109 | <xsl:attribute name="primary">
|
---|
110 | <xsl:text>true</xsl:text>
|
---|
111 | </xsl:attribute>
|
---|
112 | </xsl:element>
|
---|
113 | </xsl:element>
|
---|
114 | <xsl:element name="extension">
|
---|
115 | <xsl:attribute name="point">
|
---|
116 | <xsl:text>org.eclipse.help.index</xsl:text>
|
---|
117 | </xsl:attribute>
|
---|
118 | <xsl:element name="index">
|
---|
119 | <xsl:attribute name="file">
|
---|
120 | <xsl:text>index.xml</xsl:text>
|
---|
121 | </xsl:attribute>
|
---|
122 | </xsl:element>
|
---|
123 | </xsl:element>
|
---|
124 | </xsl:element>
|
---|
125 | </xsl:template>
|
---|
126 |
|
---|
127 | <!-- The elipse.plugin mode teamplate is used to create a plugin.xml file. -->
|
---|
128 | <xsl:template match="*[contains(@class, ' map/map ')]" mode="eclipse.plugin">
|
---|
129 | <xsl:element name="plugin">
|
---|
130 | <!-- <xsl:attribute name="name">
|
---|
131 | <xsl:choose>
|
---|
132 | <xsl:when test="*[contains(@class, ' topic/title ')]">
|
---|
133 | <xsl:value-of select="*[contains(@class, ' topic/title ')]"/>
|
---|
134 | </xsl:when>
|
---|
135 | <xsl:when test="@title">
|
---|
136 | <xsl:value-of select="@title"/>
|
---|
137 | </xsl:when>
|
---|
138 | <xsl:otherwise>
|
---|
139 | <xsl:text>Sample Title</xsl:text>
|
---|
140 | </xsl:otherwise>
|
---|
141 | </xsl:choose>
|
---|
142 | </xsl:attribute>
|
---|
143 | <xsl:attribute name="id">
|
---|
144 | <xsl:choose>
|
---|
145 | <xsl:when test="@id">
|
---|
146 | <xsl:value-of select="@id"/>
|
---|
147 | </xsl:when>
|
---|
148 | <xsl:otherwise>
|
---|
149 | <xsl:text>org.sample.help.doc</xsl:text>
|
---|
150 | <xsl:call-template name="output-message">
|
---|
151 | <xsl:with-param name="msgnum">050</xsl:with-param>
|
---|
152 | <xsl:with-param name="msgsev">W</xsl:with-param>
|
---|
153 | </xsl:call-template>
|
---|
154 | </xsl:otherwise>
|
---|
155 | </xsl:choose>
|
---|
156 | </xsl:attribute>
|
---|
157 | <xsl:attribute name="version">
|
---|
158 | <xsl:value-of select="$version"/>
|
---|
159 | </xsl:attribute>
|
---|
160 | <xsl:attribute name="provider-name">
|
---|
161 | <xsl:value-of select="$provider"/>
|
---|
162 | </xsl:attribute>-->
|
---|
163 | <xsl:element name="extension">
|
---|
164 | <xsl:attribute name="point">
|
---|
165 | <xsl:text>org.eclipse.help.toc</xsl:text>
|
---|
166 | </xsl:attribute>
|
---|
167 | <xsl:element name="toc">
|
---|
168 | <xsl:attribute name="file">
|
---|
169 | <xsl:value-of select="$TOCROOT"/>
|
---|
170 | <xsl:text>.xml</xsl:text>
|
---|
171 | </xsl:attribute>
|
---|
172 | <xsl:attribute name="primary">
|
---|
173 | <xsl:text>true</xsl:text>
|
---|
174 | </xsl:attribute>
|
---|
175 | </xsl:element>
|
---|
176 | </xsl:element>
|
---|
177 | <xsl:element name="extension">
|
---|
178 | <xsl:attribute name="point">
|
---|
179 | <xsl:text>org.eclipse.help.index</xsl:text>
|
---|
180 | </xsl:attribute>
|
---|
181 | <xsl:element name="index">
|
---|
182 | <xsl:attribute name="file">
|
---|
183 | <xsl:text>index.xml</xsl:text>
|
---|
184 | </xsl:attribute>
|
---|
185 | </xsl:element>
|
---|
186 | </xsl:element>
|
---|
187 | </xsl:element>
|
---|
188 | </xsl:template>
|
---|
189 |
|
---|
190 | <xsl:template match="*[contains(@class, ' map/map ')]" mode="eclipse.fragment">
|
---|
191 | <xsl:element name="fragment">
|
---|
192 | <xsl:choose>
|
---|
193 | <xsl:when test="@title"><xsl:attribute name="name">%name</xsl:attribute>
|
---|
194 | </xsl:when>
|
---|
195 | <xsl:when test="*[contains(@class, ' topic/title ')]">
|
---|
196 | <xsl:apply-templates select="*[contains(@class,' topic/title ')]" mode="text-only"/>
|
---|
197 | </xsl:when>
|
---|
198 | <xsl:otherwise><xsl:attribute name="name">Sample Title</xsl:attribute>
|
---|
199 | </xsl:otherwise>
|
---|
200 | </xsl:choose>
|
---|
201 | <xsl:choose>
|
---|
202 | <xsl:when test="$osgi.symbolic.name!=''">
|
---|
203 | <xsl:attribute name="plugin-id"><xsl:value-of select="$osgi.symbolic.name"/></xsl:attribute>
|
---|
204 | <xsl:if test="$fragment.lang!=''">
|
---|
205 | <xsl:choose>
|
---|
206 | <xsl:when test="$fragment.country!=''">
|
---|
207 | <xsl:attribute name="id"><xsl:value-of select="$osgi.symbolic.name"/>.<xsl:value-of select="$fragment.lang"/>.<xsl:value-of select="$fragment.country"/></xsl:attribute>
|
---|
208 | </xsl:when>
|
---|
209 | <xsl:otherwise>
|
---|
210 | <xsl:attribute name="id"><xsl:value-of select="$osgi.symbolic.name"/>.<xsl:value-of select="$fragment.lang"/></xsl:attribute>
|
---|
211 | </xsl:otherwise>
|
---|
212 | </xsl:choose>
|
---|
213 | </xsl:if>
|
---|
214 |
|
---|
215 | </xsl:when>
|
---|
216 | <xsl:when test="@id">
|
---|
217 | <xsl:attribute name="plugin-id"><xsl:value-of select="@id"/></xsl:attribute>
|
---|
218 | <xsl:if test="$fragment.lang!=''">
|
---|
219 | <xsl:choose>
|
---|
220 | <xsl:when test="$fragment.country!=''">
|
---|
221 | <xsl:attribute name="id"><xsl:value-of select="@id"/>.<xsl:value-of select="$fragment.lang"/>.<xsl:value-of select="$fragment.country"/></xsl:attribute>
|
---|
222 | </xsl:when>
|
---|
223 | <xsl:otherwise>
|
---|
224 | <xsl:attribute name="id"><xsl:value-of select="@id"/>.<xsl:value-of select="$fragment.lang"/></xsl:attribute>
|
---|
225 | </xsl:otherwise>
|
---|
226 | </xsl:choose>
|
---|
227 | </xsl:if>
|
---|
228 | </xsl:when>
|
---|
229 | <xsl:otherwise>
|
---|
230 | <xsl:attribute name="plugin-id">org.sample.help.doc</xsl:attribute>
|
---|
231 | <xsl:attribute name="id">org.sample.help.doc.sample.lang</xsl:attribute>
|
---|
232 | <xsl:call-template name="output-message">
|
---|
233 | <xsl:with-param name="msgnum">050</xsl:with-param>
|
---|
234 | <xsl:with-param name="msgsev">W</xsl:with-param>
|
---|
235 | </xsl:call-template>
|
---|
236 | </xsl:otherwise>
|
---|
237 | </xsl:choose>
|
---|
238 |
|
---|
239 | <xsl:attribute name="plugin-version">
|
---|
240 | <xsl:value-of select="$version"/>
|
---|
241 | </xsl:attribute>
|
---|
242 | <xsl:attribute name="version">
|
---|
243 | <xsl:value-of select="$version"/>
|
---|
244 | </xsl:attribute>
|
---|
245 |
|
---|
246 | <xsl:attribute name="provider-name">
|
---|
247 | <!-- <xsl:value-of select="$provider"/> -->
|
---|
248 | <xsl:text>%providerName</xsl:text>
|
---|
249 | </xsl:attribute>
|
---|
250 | <!-- <xsl:apply-templates/> -->
|
---|
251 | </xsl:element>
|
---|
252 | </xsl:template>
|
---|
253 |
|
---|
254 |
|
---|
255 | <xsl:template match="*[contains(@class, ' map/map ')]" mode="eclipse.properties">
|
---|
256 |
|
---|
257 | <xsl:text># NLS_MESSAGEFORMAT_NONE</xsl:text><xsl:value-of select="$newline"/>
|
---|
258 | <xsl:text># NLS_ENCODING=UTF-8</xsl:text><xsl:value-of select="$newline"/>
|
---|
259 | <!--<xsl:value-of select="$newline"/>-->
|
---|
260 | <xsl:choose>
|
---|
261 | <xsl:when test="@title">
|
---|
262 | <xsl:text>name=</xsl:text><xsl:value-of select="@title"/>
|
---|
263 | </xsl:when>
|
---|
264 | <xsl:when test="*[contains(@class, ' topic/title ')]">
|
---|
265 | <xsl:text>name=</xsl:text><xsl:apply-templates select="*[contains(@class,' topic/title ')]" mode="text-only"/>
|
---|
266 | </xsl:when>
|
---|
267 | <xsl:otherwise>
|
---|
268 | <xsl:text>name=Sample Title</xsl:text>
|
---|
269 | </xsl:otherwise>
|
---|
270 | </xsl:choose>
|
---|
271 | <xsl:value-of select="$newline"/>
|
---|
272 | <xsl:text>providerName=</xsl:text><xsl:value-of select="$provider"/>
|
---|
273 | </xsl:template>
|
---|
274 |
|
---|
275 | <xsl:template match="*[contains(@class, ' map/map ')]" mode="eclipse.manifest">
|
---|
276 |
|
---|
277 | <xsl:text>Bundle-Version: </xsl:text><xsl:value-of select="$version"/><xsl:value-of select="$newline"/>
|
---|
278 | <xsl:text>Manifest-Version: 1.0</xsl:text><xsl:value-of select="$newline"/>
|
---|
279 | <xsl:text>Bundle-ManifestVersion: 2</xsl:text><xsl:value-of select="$newline"/>
|
---|
280 | <xsl:text>Bundle-Localization: plugin</xsl:text><xsl:value-of select="$newline"/>
|
---|
281 | <xsl:text>Bundle-Name: %name</xsl:text><xsl:value-of select="$newline"/>
|
---|
282 | <xsl:text>Bundle-Vendor: %providerName</xsl:text><xsl:value-of select="$newline"/>
|
---|
283 |
|
---|
284 | <xsl:choose>
|
---|
285 | <xsl:when test="$plugin='true'">
|
---|
286 | <xsl:text>Eclipse-LazyStart: true</xsl:text><xsl:value-of select="$newline"/>
|
---|
287 | <xsl:choose>
|
---|
288 | <xsl:when test="$osgi.symbolic.name!=''">
|
---|
289 | <xsl:text>Bundle-SymbolicName: </xsl:text><xsl:value-of select="$osgi.symbolic.name"/>;<xsl:text> singleton:=true</xsl:text><xsl:value-of select="$newline"/>
|
---|
290 | </xsl:when>
|
---|
291 | <xsl:when test="@id">
|
---|
292 | <xsl:text>Bundle-SymbolicName: </xsl:text><xsl:value-of select="@id"/>;<xsl:text> singleton:=true</xsl:text><xsl:value-of select="$newline"/>
|
---|
293 | </xsl:when>
|
---|
294 | <xsl:otherwise>
|
---|
295 | <xsl:text>Bundle-SymbolicName: org.sample.help.doc; singleton:=true</xsl:text><xsl:value-of select="$newline"/>
|
---|
296 | <xsl:call-template name="output-message">
|
---|
297 | <xsl:with-param name="msgnum">050</xsl:with-param>
|
---|
298 | <xsl:with-param name="msgsev">W</xsl:with-param>
|
---|
299 | </xsl:call-template>
|
---|
300 | </xsl:otherwise>
|
---|
301 | </xsl:choose>
|
---|
302 | </xsl:when>
|
---|
303 | <xsl:otherwise>
|
---|
304 | <xsl:choose>
|
---|
305 | <xsl:when test="@id">
|
---|
306 | <xsl:if test="$fragment.lang!=''">
|
---|
307 | <xsl:text>Fragment-Host: </xsl:text><xsl:value-of select="@id"/>;
|
---|
308 | <xsl:text>Bundle-SymbolicName: </xsl:text>
|
---|
309 | <xsl:choose>
|
---|
310 | <xsl:when test="$fragment.country!=''">
|
---|
311 | <xsl:value-of select="@id"/>.<xsl:value-of select="$fragment.lang"/>.<xsl:value-of select="$fragment.country"/>;<xsl:text/>
|
---|
312 | </xsl:when>
|
---|
313 | <xsl:otherwise>
|
---|
314 | <xsl:value-of select="@id"/>.<xsl:value-of select="$fragment.lang"/>;<xsl:text/>
|
---|
315 | </xsl:otherwise>
|
---|
316 | </xsl:choose>
|
---|
317 | </xsl:if>
|
---|
318 | <xsl:if test="$fragment.lang=''">
|
---|
319 | <xsl:text>Bundle-SymbolicName: </xsl:text><xsl:value-of select="@id"/><xsl:value-of select="$newline"/>
|
---|
320 | </xsl:if>
|
---|
321 | </xsl:when>
|
---|
322 | <xsl:otherwise>
|
---|
323 |
|
---|
324 | <xsl:text>Bundle-SymbolicName: org.sample.help.doc.</xsl:text>
|
---|
325 | <xsl:choose>
|
---|
326 | <xsl:when test="$fragment.lang!=''">
|
---|
327 | <xsl:choose>
|
---|
328 | <xsl:when test="$fragment.country!=''">
|
---|
329 | <xsl:value-of select="$fragment.lang"/>.<xsl:value-of select="$fragment.country"/>;
|
---|
330 | </xsl:when>
|
---|
331 | <xsl:otherwise>
|
---|
332 | <xsl:value-of select="$fragment.lang"/>;
|
---|
333 | </xsl:otherwise>
|
---|
334 | </xsl:choose>
|
---|
335 | </xsl:when>
|
---|
336 | <!-- We shouldn' t be getting here, but just in case -->
|
---|
337 | <xsl:otherwise>
|
---|
338 | <xsl:text>lang; </xsl:text>
|
---|
339 | </xsl:otherwise>
|
---|
340 | </xsl:choose>
|
---|
341 | <xsl:value-of select="$newline"/>
|
---|
342 | <xsl:text>Fragment-Host: org.sample.help.doc;</xsl:text><xsl:value-of select="$newline"/>
|
---|
343 | <xsl:call-template name="output-message">
|
---|
344 | <xsl:with-param name="msgnum">050</xsl:with-param>
|
---|
345 | <xsl:with-param name="msgsev">W</xsl:with-param>
|
---|
346 | </xsl:call-template>
|
---|
347 | </xsl:otherwise>
|
---|
348 | </xsl:choose>
|
---|
349 | </xsl:otherwise>
|
---|
350 | </xsl:choose>
|
---|
351 | </xsl:template>
|
---|
352 | </xsl:stylesheet>
|
---|