1 include yslt_noindent.yml2 |
1 include yslt_noindent.yml2 |
2 |
2 |
3 // overrides yslt's output function to set CDATA |
3 // overrides yslt's output function to set CDATA |
4 decl output(method, cdata-section-elements="script"); |
4 decl output(method, cdata-section-elements="xhtml:script"); |
5 |
5 |
6 istylesheet |
6 istylesheet |
7 /* From Inkscape */ |
7 /* From Inkscape */ |
8 xmlns:dc="http://purl.org/dc/elements/1.1/" |
8 xmlns:dc="http://purl.org/dc/elements/1.1/" |
9 xmlns:cc="http://creativecommons.org/ns#" |
9 xmlns:cc="http://creativecommons.org/ns#" |
10 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
10 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
11 xmlns:svg="http://www.w3.org/2000/svg" |
11 xmlns:svg="http://www.w3.org/2000/svg" |
12 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" |
12 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" |
13 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" |
13 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" |
|
14 xmlns:xhtml="http://www.w3.org/1999/xhtml" |
14 |
15 |
15 /* Our namespace to invoke python code */ |
16 /* Our namespace to invoke python code */ |
16 xmlns:ns="beremiz" |
17 xmlns:ns="beremiz" |
17 extension-element-prefixes="ns func" |
18 extension-element-prefixes="ns func" |
18 exclude-result-prefixes="ns str regexp exsl func" { |
19 exclude-result-prefixes="ns str regexp exsl func" { |
192 | frequency: `apply "$widget", mode="refresh_frequency"`, |
194 | frequency: `apply "$widget", mode="refresh_frequency"`, |
193 | args: [ |
195 | args: [ |
194 foreach "$widget/arg" |
196 foreach "$widget/arg" |
195 | "«@value»"`if "position()!=last()" > ,` |
197 | "«@value»"`if "position()!=last()" > ,` |
196 | ], |
198 | ], |
197 | paths: [ |
199 | indexes: [ |
198 foreach "$widget/path" { |
200 foreach "$widget/path" { |
199 const "hmipath","@value"; |
201 const "hmipath","@value"; |
200 const "hmitree_match","$indexed_hmitree/*[@hmipath = $hmipath]"; |
202 const "hmitree_match","$indexed_hmitree/*[@hmipath = $hmipath]"; |
201 if "count($hmitree_match) = 0" |
203 if "count($hmitree_match) = 0" |
202 error > No match for HMI «$hmipath»; |
204 error > No match for HMI «$hmipath»; |
205 | ] |
207 | ] |
206 | }`if "position()!=last()" > ,` |
208 | }`if "position()!=last()" > ,` |
207 } |
209 } |
208 | } |
210 | } |
209 | |
211 | |
210 | var hmi_index = [ |
212 | var hmitree_types = [ |
211 |
213 |
212 const "svg","/"; /* foreach loses document root */ |
|
213 foreach "$indexed_hmitree/*" { |
214 foreach "$indexed_hmitree/*" { |
214 | { /* «@index» «@hmipath» */ |
215 | /* «@index» «@hmipath» */ "«substring(local-name(), 5)»"`if "position()!=last()" > ,` |
215 | type: "«local-name()»", |
|
216 | ids: [ |
|
217 const "hmipath","@hmipath"; |
|
218 foreach "$svg//*[substring-after(@inkscape:label,'@') = $hmipath]" { |
|
219 | hmi_widgets["«@id»"]`if "position()!=last()" > ,` |
|
220 } |
|
221 | ] |
|
222 | }`if "position()!=last()" > ,` |
|
223 } |
216 } |
224 |
217 |
225 | ] |
218 | ] |
226 | |
219 | |
227 | var page_desc = { |
220 | var page_desc = { |
236 const "page_elements", "$hmi_elements[@id = $page_ids]"; |
229 const "page_elements", "$hmi_elements[@id = $page_ids]"; |
237 | "«$desc/arg[1]/@value»": { |
230 | "«$desc/arg[1]/@value»": { |
238 | id: "«@id»", |
231 | id: "«@id»", |
239 | widgets: [ |
232 | widgets: [ |
240 foreach "$page_ids" { |
233 foreach "$page_ids" { |
241 | "«.»"`if "position()!=last()" > ,` |
234 | hmi_widgets.«.»`if "position()!=last()" > ,` |
242 } |
|
243 | ] |
|
244 | subscriptions: [ |
|
245 foreach "$page_elements" { |
|
246 const "hmipaths", "func:parselabel(@inkscape:label)/widget/path/@value"; |
|
247 const "notlast", "position()!=last()"; |
|
248 foreach "$hmipaths" { |
|
249 const "hmipath","."; |
|
250 | «$indexed_hmitree/*[@hmipath = $hmipath]/@index»`if "$notlast or position()!=last()" > ,` |
|
251 } |
|
252 } |
235 } |
253 | ] |
236 | ] |
254 | }`if "position()!=last()" > ,` |
237 | }`if "position()!=last()" > ,` |
255 } |
238 } |
256 | } |
239 | } |
257 |
240 |
258 | |
241 | |
259 | var default_page = "«$default_page»"; |
242 | var default_page = "«$default_page»"; |
260 |
243 |
261 include text svghmi.js |
244 include text svghmi.js |
|
245 | })(); |
262 } |
246 } |
263 |
247 |
264 /* |
248 /* |
265 Parses: |
249 Parses: |
266 "HMI:WidgetType:param1:param2@path1@path2" |
250 "HMI:WidgetType:param1:param2@path1@path2" |