|
1 <?xml version="1.0"?> |
|
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:str="http://exslt.org/strings" xmlns:func="http://exslt.org/functions" xmlns:svg="http://www.w3.org/2000/svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.0" extension-element-prefixes="ns func exsl regexp str dyn" exclude-result-prefixes="ns func exsl regexp str dyn svg inkscape"> |
|
3 <xsl:output method="xml"/> |
|
4 <xsl:variable name="indexed_hmitree" select="/.."/> |
|
5 <xsl:variable name="pathregex" select="'^([^\[,]+)(\[[^\]]+\])?([\d,]*)$'"/> |
|
6 <xsl:template mode="parselabel" match="*"> |
|
7 <xsl:variable name="label" select="@inkscape:label"/> |
|
8 <xsl:variable name="id" select="@id"/> |
|
9 <xsl:variable name="description" select="substring-after($label,'HMI:')"/> |
|
10 <xsl:variable name="_args" select="substring-before($description,'@')"/> |
|
11 <xsl:variable name="args"> |
|
12 <xsl:choose> |
|
13 <xsl:when test="$_args"> |
|
14 <xsl:value-of select="$_args"/> |
|
15 </xsl:when> |
|
16 <xsl:otherwise> |
|
17 <xsl:value-of select="$description"/> |
|
18 </xsl:otherwise> |
|
19 </xsl:choose> |
|
20 </xsl:variable> |
|
21 <xsl:variable name="_type" select="substring-before($args,':')"/> |
|
22 <xsl:variable name="type"> |
|
23 <xsl:choose> |
|
24 <xsl:when test="$_type"> |
|
25 <xsl:value-of select="$_type"/> |
|
26 </xsl:when> |
|
27 <xsl:otherwise> |
|
28 <xsl:value-of select="$args"/> |
|
29 </xsl:otherwise> |
|
30 </xsl:choose> |
|
31 </xsl:variable> |
|
32 <xsl:if test="$type"> |
|
33 <widget> |
|
34 <xsl:attribute name="id"> |
|
35 <xsl:value-of select="$id"/> |
|
36 </xsl:attribute> |
|
37 <xsl:attribute name="type"> |
|
38 <xsl:value-of select="$type"/> |
|
39 </xsl:attribute> |
|
40 <xsl:for-each select="str:split(substring-after($args, ':'), ':')"> |
|
41 <arg> |
|
42 <xsl:attribute name="value"> |
|
43 <xsl:value-of select="."/> |
|
44 </xsl:attribute> |
|
45 </arg> |
|
46 </xsl:for-each> |
|
47 <xsl:variable name="paths" select="substring-after($description,'@')"/> |
|
48 <xsl:for-each select="str:split($paths, '@')"> |
|
49 <xsl:if test="string-length(.) > 0"> |
|
50 <path> |
|
51 <xsl:variable name="path_match" select="regexp:match(.,$pathregex)"/> |
|
52 <xsl:variable name="pathminmax" select="str:split($path_match[4],',')"/> |
|
53 <xsl:variable name="path" select="$path_match[2]"/> |
|
54 <xsl:variable name="path_accepts" select="$path_match[3]"/> |
|
55 <xsl:variable name="pathminmaxcount" select="count($pathminmax)"/> |
|
56 <xsl:attribute name="value"> |
|
57 <xsl:value-of select="$path"/> |
|
58 </xsl:attribute> |
|
59 <xsl:if test="string-length($path_accepts)"> |
|
60 <xsl:attribute name="accepts"> |
|
61 <xsl:value-of select="$path_accepts"/> |
|
62 </xsl:attribute> |
|
63 </xsl:if> |
|
64 <xsl:choose> |
|
65 <xsl:when test="$pathminmaxcount = 2"> |
|
66 <xsl:attribute name="min"> |
|
67 <xsl:value-of select="$pathminmax[1]"/> |
|
68 </xsl:attribute> |
|
69 <xsl:attribute name="max"> |
|
70 <xsl:value-of select="$pathminmax[2]"/> |
|
71 </xsl:attribute> |
|
72 </xsl:when> |
|
73 <xsl:when test="$pathminmaxcount = 1 or $pathminmaxcount > 2"> |
|
74 <xsl:message terminate="yes"> |
|
75 <xsl:text>Widget id:</xsl:text> |
|
76 <xsl:value-of select="$id"/> |
|
77 <xsl:text> label:</xsl:text> |
|
78 <xsl:value-of select="$label"/> |
|
79 <xsl:text> has wrong syntax of path section </xsl:text> |
|
80 <xsl:value-of select="$pathminmax"/> |
|
81 </xsl:message> |
|
82 </xsl:when> |
|
83 </xsl:choose> |
|
84 <xsl:if test="$indexed_hmitree"> |
|
85 <xsl:choose> |
|
86 <xsl:when test="regexp:test($path,'^\.[a-zA-Z0-9_]+$')"> |
|
87 <xsl:attribute name="type"> |
|
88 <xsl:text>PAGE_LOCAL</xsl:text> |
|
89 </xsl:attribute> |
|
90 </xsl:when> |
|
91 <xsl:when test="regexp:test($path,'^[a-zA-Z0-9_]+$')"> |
|
92 <xsl:attribute name="type"> |
|
93 <xsl:text>HMI_LOCAL</xsl:text> |
|
94 </xsl:attribute> |
|
95 </xsl:when> |
|
96 <xsl:otherwise> |
|
97 <xsl:variable name="item" select="$indexed_hmitree/*[@hmipath = $path]"/> |
|
98 <xsl:variable name="pathtype" select="local-name($item)"/> |
|
99 <xsl:if test="$pathminmaxcount = 3 and not($pathtype = 'HMI_INT' or $pathtype = 'HMI_REAL')"> |
|
100 <xsl:message terminate="yes"> |
|
101 <xsl:text>Widget id:</xsl:text> |
|
102 <xsl:value-of select="$id"/> |
|
103 <xsl:text> label:</xsl:text> |
|
104 <xsl:value-of select="$label"/> |
|
105 <xsl:text> path section </xsl:text> |
|
106 <xsl:value-of select="$pathminmax"/> |
|
107 <xsl:text> use min and max on non mumeric value</xsl:text> |
|
108 </xsl:message> |
|
109 </xsl:if> |
|
110 <xsl:if test="count($item) = 1"> |
|
111 <xsl:attribute name="index"> |
|
112 <xsl:value-of select="$item/@index"/> |
|
113 </xsl:attribute> |
|
114 <xsl:attribute name="type"> |
|
115 <xsl:value-of select="$pathtype"/> |
|
116 </xsl:attribute> |
|
117 </xsl:if> |
|
118 </xsl:otherwise> |
|
119 </xsl:choose> |
|
120 </xsl:if> |
|
121 </path> |
|
122 </xsl:if> |
|
123 </xsl:for-each> |
|
124 <xsl:if test="svg:desc"> |
|
125 <desc> |
|
126 <xsl:value-of select="svg:desc/text()"/> |
|
127 </desc> |
|
128 </xsl:if> |
|
129 </widget> |
|
130 </xsl:if> |
|
131 </xsl:template> |
|
132 <xsl:template mode="genlabel" match="arg"> |
|
133 <xsl:text>:</xsl:text> |
|
134 <xsl:value-of select="@value"/> |
|
135 </xsl:template> |
|
136 <xsl:template mode="genlabel" match="path"> |
|
137 <xsl:text>@</xsl:text> |
|
138 <xsl:value-of select="@value"/> |
|
139 <xsl:if test="string-length(@min)>0 or string-length(@max)>0"> |
|
140 <xsl:text>,</xsl:text> |
|
141 <xsl:value-of select="@min"/> |
|
142 <xsl:text>,</xsl:text> |
|
143 <xsl:value-of select="@max"/> |
|
144 </xsl:if> |
|
145 </xsl:template> |
|
146 <xsl:template mode="genlabel" match="widget"> |
|
147 <xsl:text>HMI:</xsl:text> |
|
148 <xsl:value-of select="@type"/> |
|
149 <xsl:apply-templates mode="genlabel" select="arg"/> |
|
150 <xsl:apply-templates mode="genlabel" select="path"/> |
|
151 </xsl:template> |
|
152 <xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/> |
|
153 <xsl:template match="widget[@type='AnimateRotation']" mode="widget_desc"> |
|
154 <type> |
|
155 <xsl:value-of select="@type"/> |
|
156 </type> |
|
157 <longdesc> |
|
158 <xsl:text>AnimateRotation - DEPRECATED, do not use. |
|
159 </xsl:text> |
|
160 <xsl:text>Doesn't follow WYSIWYG principle, and forces user to add animateTransform tag in SVG (using inkscape XML editor for exemple) |
|
161 </xsl:text> |
|
162 </longdesc> |
|
163 <shortdesc> |
|
164 <xsl:text>AnimateRotation - DEPRECATED</xsl:text> |
|
165 </shortdesc> |
|
166 <path name="speed" accepts="HMI_INT,HMI_REAL"> |
|
167 <xsl:text>speed</xsl:text> |
|
168 </path> |
|
169 </xsl:template> |
|
170 <xsl:template match="widget[@type='Back']" mode="widget_desc"> |
|
171 <type> |
|
172 <xsl:value-of select="@type"/> |
|
173 </type> |
|
174 <longdesc> |
|
175 <xsl:text>Back widget brings focus back to previous page in history when clicked. |
|
176 </xsl:text> |
|
177 </longdesc> |
|
178 <shortdesc> |
|
179 <xsl:text>Jump to previous page</xsl:text> |
|
180 </shortdesc> |
|
181 </xsl:template> |
|
182 <xsl:template match="widget[@type='Button']" mode="widget_desc"> |
|
183 <type> |
|
184 <xsl:value-of select="@type"/> |
|
185 </type> |
|
186 <longdesc> |
|
187 <xsl:text>Button widget takes one boolean variable path, and reflect current true |
|
188 </xsl:text> |
|
189 <xsl:text>or false value by showing "active" or "inactive" labeled element |
|
190 </xsl:text> |
|
191 <xsl:text>respectively. Pressing and releasing button changes variable to true and |
|
192 </xsl:text> |
|
193 <xsl:text>false respectively. Potential inconsistency caused by quick consecutive |
|
194 </xsl:text> |
|
195 <xsl:text>presses on the button is mitigated by using a state machine that wait for |
|
196 </xsl:text> |
|
197 <xsl:text>previous state change to be reflected on variable before applying next one. |
|
198 </xsl:text> |
|
199 </longdesc> |
|
200 <shortdesc> |
|
201 <xsl:text>Push button reflecting consistently given boolean variable</xsl:text> |
|
202 </shortdesc> |
|
203 <path name="value" accepts="HMI_BOOL"> |
|
204 <xsl:text>Boolean variable</xsl:text> |
|
205 </path> |
|
206 </xsl:template> |
|
207 <xsl:template match="widget[@type='CircularBar']" mode="widget_desc"> |
|
208 <type> |
|
209 <xsl:value-of select="@type"/> |
|
210 </type> |
|
211 <longdesc> |
|
212 <xsl:text>CircularBar widget changes the end angle of a "path" labeled arc according |
|
213 </xsl:text> |
|
214 <xsl:text>to value of the single accepted variable. |
|
215 </xsl:text> |
|
216 <xsl:text> |
|
217 </xsl:text> |
|
218 <xsl:text>If "min" a "max" labeled texts are provided, then they are used as |
|
219 </xsl:text> |
|
220 <xsl:text>respective minimum and maximum value. Otherwise, value is expected to be |
|
221 </xsl:text> |
|
222 <xsl:text>in between 0 and 100. |
|
223 </xsl:text> |
|
224 <xsl:text> |
|
225 </xsl:text> |
|
226 <xsl:text>If "value" labeled text is found, then its content is replaced by value. |
|
227 </xsl:text> |
|
228 </longdesc> |
|
229 <shortdesc> |
|
230 <xsl:text>Change end angle of Inkscape's arc</xsl:text> |
|
231 </shortdesc> |
|
232 <path name="value" accepts="HMI_INT,HMI_REAL"> |
|
233 <xsl:text>Value to display</xsl:text> |
|
234 </path> |
|
235 </xsl:template> |
|
236 <xsl:template match="widget[@type='CircularSlider']" mode="widget_desc"> |
|
237 <type> |
|
238 <xsl:value-of select="@type"/> |
|
239 </type> |
|
240 <longdesc> |
|
241 <xsl:text>CircularSlider - DEPRECATED, to be replaced by PathSlider |
|
242 </xsl:text> |
|
243 <xsl:text>This widget moves "handle" labeled group along "range" labeled |
|
244 </xsl:text> |
|
245 <xsl:text>arc, according to value of the single accepted variable. |
|
246 </xsl:text> |
|
247 <xsl:text> |
|
248 </xsl:text> |
|
249 <xsl:text>If "min" a "max" labeled texts are provided, or if first and second |
|
250 </xsl:text> |
|
251 <xsl:text>argument are given, then they are used as respective minimum and maximum |
|
252 </xsl:text> |
|
253 <xsl:text>value. Otherwise, value is expected to be in between 0 and 100. |
|
254 </xsl:text> |
|
255 <xsl:text> |
|
256 </xsl:text> |
|
257 <xsl:text>If "value" labeled text is found, then its content is replaced by value. |
|
258 </xsl:text> |
|
259 <xsl:text>During drag, "setpoint" labeled group is moved to position defined by user |
|
260 </xsl:text> |
|
261 <xsl:text>while "handle" reflects current value from variable. |
|
262 </xsl:text> |
|
263 </longdesc> |
|
264 <shortdesc> |
|
265 <xsl:text>CircularSlider - DEPRECATED</xsl:text> |
|
266 </shortdesc> |
|
267 <arg name="min" count="optional" accepts="int,real"> |
|
268 <xsl:text>minimum value</xsl:text> |
|
269 </arg> |
|
270 <arg name="min" count="optional" accepts="int,real"> |
|
271 <xsl:text>maximum value</xsl:text> |
|
272 </arg> |
|
273 <path name="value" accepts="HMI_INT,HMI_REAL"> |
|
274 <xsl:text>Value to display</xsl:text> |
|
275 </path> |
|
276 </xsl:template> |
|
277 <xsl:template match="widget[@type='CustomHtml']" mode="widget_desc"> |
|
278 <type> |
|
279 <xsl:value-of select="@type"/> |
|
280 </type> |
|
281 <longdesc> |
|
282 <xsl:text>CustomHtml widget allows insertion of HTML code in a svg:foreignObject. |
|
283 </xsl:text> |
|
284 <xsl:text>Widget content is replaced by foreignObject. HTML code is obtained from |
|
285 </xsl:text> |
|
286 <xsl:text>"code" labeled text content. HTML insert position and size is given with |
|
287 </xsl:text> |
|
288 <xsl:text>"container" labeled element. |
|
289 </xsl:text> |
|
290 </longdesc> |
|
291 <shortdesc> |
|
292 <xsl:text>Custom HTML insert</xsl:text> |
|
293 </shortdesc> |
|
294 </xsl:template> |
|
295 <xsl:template match="widget[@type='Display']" mode="widget_desc"> |
|
296 <type> |
|
297 <xsl:value-of select="@type"/> |
|
298 </type> |
|
299 <longdesc> |
|
300 <xsl:text>If Display widget is a svg:text element, then text content is replaced by |
|
301 </xsl:text> |
|
302 <xsl:text>value of given variables, space separated. |
|
303 </xsl:text> |
|
304 <xsl:text> |
|
305 </xsl:text> |
|
306 <xsl:text>Otherwise, if Display widget is a group containing a svg:text element |
|
307 </xsl:text> |
|
308 <xsl:text>labelled "format", then text content is replaced by printf-like formated |
|
309 </xsl:text> |
|
310 <xsl:text>string. In other words, if "format" labeled text is "%d %s %f", then 3 |
|
311 </xsl:text> |
|
312 <xsl:text>variables paths are expected : HMI_IN, HMI_STRING and HMI_REAL. |
|
313 </xsl:text> |
|
314 <xsl:text> |
|
315 </xsl:text> |
|
316 <xsl:text>In case Display widget is a svg::text element, it is also possible to give |
|
317 </xsl:text> |
|
318 <xsl:text>format string as first argument. |
|
319 </xsl:text> |
|
320 </longdesc> |
|
321 <shortdesc> |
|
322 <xsl:text>Printf-like formated text display </xsl:text> |
|
323 </shortdesc> |
|
324 <arg name="format" count="optional" accepts="string"> |
|
325 <xsl:text>printf-like format string when not given as svg:text</xsl:text> |
|
326 </arg> |
|
327 <path name="fields" count="many" accepts="HMI_INT,HMI_REAL,HMI_STRING,HMI_BOOL"> |
|
328 <xsl:text>variables to be displayed</xsl:text> |
|
329 </path> |
|
330 </xsl:template> |
|
331 <xsl:template match="widget[@type='DropDown']" mode="widget_desc"> |
|
332 <type> |
|
333 <xsl:value-of select="@type"/> |
|
334 </type> |
|
335 <longdesc> |
|
336 <xsl:text>DropDown widget let user select an entry in a list of texts, given as |
|
337 </xsl:text> |
|
338 <xsl:text>arguments. Single variable path is index of selection. |
|
339 </xsl:text> |
|
340 <xsl:text> |
|
341 </xsl:text> |
|
342 <xsl:text>It needs "text" (svg:text), "box" (svg:rect), "button" (svg:*), |
|
343 </xsl:text> |
|
344 <xsl:text>and "highlight" (svg:rect) labeled elements. |
|
345 </xsl:text> |
|
346 <xsl:text> |
|
347 </xsl:text> |
|
348 <xsl:text>When user clicks on "button", "text" is duplicated to display enties in the |
|
349 </xsl:text> |
|
350 <xsl:text>limit of available space in page, and "box" is extended to contain all |
|
351 </xsl:text> |
|
352 <xsl:text>texts. "highlight" is moved over pre-selected entry. |
|
353 </xsl:text> |
|
354 <xsl:text> |
|
355 </xsl:text> |
|
356 <xsl:text>When only one argument is given, and argment contains "#langs" then list of |
|
357 </xsl:text> |
|
358 <xsl:text>texts is automatically set to the list of human-readable languages supported |
|
359 </xsl:text> |
|
360 <xsl:text>by this HMI. |
|
361 </xsl:text> |
|
362 </longdesc> |
|
363 <shortdesc> |
|
364 <xsl:text>Let user select text entry in a drop-down menu</xsl:text> |
|
365 </shortdesc> |
|
366 <arg name="entries" count="many" accepts="string"> |
|
367 <xsl:text>drop-down menu entries</xsl:text> |
|
368 </arg> |
|
369 <path name="selection" accepts="HMI_INT"> |
|
370 <xsl:text>selection index</xsl:text> |
|
371 </path> |
|
372 </xsl:template> |
|
373 <xsl:template match="widget[@type='ForEach']" mode="widget_desc"> |
|
374 <type> |
|
375 <xsl:value-of select="@type"/> |
|
376 </type> |
|
377 <longdesc> |
|
378 <xsl:text>ForEach widget is used to span a small set of widget over a larger set of |
|
379 </xsl:text> |
|
380 <xsl:text>repeated HMI_NODEs. |
|
381 </xsl:text> |
|
382 <xsl:text> |
|
383 </xsl:text> |
|
384 <xsl:text>Idea is somewhat similar to relative page, but it all happens inside the |
|
385 </xsl:text> |
|
386 <xsl:text>ForEach widget, no page involved. |
|
387 </xsl:text> |
|
388 <xsl:text> |
|
389 </xsl:text> |
|
390 <xsl:text>Together with relative Jump widgets it can be used to build a menu to reach |
|
391 </xsl:text> |
|
392 <xsl:text>relative pages covering many identical HMI_NODES siblings. |
|
393 </xsl:text> |
|
394 <xsl:text> |
|
395 </xsl:text> |
|
396 <xsl:text>ForEach widget takes a HMI_CLASS name as argument and a HMI_NODE path as |
|
397 </xsl:text> |
|
398 <xsl:text>variable. |
|
399 </xsl:text> |
|
400 <xsl:text> |
|
401 </xsl:text> |
|
402 <xsl:text>Direct sub-elements can be either groups of widget to be spanned, labeled |
|
403 </xsl:text> |
|
404 <xsl:text>"ClassName:offset", or buttons to control the spanning, labeled |
|
405 </xsl:text> |
|
406 <xsl:text>"ClassName:+/-number". |
|
407 </xsl:text> |
|
408 </longdesc> |
|
409 <shortdesc> |
|
410 <xsl:text>span widgets over a set of repeated HMI_NODEs</xsl:text> |
|
411 </shortdesc> |
|
412 <arg name="class_name" accepts="string"> |
|
413 <xsl:text>HMI_CLASS name</xsl:text> |
|
414 </arg> |
|
415 <path name="root" accepts="HMI_NODE"> |
|
416 <xsl:text> where to find HMI_NODEs whose HMI_CLASS is class_name</xsl:text> |
|
417 </path> |
|
418 </xsl:template> |
|
419 <xsl:template match="widget[@type='Input']" mode="widget_desc"> |
|
420 <type> |
|
421 <xsl:value-of select="@type"/> |
|
422 </type> |
|
423 <longdesc> |
|
424 <xsl:text>Input widget takes one variable path, and displays current value in |
|
425 </xsl:text> |
|
426 <xsl:text>optional "value" labeled sub-element. |
|
427 </xsl:text> |
|
428 <xsl:text> |
|
429 </xsl:text> |
|
430 <xsl:text>Click on optional "edit" labeled element opens keypad to edit value. |
|
431 </xsl:text> |
|
432 <xsl:text> |
|
433 </xsl:text> |
|
434 <xsl:text>Operation on current value is performed when click on sub-elements with |
|
435 </xsl:text> |
|
436 <xsl:text>label starting with '=', '+' or '-' sign. Value after sign is used as |
|
437 </xsl:text> |
|
438 <xsl:text>operand. |
|
439 </xsl:text> |
|
440 </longdesc> |
|
441 <shortdesc> |
|
442 <xsl:text>Input field with predefined operation buttons</xsl:text> |
|
443 </shortdesc> |
|
444 <arg name="format" accepts="string"> |
|
445 <xsl:text>optional printf-like format </xsl:text> |
|
446 </arg> |
|
447 <path name="edit" accepts="HMI_INT, HMI_REAL, HMI_STRING"> |
|
448 <xsl:text>single variable to edit</xsl:text> |
|
449 </path> |
|
450 </xsl:template> |
|
451 <xsl:template match="widget[@type='JsonTable']" mode="widget_desc"> |
|
452 <type> |
|
453 <xsl:value-of select="@type"/> |
|
454 </type> |
|
455 <longdesc> |
|
456 <xsl:text>Send given variables as POST to http URL argument, spread returned JSON in |
|
457 </xsl:text> |
|
458 <xsl:text>SVG sub-elements of "data" labeled element. |
|
459 </xsl:text> |
|
460 <xsl:text> |
|
461 </xsl:text> |
|
462 <xsl:text>Documentation to be written. see svbghmi exemple. |
|
463 </xsl:text> |
|
464 </longdesc> |
|
465 <shortdesc> |
|
466 <xsl:text>Http POST variables, spread JSON back</xsl:text> |
|
467 </shortdesc> |
|
468 <arg name="url" accepts="string"> |
|
469 <xsl:text> </xsl:text> |
|
470 </arg> |
|
471 <path name="edit" accepts="HMI_INT, HMI_REAL, HMI_STRING"> |
|
472 <xsl:text>single variable to edit</xsl:text> |
|
473 </path> |
|
474 </xsl:template> |
|
475 <xsl:template match="widget[@type='Jump']" mode="widget_desc"> |
|
476 <type> |
|
477 <xsl:value-of select="@type"/> |
|
478 </type> |
|
479 <longdesc> |
|
480 <xsl:text>Jump widget brings focus to a different page. Mandatory single argument |
|
481 </xsl:text> |
|
482 <xsl:text>gives name of the page. |
|
483 </xsl:text> |
|
484 <xsl:text> |
|
485 </xsl:text> |
|
486 <xsl:text>Optional single path is used as new reference when jumping to a relative |
|
487 </xsl:text> |
|
488 <xsl:text>page, it must point to a HMI_NODE. |
|
489 </xsl:text> |
|
490 <xsl:text> |
|
491 </xsl:text> |
|
492 <xsl:text>"active"+"inactive" labeled elements can be provided and reflect current |
|
493 </xsl:text> |
|
494 <xsl:text>page being shown. |
|
495 </xsl:text> |
|
496 <xsl:text> |
|
497 </xsl:text> |
|
498 <xsl:text>"disabled" labeled element, if provided, is shown instead of "active" or |
|
499 </xsl:text> |
|
500 <xsl:text>"inactive" widget when pointed HMI_NODE is null. |
|
501 </xsl:text> |
|
502 </longdesc> |
|
503 <shortdesc> |
|
504 <xsl:text>Jump to given page</xsl:text> |
|
505 </shortdesc> |
|
506 <arg name="page" accepts="string"> |
|
507 <xsl:text>name of page to jump to</xsl:text> |
|
508 </arg> |
|
509 <path name="reference" count="optional" accepts="HMI_NODE"> |
|
510 <xsl:text>reference for relative jump</xsl:text> |
|
511 </path> |
|
512 </xsl:template> |
|
513 <xsl:template match="widget[@type='Keypad']" mode="widget_desc"> |
|
514 <type> |
|
515 <xsl:value-of select="@type"/> |
|
516 </type> |
|
517 <longdesc> |
|
518 <xsl:text>Keypad - to be written |
|
519 </xsl:text> |
|
520 </longdesc> |
|
521 <shortdesc> |
|
522 <xsl:text>Keypad </xsl:text> |
|
523 </shortdesc> |
|
524 <arg name="supported_types" accepts="string"> |
|
525 <xsl:text>keypad can input those types </xsl:text> |
|
526 </arg> |
|
527 </xsl:template> |
|
528 <xsl:template match="widget[@type='List']" mode="widget_desc"> |
|
529 <type> |
|
530 <xsl:value-of select="@type"/> |
|
531 </type> |
|
532 </xsl:template> |
|
533 <xsl:template match="widget[@type='Meter']" mode="widget_desc"> |
|
534 <type> |
|
535 <xsl:value-of select="@type"/> |
|
536 </type> |
|
537 <longdesc> |
|
538 <xsl:text>Meter widget moves the end of "needle" labeled path along "range" labeled |
|
539 </xsl:text> |
|
540 <xsl:text>path, according to value of the single accepted variable. |
|
541 </xsl:text> |
|
542 <xsl:text> |
|
543 </xsl:text> |
|
544 <xsl:text>Needle is reduced to a single segment. If "min" a "max" labeled texts |
|
545 </xsl:text> |
|
546 <xsl:text>are provided, or if first and second argument are given, then they are used |
|
547 </xsl:text> |
|
548 <xsl:text>as respective minimum and maximum value. Otherwise, value is expected to be |
|
549 </xsl:text> |
|
550 <xsl:text>in between 0 and 100. |
|
551 </xsl:text> |
|
552 <xsl:text> |
|
553 </xsl:text> |
|
554 <xsl:text>If "value" labeled text is found, then its content is replaced by value. |
|
555 </xsl:text> |
|
556 </longdesc> |
|
557 <shortdesc> |
|
558 <xsl:text>Moves "needle" along "range"</xsl:text> |
|
559 </shortdesc> |
|
560 <arg name="min" count="optional" accepts="int,real"> |
|
561 <xsl:text>minimum value</xsl:text> |
|
562 </arg> |
|
563 <arg name="max" count="optional" accepts="int,real"> |
|
564 <xsl:text>maximum value</xsl:text> |
|
565 </arg> |
|
566 <path name="value" accepts="HMI_INT,HMI_REAL"> |
|
567 <xsl:text>Value to display</xsl:text> |
|
568 </path> |
|
569 </xsl:template> |
|
570 <xsl:template match="widget[@type='ScrollBar']" mode="widget_desc"> |
|
571 <type> |
|
572 <xsl:value-of select="@type"/> |
|
573 </type> |
|
574 <longdesc> |
|
575 <xsl:text>ScrollBar - documentation to be written |
|
576 </xsl:text> |
|
577 </longdesc> |
|
578 <shortdesc> |
|
579 <xsl:text>ScrollBar</xsl:text> |
|
580 </shortdesc> |
|
581 <path name="value" accepts="HMI_INT"> |
|
582 <xsl:text>value</xsl:text> |
|
583 </path> |
|
584 <path name="range" accepts="HMI_INT"> |
|
585 <xsl:text>range</xsl:text> |
|
586 </path> |
|
587 <path name="visible" accepts="HMI_INT"> |
|
588 <xsl:text>visible</xsl:text> |
|
589 </path> |
|
590 </xsl:template> |
|
591 <xsl:template match="widget[@type='Slider']" mode="widget_desc"> |
|
592 <type> |
|
593 <xsl:value-of select="@type"/> |
|
594 </type> |
|
595 <longdesc> |
|
596 <xsl:text>Slider - DEPRECATED - use ScrollBar or PathSlider instead |
|
597 </xsl:text> |
|
598 </longdesc> |
|
599 <shortdesc> |
|
600 <xsl:text>Slider - DEPRECATED - use ScrollBar instead</xsl:text> |
|
601 </shortdesc> |
|
602 <path name="value" accepts="HMI_INT"> |
|
603 <xsl:text>value</xsl:text> |
|
604 </path> |
|
605 <path name="range" accepts="HMI_INT"> |
|
606 <xsl:text>range</xsl:text> |
|
607 </path> |
|
608 <path name="visible" accepts="HMI_INT"> |
|
609 <xsl:text>visible</xsl:text> |
|
610 </path> |
|
611 </xsl:template> |
|
612 <xsl:template match="widget[@type='Switch']" mode="widget_desc"> |
|
613 <type> |
|
614 <xsl:value-of select="@type"/> |
|
615 </type> |
|
616 <longdesc> |
|
617 <xsl:text>Switch widget hides all subelements whose label do not match given |
|
618 </xsl:text> |
|
619 <xsl:text>variable current value representation. For exemple if given variable type |
|
620 </xsl:text> |
|
621 <xsl:text>is HMI_INT and value is 1, then elements with label '1' will be displayed. |
|
622 </xsl:text> |
|
623 <xsl:text>Label can have comments, so '1#some comment' would also match. If matching |
|
624 </xsl:text> |
|
625 <xsl:text>variable of type HMI_STRING, then double quotes must be used. For exemple, |
|
626 </xsl:text> |
|
627 <xsl:text>'"hello"' or '"hello"#another comment' match HMI_STRING 'hello'. |
|
628 </xsl:text> |
|
629 </longdesc> |
|
630 <shortdesc> |
|
631 <xsl:text>Show elements whose label match value.</xsl:text> |
|
632 </shortdesc> |
|
633 <path name="value" accepts="HMI_INT,HMI_STRING"> |
|
634 <xsl:text>value to compare to labels</xsl:text> |
|
635 </path> |
|
636 </xsl:template> |
|
637 <xsl:template match="widget[@type='ToggleButton']" mode="widget_desc"> |
|
638 <type> |
|
639 <xsl:value-of select="@type"/> |
|
640 </type> |
|
641 <longdesc> |
|
642 <xsl:text>Button widget takes one boolean variable path, and reflect current true |
|
643 </xsl:text> |
|
644 <xsl:text>or false value by showing "active" or "inactive" labeled element |
|
645 </xsl:text> |
|
646 <xsl:text>respectively. Clicking or touching button toggles variable. |
|
647 </xsl:text> |
|
648 </longdesc> |
|
649 <shortdesc> |
|
650 <xsl:text>Toggle button reflecting given boolean variable</xsl:text> |
|
651 </shortdesc> |
|
652 <path name="value" accepts="HMI_BOOL"> |
|
653 <xsl:text>Boolean variable</xsl:text> |
|
654 </path> |
|
655 </xsl:template> |
|
656 <xsl:template mode="document" match="@* | node()"> |
|
657 <xsl:copy> |
|
658 <xsl:apply-templates mode="document" select="@* | node()"/> |
|
659 </xsl:copy> |
|
660 </xsl:template> |
|
661 <xsl:template mode="document" match="widget"> |
|
662 <xsl:copy> |
|
663 <xsl:apply-templates mode="document" select="@* | node()"/> |
|
664 <defs> |
|
665 <xsl:apply-templates mode="widget_desc" select="."/> |
|
666 </defs> |
|
667 </xsl:copy> |
|
668 </xsl:template> |
|
669 <xsl:template match="/"> |
|
670 <xsl:variable name="widgets"> |
|
671 <xsl:apply-templates mode="parselabel" select="$hmi_elements"/> |
|
672 </xsl:variable> |
|
673 <xsl:variable name="widget_ns" select="exsl:node-set($widgets)"/> |
|
674 <widgets> |
|
675 <xsl:apply-templates mode="document" select="$widget_ns"/> |
|
676 </widgets> |
|
677 </xsl:template> |
|
678 </xsl:stylesheet> |