Subversion Repositories general

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
240 swalkenh 1
PK
2
 
3
 
4
Comment: you can set named regions on pictures
5
Transform-To-File: src/plugins/regionEditorPlugin/RegionEditorPluginTr
6
 ansform.xsl
7
Created-By: 1.4.0 (Sun Microsystems Inc.)
8
Description: ...(todo)
9
XMLEditor-Plugin-Name: RegionEditor
10
Class-Path: ImagePlugin.jar
11
Transform-Fro-File: src/plugins/regionEditorPlugin/RegionEditorPluginT
12
 ransformBack.xsl 
13
Main-Class: src.plugins.regionEditorPlugin.RegionEditorPlugin
14
 
15
Name: src/plugins/regionEditorPlugin
16
Specification-Version: 0.4 (05/07/03)
17
Specification-Title: plugin for XMLEditor
18
Implementation-Version: 0.1 (05/07/03)
19
Implementation-Title: src.plugins.regionEditorPlugin
20
Implementation-Vendor: group5, software practice SS_2003, University B
21
 ielefeld, Germany
22
Specification-Vendor: group5, software practice SS_2003, University Bi
23
 elefeld, Germany
24
 
25
PK
26
 
27
 
28
 
29
SourceFileRegionEditorPlugin.java!/*·	±
30
 
31
 
32
 
33
 
34
 
35
* ss_2003
36
* group project: XML-Editor
37
* $Id:  $
38
*/
39
40
 
41
42
 
43
 
44
 * dummy plugin used for testing
45
 */
46
public class RegionEditorPlugin {
47
	
48
 
49
		System.out.println("This is the main method of a dummy RegionEditor plugin");
50
	}
51
52
 
53
ò<ç. 1>þþAsrc/plugins/regionEditorPlugin/RegionEditorPluginManifestAdditionXMLEditor-Plugin-Name: RegionEditor
54
 
55
Description: ...(todo)
56
Main-Class: src.plugins.regionEditorPlugin.RegionEditorPlugin
57
Class-Path: ImagePlugin.jar
58
Transform-To-File: src/plugins/regionEditorPlugin/RegionEditorPluginTransform.xsl
59
Transform-Fro-File: src/plugins/regionEditorPlugin/RegionEditorPluginTransformBack.xsl 
60
61
 
62
Specification-Title: plugin for XMLEditor
63
Specification-Version: 0.4 (05/07/03)
64
Specification-Vendor: group5, software practice SS_2003, University Bielefeld, Germany
65
Implementation-Title: src.plugins.regionEditorPlugin
66
Implementation-Version: 0.1 (05/07/03)
67
Implementation-Vendor: group5, software practice SS_2003, University Bielefeld, Germany
68
PK
69
Ê–å.IAECC>src/plugins/regionEditorPlugin/RegionEditorPluginTransform.xsl<!-- status: first working for regioneditor -->
70
 
71
<xsl:output method="xml" indent="yes" />
72
73
 
74
<xsl:param name="input">/</xsl:param><!-- eg. /XMLEDITORCONFIGURATION/DEFAULTPLUGIN -->
75
<xsl:param name="elementnamenew">standardplugin</xsl:param>
76
77
 
78
	<xsl:variable name="levelremaining" select="substring-after($input, '/')" />
79
80
 
81
	<xsl:message><xsl:value-of select="concat('outside-parameter elementnamenew: ', $elementnamenew)"/></xsl:message>
82
83
 
84
		<xsl:call-template name="selecter">
85
			<xsl:with-param name="levelremaining" select="$levelremaining" />
86
		</xsl:call-template>
87
	</xsl:for-each>
88
</xsl:template>
89
90
 
91
	<xsl:param name="levelremaining" />
92
	<xsl:variable name="level" select="substring-before( concat($levelremaining, '/'), '/')" />
93
	<xsl:variable name="nextlevels" select="substring-after($levelremaining, '/')" />
94
	
95
 
96
	     then work on childs with the selecter -->
97
	<xsl:if test = "(name() = $level)">
98
		<xsl:message>selecter-case: belongs to right path</xsl:message>
99
		<xsl:element name="name()">
100
		
101
 
102
			     then convert the node -->
103
			<xsl:if test = "( ('' = $nextlevels) 
104
		    	              and not('' = name()) )"><!-- avoid too many tags from matcher -->
