Subversion Repositories general

Rev

Rev 240 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
240 swalkenh 1
PK
260 swalkenh 2
 
3
 
240 swalkenh 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
260 swalkenh 12
 ransformBack.xsl
240 swalkenh 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
260 swalkenh 26
 
240 swalkenh 27
 
28
 
29
SourceFileRegionEditorPlugin.java!/*·	±
30
 
31
 
32
 
33
 
260 swalkenh 34
 
35
* ss_2003
36
* group project: XML-Editor
37
* $Id: RegionEditorPlugin.java,v 1.1 2003/07/07 09:44:33 swalkenh Exp $
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
 
240 swalkenh 53
]ç.r}‚ÈÈ>src/plugins/regionEditorPlugin/RegionEditorPluginTransform.xsl<!-- status: first working for regioneditor -->
260 swalkenh 54
 
55
<xsl:output method="xml" indent="yes" />
56
57
 
58
<xsl:param name="input">/</xsl:param><!-- eg. /XMLEDITORCONFIGURATION/DEFAULTPLUGIN -->
59
<xsl:param name="elementnamenew">standardplugin</xsl:param>
60
61
 
62
	<xsl:variable name="levelremaining" select="substring-after($input, '/')" />
63
64
 
65
	<xsl:message><xsl:value-of select="concat('outside-parameter elementnamenew: ', $elementnamenew)"/></xsl:message>
66
67
 
68
		<xsl:call-template name="selecter">
69
			<xsl:with-param name="levelremaining" select="$levelremaining" />
70
		</xsl:call-template>
71
	</xsl:for-each>
72
</xsl:template>
73
74
 
75
	<xsl:param name="levelremaining" />
76
	<xsl:variable name="level" select="substring-before( concat($levelremaining, '/'), '/')" />
77
	<xsl:variable name="nextlevels" select="substring-after($levelremaining, '/')" />
78
	
79
 
80
	     then work on childs with the selecter -->
81
	<xsl:if test = "(name() = $level)">
82
		<xsl:message>selecter-case: belongs to right path</xsl:message>
83
		<xsl:element name="name()">
84
		
85
 
86
			     then convert the node -->
87
			<xsl:if test = "( ('' = $nextlevels) 
88
		    	              and not('' = name()) )"><!-- avoid too many tags from matcher -->
89
				<xsl:message>selecter-case: last level</xsl:message>
90
				<xsl:apply-templates select="self::node()">
91
				</xsl:apply-templates>
92
			</xsl:if>
93
			<!-- else (if there are levels left) work on childs -->
94
			<xsl:if test = "not('' = $nextlevels)">
95
				<xsl:message>selecter-case: levels left</xsl:message>
96
				<xsl:copy>
97
					<xsl:for-each select="attribute::*">
98
						<xsl:attribute name="{name(.)}">
99
							<xsl:value-of select="self::node()" />
100
						</xsl:attribute>
101
					</xsl:for-each>
102
					<xsl:for-each select="node()">
103
						<xsl:call-template name="selecter">
104
							<xsl:with-param name="levelremaining" select="$nextlevels" />
105
						</xsl:call-template>
106
					</xsl:for-each>
107
				</xsl:copy>
108
			</xsl:if>
109
		</xsl:element>
110
	</xsl:if>
111
	<!-- else simply copy the node with childs -->
112
	<xsl:if test = "not(name() = $level)">
113
		<xsl:message>selecter-case: must only be copied and never touched in future</xsl:message>
114
		<xsl:copy-of select="self::node()" />
115
	</xsl:if>
116
</xsl:template>
117
118
 
119
	<xsl:element name="REGIONSET">
120
121
 
122
		<xsl:attribute name="image">
123
			<xsl:value-of select="@Bild" />
124
		</xsl:attribute>
125
		<xsl:for-each select="attribute::*">
126
			<xsl:if test = "not(name(.) = ('Bild'))">
127
				<xsl:attribute name="{name(.)}">
128
					<xsl:value-of select="self::node()" />
129
				</xsl:attribute>
130
			</xsl:if>
131
		</xsl:for-each>
132
133
 
134
		<xsl:for-each select="Bereich">
135
			<xsl:element name="RECT">
136
				<xsl:attribute name="x">
137
					<xsl:value-of select="@x" />
138
				</xsl:attribute>
139
				<xsl:attribute name="y">
140
					<xsl:value-of select="@y" />
141
				</xsl:attribute>
142
				<xsl:attribute name="b">
143
					<xsl:value-of select="@Breite" />
144
				</xsl:attribute>
145
				<xsl:attribute name="h">
146
					<xsl:value-of select="@Hoehe" />
147
				</xsl:attribute>
148
				<xsl:for-each select="attribute::*">
149
					<xsl:if test = "not(name(.) = 'x')">
150
					<xsl:if test = "not(name(.) = 'y')">
151
					<xsl:if test = "not(name(.) = 'Breite')">
152
					<xsl:if test = "not(name(.) = 'Hoehe')">
153
						<xsl:attribute name="{name(.)}">
154
							<xsl:value-of select="self::node()" />
155
						</xsl:attribute>
156
					</xsl:if></xsl:if></xsl:if></xsl:if>
157
				</xsl:for-each>
158
				<xsl:for-each select="node()">
159
					<xsl:copy-of select="self::node()" />
160
				</xsl:for-each>
161
			</xsl:element>
162
		</xsl:for-each>
163
		<xsl:for-each select="node()">
164
			<xsl:if test = "not(name(.) = 'Bereich')">
165
				<xsl:copy-of select="self::node()" />
166
			</xsl:if>
167
		</xsl:for-each>
168
169
 
170
</xsl:template>
171
172
 
173
	<xsl:copy-of select="." />
174
</xsl:template>
175
176
 
240 swalkenh 177
]ç.ÕÚq{¹¹Bsrc/plugins/regionEditorPlugin/RegionEditorPluginTransformBack.xsl<!-- status: first try for regioneditor -->
260 swalkenh 178
 
179
<xsl:output method="xml" indent="yes" />
180
181
 
182
<xsl:param name="input">/</xsl:param><!-- eg. /XMLEDITORCONFIGURATION/DEFAULTPLUGIN -->
183
<xsl:param name="elementnamenew">standardplugin</xsl:param>
184
185
 
186
	<xsl:variable name="levelremaining" select="substring-after($input, '/')" />
187
188
 
189
	<xsl:message><xsl:value-of select="concat('outside-parameter elementnamenew: ', $elementnamenew)"/></xsl:message>
190
191
 
192
		<xsl:call-template name="selecter">
193
			<xsl:with-param name="levelremaining" select="$levelremaining" />
194
		</xsl:call-template>
195
	</xsl:for-each>
196
</xsl:template>
197
198
 
199
	<xsl:param name="levelremaining" />
200
	<xsl:variable name="level" select="substring-before( concat($levelremaining, '/'), '/')" />
201
	<xsl:variable name="nextlevels" select="substring-after($levelremaining, '/')" />
202
	
203
 
204
	     then work on childs with the selecter -->
205
	<xsl:if test = "(name() = $level)">
206
		<xsl:message>selecter-case: belongs to right path</xsl:message>
207
		<xsl:element name="name()">
208
		
209
 
210
			     then convert the node -->
211
			<xsl:if test = "( ('' = $nextlevels) 
212
		    	              and not('' = name()) )"><!-- avoid too many tags from matcher -->
213
				<xsl:message>selecter-case: last level</xsl:message>
214
				<xsl:apply-templates select="self::node()">
215
				</xsl:apply-templates>
216
			</xsl:if>
217
			<!-- else (if there are levels left) work on childs -->
218
			<xsl:if test = "not('' = $nextlevels)">
219
				<xsl:message>selecter-case: levels left</xsl:message>
220
				<xsl:copy>
221
					<xsl:for-each select="attribute::*">
222
						<xsl:attribute name="{name(.)}">
223
							<xsl:value-of select="self::node()" />
224
						</xsl:attribute>
225
					</xsl:for-each>
226
					<xsl:for-each select="node()">
227
						<xsl:call-template name="selecter">
228
							<xsl:with-param name="levelremaining" select="$nextlevels" />
229
						</xsl:call-template>
230
					</xsl:for-each>
231
				</xsl:copy>
232
			</xsl:if>
233
		</xsl:element>
234
	</xsl:if>
235
	<!-- else simply copy the node with childs -->
236
	<xsl:if test = "not(name() = $level)">
237
		<xsl:message>selecter-case: must only be copied and never touched in future</xsl:message>
238
		<xsl:copy-of select="self::node()" />
239
	</xsl:if>
240
</xsl:template>
241
242
 
243
	<xsl:element name="Regionensatz">
244
245
 
246
		<xsl:attribute name="Bild">
247
			<xsl:value-of select="@image" />
248
		</xsl:attribute>
249
		<xsl:for-each select="attribute::*">
250
			<xsl:if test = "not(name(.) = ('image'))">
251
				<xsl:attribute name="{name(.)}">
252
					<xsl:value-of select="self::node()" />
253
				</xsl:attribute>
254
			</xsl:if>
255
		</xsl:for-each>
256
257
 
258
		<xsl:for-each select="RECT">
259
			<xsl:element name="Bereich">
260
				<xsl:attribute name="x">
261
					<xsl:value-of select="@x" />
262
				</xsl:attribute>
263
				<xsl:attribute name="y">
264
					<xsl:value-of select="@y" />
265
				</xsl:attribute>
266
				<xsl:attribute name="Breite">
267
					<xsl:value-of select="@b" />
268
				</xsl:attribute>
269
				<xsl:attribute name="Hoehe">
270
					<xsl:value-of select="@h" />
271
				</xsl:attribute>
272
				<xsl:for-each select="attribute::*">
273
					<xsl:if test = "not(name(.) = 'x')">
274
					<xsl:if test = "not(name(.) = 'y')">
275
					<xsl:if test = "not(name(.) = 'b')">
276
					<xsl:if test = "not(name(.) = 'h')">
277
						<xsl:attribute name="{name(.)}">
278
							<xsl:value-of select="self::node()" />
279
						</xsl:attribute>
280
					</xsl:if></xsl:if></xsl:if></xsl:if>
281
				</xsl:for-each>
282
				<xsl:for-each select="node()">
283
					<xsl:copy-of select="self::node()" />
284
				</xsl:for-each>
285
			</xsl:element>
286
		</xsl:for-each>
287
		<xsl:for-each select="node()">
288
			<xsl:if test = "not(name(.) = 'RECT')">
289
				<xsl:copy-of select="self::node()" />
290
			</xsl:if>
291
		</xsl:for-each>
292
293
 
294
</xsl:template>
295
296
 
297
	<xsl:copy-of select="." />
298
</xsl:template>
299
300
 
240 swalkenh 301
302
 
260 swalkenh 303
 
240 swalkenh 304
 
260 swalkenh 305
 
240 swalkenh 306
 
260 swalkenh 307
 
240 swalkenh 308
 
260 swalkenh 309
 
240 swalkenh 310
 
260 swalkenh 311
 
240 swalkenh 312