105
				<xsl:message>selecter-case: last level</xsl:message>
106
				<xsl:apply-templates select="self::node()">
107
				</xsl:apply-templates>
108
			</xsl:if>
109
			<!-- else (if there are levels left) work on childs -->
110
			<xsl:if test = "not('' = $nextlevels)">
111
				<xsl:message>selecter-case: levels left</xsl:message>
112
				<xsl:copy>
113
					<xsl:for-each select="attribute::*">
114
						<xsl:attribute name="{name(.)}">
115
							<xsl:value-of select="self::node()" />
116
						</xsl:attribute>
117
					</xsl:for-each>
118
					<xsl:for-each select="node()">
119
						<xsl:call-template name="selecter">
120
							<xsl:with-param name="levelremaining" select="$nextlevels" />
121
						</xsl:call-template>
122
					</xsl:for-each>
123
				</xsl:copy>
124
			</xsl:if>
125
		</xsl:element>
126
	</xsl:if>
127
	<!-- else simply copy the node with childs -->
128
	<xsl:if test = "not(name() = $level)">
129
		<xsl:message>selecter-case: must only be copied and never touched in future</xsl:message>
130
		<xsl:copy-of select="self::node()" />
131
	</xsl:if>
132
</xsl:template>
133
134
 
135
	<xsl:element name="REGIONSET">
136
137
 
138
		<xsl:attribute name="image">
139
			<xsl:value-of select="@Bild" />
140
		</xsl:attribute>
141
		<xsl:for-each select="attribute::*">
142
			<xsl:if test = "not(name(.) = ('Bild'))">
143
				<xsl:attribute name="{name(.)}">
144
					<xsl:value-of select="self::node()" />
145
				</xsl:attribute>
146
			</xsl:if>
147
		</xsl:for-each>
148
149
 
150
		<xsl:for-each select="Bereich">
151
			<xsl:element name="RECT">
152
				<xsl:attribute name="x">
153
					<xsl:value-of select="@x" />
154
				</xsl:attribute>
155
				<xsl:attribute name="y">
156
					<xsl:value-of select="@y" />
157
				</xsl:attribute>
158
				<xsl:attribute name="b">
159
					<xsl:value-of select="@Breite" />
160
				</xsl:attribute>
161
				<xsl:attribute name="h">
162
					<xsl:value-of select="@Hoehe" />
163
				</xsl:attribute>
164
				<xsl:for-each select="attribute::*">
165
					<xsl:if test = "not(name(.) = 'x')">
166
					<xsl:if test = "not(name(.) = 'y')">
167
					<xsl:if test = "not(name(.) = 'Breite')">
168
					<xsl:if test = "not(name(.) = 'Hoehe')">
169
						<xsl:attribute name="{name(.)}">
170
							<xsl:value-of select="self::node()" />
171
						</xsl:attribute>
172
					</xsl:if></xsl:if></xsl:if></xsl:if>
173
				</xsl:for-each>
174
				<xsl:for-each select="node()">
175
					<xsl:copy-of select="self::node()" />
176
				</xsl:for-each>
177
			</xsl:element>
178
		</xsl:for-each>
179
		<xsl:for-each select="node()">
180
			<xsl:if test = "not(name(.) = 'Bereich')">
181
				<xsl:copy-of select="self::node()" />
182
			</xsl:if>
183
		</xsl:for-each>
184
185
 
186
</xsl:template>
187
188
 
189
	<xsl:copy-of select="." />
190
</xsl:template>
191
192
 
193
È<ç.v,xY44Bsrc/plugins/regionEditorPlugin/RegionEditorPluginTransformBack.xsl<!-- status: first try for regioneditor -->
194
 
195
<xsl:output method="xml" indent="yes" />
196
197
 
198
<xsl:param name="input">/</xsl:param><!-- eg. /XMLEDITORCONFIGURATION/DEFAULTPLUGIN -->
199
<xsl:param name="elementnamenew">standardplugin</xsl:param>
200
201
 
202
	<xsl:variable name="levelremaining" select="substring-after($input, '/')" />
203
204
 
205
	<xsl:message><xsl:value-of select="concat('outside-parameter elementnamenew: ', $elementnamenew)"/></xsl:message>
206
207
 
208
		<xsl:call-template name="selecter">
209
			<xsl:with-param name="levelremaining" select="$levelremaining" />
210
		</xsl:call-template>
211
	</xsl:for-each>
212
</xsl:template>
213
214
 
215
	<xsl:param name="levelremaining" />
216
	<xsl:variable name="level" select="substring-before( concat($levelremaining, '/'), '/')" />
217
	<xsl:variable name="nextlevels" select="substring-after($levelremaining, '/')" />
218
	
219
 
220
	     then work on childs with the selecter -->
221
	<xsl:if test = "(name() = $level)">
222
		<xsl:message>selecter-case: belongs to right path</xsl:message>
223
		<xsl:element name="name()">
224
		
225
 
226
			     then convert the node -->
227
			<xsl:if test = "( ('' = $nextlevels) 
228
		    	              and not('' = name()) )"><!-- avoid too many tags from matcher -->
229
				<xsl:message>selecter-case: last level</xsl:message>
230
				<xsl:apply-templates select="self::node()">
231
				</xsl:apply-templates>
232
			</xsl:if>
233
			<!-- else (if there are levels left) work on childs -->
234
			<xsl:if test = "not('' = $nextlevels)">
235
				<xsl:message>selecter-case: levels left</xsl:message>
236
				<xsl:copy>
237
					<xsl:for-each select="attribute::*">
238
						<xsl:attribute name="{name(.)}">
239
							<xsl:value-of select="self::node()" />
240
						</xsl:attribute>
241
					</xsl:for-each>
242
					<xsl:for-each select="node()">
243
						<xsl:call-template name="selecter">
244
							<xsl:with-param name="levelremaining" select="$nextlevels" />
245
						</xsl:call-template>
246
					</xsl:for-each>
247
				</xsl:copy>
248
			</xsl:if>
249
		</xsl:element>
250
	</xsl:if>
251
	<!-- else simply copy the node with childs -->
252
	<xsl:if test = "not(name() = $level)">
253
		<xsl:message>selecter-case: must only be copied and never touched in future</xsl:message>
254
		<xsl:copy-of select="self::node()" />
255
	</xsl:if>
256
</xsl:template>
257
258
 
259
	<xsl:element name="Regionensatz">
260
261
 
262
		<xsl:attribute name="Bild">
263
			<xsl:value-of select="@image" />
264
		</xsl:attribute>
265
		<xsl:for-each select="attribute::*">
266
			<xsl:if test = "not(name(.) = ('image'))">
267
				<xsl:attribute name="{name(.)}">
268
					<xsl:value-of select="self::node()" />
269
				</xsl:attribute>
270
			</xsl:if>
271
		</xsl:for-each>
272
273
 
274
		<xsl:for-each select="RECT">
275
			<xsl:element name="Bereich">
276
				<xsl:attribute name="x">
277
					<xsl:value-of select="@x" />
278
				</xsl:attribute>
279
				<xsl:attribute name="y">
280
					<xsl:value-of select="@y" />
281
				</xsl:attribute>
282
				<xsl:attribute name="Breite">
283
					<xsl:value-of select="@b" />
284
				</xsl:attribute>
285
				<xsl:attribute name="Hoehe">
286
					<xsl:value-of select="@h" />
287
				</xsl:attribute>
288
				<xsl:for-each select="attribute::*">
289
					<xsl:if test = "not(name(.) = 'x')">
290
					<xsl:if test = "not(name(.) = 'y')">
291
					<xsl:if test = "not(name(.) = 'b')">
292
					<xsl:if test = "not(name(.) = 'h')">
293
						<xsl:attribute name="{name(.)}">
294
							<xsl:value-of select="self::node()" />
295
						</xsl:attribute>
296
					</xsl:if></xsl:if></xsl:if></xsl:if>
297
				</xsl:for-each>
298
				<xsl:for-each select="node()">
299
					<xsl:copy-of select="self::node()" />
300
				</xsl:for-each>
301
			</xsl:element>
302
		</xsl:for-each>
303
		<xsl:for-each select="node()">
304
			<xsl:if test = "not(name(.) = 'RECT')">
305
				<xsl:copy-of select="self::node()" />
306
			</xsl:if>
307
		</xsl:for-each>
308
309
 
310
</xsl:template>
311
312
 
313
	<xsl:copy-of select="." />
314
</xsl:template>
315
316
 
317
318
 
319
 
320
 
321
 
322
 
323
 
324
 
325
 
326
 
327
 
328
 
329
 
330