1 <?xml version="1.0"?> |
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"> |
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"/> |
3 <xsl:output method="xml"/> |
4 <xsl:variable name="indexed_hmitree" select="/.."/> |
4 <xsl:variable name="indexed_hmitree" select="/.."/> |
5 <xsl:variable name="pathregex" select="'^([^\[,]+)(\[[^\]]+\])?([-.\d,]*)$'"/> |
5 <xsl:variable name="pathregex" select="'^(\w+=)?([^,=]+)([-.\d,]*)$'"/> |
|
6 <xsl:variable name="newline"> |
|
7 <xsl:text> |
|
8 </xsl:text> |
|
9 </xsl:variable> |
|
10 <xsl:variable name="twonewlines" select="concat($newline,$newline)"/> |
6 <xsl:template mode="parselabel" match="*"> |
11 <xsl:template mode="parselabel" match="*"> |
7 <xsl:variable name="label" select="@inkscape:label"/> |
12 <xsl:variable name="label" select="@inkscape:label"/> |
|
13 <xsl:variable name="desc" select="svg:desc"/> |
|
14 <xsl:variable name="len" select="string-length($label)"/> |
|
15 <xsl:variable name="has_continuation" select="substring($label,$len,1)='\'"/> |
|
16 <xsl:variable name="full_decl"> |
|
17 <xsl:choose> |
|
18 <xsl:when test="$has_continuation"> |
|
19 <xsl:variable name="_continuation" select="substring-before($desc, $twonewlines)"/> |
|
20 <xsl:variable name="continuation"> |
|
21 <xsl:choose> |
|
22 <xsl:when test="$_continuation"> |
|
23 <xsl:value-of select="$_continuation"/> |
|
24 </xsl:when> |
|
25 <xsl:otherwise> |
|
26 <xsl:value-of select="$desc"/> |
|
27 </xsl:otherwise> |
|
28 </xsl:choose> |
|
29 </xsl:variable> |
|
30 <xsl:value-of select="concat(substring($label,1,$len - 1),translate($continuation,$newline,''))"/> |
|
31 </xsl:when> |
|
32 <xsl:otherwise> |
|
33 <xsl:value-of select="$label"/> |
|
34 </xsl:otherwise> |
|
35 </xsl:choose> |
|
36 </xsl:variable> |
8 <xsl:variable name="id" select="@id"/> |
37 <xsl:variable name="id" select="@id"/> |
9 <xsl:variable name="description" select="substring-after($label,'HMI:')"/> |
38 <xsl:variable name="declaration" select="substring-after($full_decl,'HMI:')"/> |
10 <xsl:variable name="_args" select="substring-before($description,'@')"/> |
39 <xsl:variable name="_args" select="substring-before($declaration,'@')"/> |
11 <xsl:variable name="args"> |
40 <xsl:variable name="args"> |
12 <xsl:choose> |
41 <xsl:choose> |
13 <xsl:when test="$_args"> |
42 <xsl:when test="$_args"> |
14 <xsl:value-of select="$_args"/> |
43 <xsl:value-of select="$_args"/> |
15 </xsl:when> |
44 </xsl:when> |
16 <xsl:otherwise> |
45 <xsl:otherwise> |
17 <xsl:value-of select="$description"/> |
46 <xsl:value-of select="$declaration"/> |
18 </xsl:otherwise> |
47 </xsl:otherwise> |
19 </xsl:choose> |
48 </xsl:choose> |
20 </xsl:variable> |
49 </xsl:variable> |
21 <xsl:variable name="_typefreq" select="substring-before($args,':')"/> |
50 <xsl:variable name="_typefreq" select="substring-before($args,':')"/> |
22 <xsl:variable name="typefreq"> |
51 <xsl:variable name="typefreq"> |
53 <xsl:if test="not(regexp:test($freq,'^[0-9]*(\.[0-9]+)?[smh]?'))"> |
82 <xsl:if test="not(regexp:test($freq,'^[0-9]*(\.[0-9]+)?[smh]?'))"> |
54 <xsl:message terminate="yes"> |
83 <xsl:message terminate="yes"> |
55 <xsl:text>Widget id:</xsl:text> |
84 <xsl:text>Widget id:</xsl:text> |
56 <xsl:value-of select="$id"/> |
85 <xsl:value-of select="$id"/> |
57 <xsl:text> label:</xsl:text> |
86 <xsl:text> label:</xsl:text> |
58 <xsl:value-of select="$label"/> |
87 <xsl:value-of select="$full_decl"/> |
59 <xsl:text> has wrong syntax of frequency forcing </xsl:text> |
88 <xsl:text> has wrong syntax of frequency forcing </xsl:text> |
60 <xsl:value-of select="$freq"/> |
89 <xsl:value-of select="$freq"/> |
61 </xsl:message> |
90 </xsl:message> |
62 </xsl:if> |
91 </xsl:if> |
63 <xsl:attribute name="freq"> |
92 <xsl:attribute name="freq"> |
64 <xsl:value-of select="$freq"/> |
93 <xsl:value-of select="$freq"/> |
|
94 </xsl:attribute> |
|
95 </xsl:if> |
|
96 <xsl:variable name="tail" select="substring-after($declaration,'@')"/> |
|
97 <xsl:variable name="taillen" select="string-length($tail)"/> |
|
98 <xsl:variable name="has_enable" select="contains($tail, '#')"/> |
|
99 <xsl:variable name="paths"> |
|
100 <xsl:choose> |
|
101 <xsl:when test="$has_enable"> |
|
102 <xsl:value-of select="substring-before($tail,'#')"/> |
|
103 </xsl:when> |
|
104 <xsl:otherwise> |
|
105 <xsl:value-of select="$tail"/> |
|
106 </xsl:otherwise> |
|
107 </xsl:choose> |
|
108 </xsl:variable> |
|
109 <xsl:if test="$has_enable"> |
|
110 <xsl:variable name="enable_expr" select="substring-after($tail,'#')"/> |
|
111 <xsl:attribute name="enable_expr"> |
|
112 <xsl:value-of select="$enable_expr"/> |
65 </xsl:attribute> |
113 </xsl:attribute> |
66 </xsl:if> |
114 </xsl:if> |
67 <xsl:for-each select="str:split(substring-after($args, ':'), ':')"> |
115 <xsl:for-each select="str:split(substring-after($args, ':'), ':')"> |
68 <arg> |
116 <arg> |
69 <xsl:attribute name="value"> |
117 <xsl:attribute name="value"> |
70 <xsl:value-of select="."/> |
118 <xsl:value-of select="."/> |
71 </xsl:attribute> |
119 </xsl:attribute> |
72 </arg> |
120 </arg> |
73 </xsl:for-each> |
121 </xsl:for-each> |
74 <xsl:variable name="paths" select="substring-after($description,'@')"/> |
|
75 <xsl:for-each select="str:split($paths, '@')"> |
122 <xsl:for-each select="str:split($paths, '@')"> |
76 <xsl:if test="string-length(.) > 0"> |
123 <xsl:if test="string-length(.) > 0"> |
77 <path> |
124 <path> |
78 <xsl:variable name="path_match" select="regexp:match(.,$pathregex)"/> |
125 <xsl:variable name="path_match" select="regexp:match(.,$pathregex)"/> |
|
126 <xsl:variable name="pathassign" select="substring-before($path_match[2],'=')"/> |
79 <xsl:variable name="pathminmax" select="str:split($path_match[4],',')"/> |
127 <xsl:variable name="pathminmax" select="str:split($path_match[4],',')"/> |
80 <xsl:variable name="path" select="$path_match[2]"/> |
128 <xsl:variable name="path" select="$path_match[3]"/> |
81 <xsl:variable name="path_accepts" select="$path_match[3]"/> |
|
82 <xsl:variable name="pathminmaxcount" select="count($pathminmax)"/> |
129 <xsl:variable name="pathminmaxcount" select="count($pathminmax)"/> |
|
130 <xsl:if test="not($path)"> |
|
131 <xsl:message terminate="yes"> |
|
132 <xsl:text>Widget id:</xsl:text> |
|
133 <xsl:value-of select="$id"/> |
|
134 <xsl:text> label:</xsl:text> |
|
135 <xsl:value-of select="$full_decl"/> |
|
136 <xsl:text> has wrong syntax</xsl:text> |
|
137 </xsl:message> |
|
138 </xsl:if> |
83 <xsl:attribute name="value"> |
139 <xsl:attribute name="value"> |
84 <xsl:value-of select="$path"/> |
140 <xsl:value-of select="$path"/> |
85 </xsl:attribute> |
141 </xsl:attribute> |
86 <xsl:if test="string-length($path_accepts)"> |
142 <xsl:if test="$pathassign"> |
87 <xsl:attribute name="accepts"> |
143 <xsl:attribute name="assign"> |
88 <xsl:value-of select="$path_accepts"/> |
144 <xsl:value-of select="$pathassign"/> |
89 </xsl:attribute> |
145 </xsl:attribute> |
90 </xsl:if> |
146 </xsl:if> |
91 <xsl:choose> |
147 <xsl:choose> |
92 <xsl:when test="$pathminmaxcount = 2"> |
148 <xsl:when test="$pathminmaxcount = 2"> |
93 <xsl:attribute name="min"> |
149 <xsl:attribute name="min"> |
126 <xsl:if test="$pathminmaxcount = 3 and not($pathtype = 'HMI_INT' or $pathtype = 'HMI_REAL')"> |
182 <xsl:if test="$pathminmaxcount = 3 and not($pathtype = 'HMI_INT' or $pathtype = 'HMI_REAL')"> |
127 <xsl:message terminate="yes"> |
183 <xsl:message terminate="yes"> |
128 <xsl:text>Widget id:</xsl:text> |
184 <xsl:text>Widget id:</xsl:text> |
129 <xsl:value-of select="$id"/> |
185 <xsl:value-of select="$id"/> |
130 <xsl:text> label:</xsl:text> |
186 <xsl:text> label:</xsl:text> |
131 <xsl:value-of select="$label"/> |
187 <xsl:value-of select="$full_decl"/> |
132 <xsl:text> path section </xsl:text> |
188 <xsl:text> path section </xsl:text> |
133 <xsl:value-of select="$pathminmax"/> |
189 <xsl:value-of select="$pathminmax"/> |
134 <xsl:text> use min and max on non mumeric value</xsl:text> |
190 <xsl:text> use min and max on non mumeric value</xsl:text> |
135 </xsl:message> |
191 </xsl:message> |
136 </xsl:if> |
192 </xsl:if> |
259 <xsl:with-param name="position" select="'down'"/> |
325 <xsl:with-param name="position" select="'down'"/> |
260 </xsl:apply-templates> |
326 </xsl:apply-templates> |
261 <xsl:text> } |
327 <xsl:text> } |
262 </xsl:text> |
328 </xsl:text> |
263 <xsl:apply-templates mode="actions" select="$fsm"/> |
329 <xsl:apply-templates mode="actions" select="$fsm"/> |
264 <xsl:text> animate(){ |
|
265 </xsl:text> |
|
266 <xsl:text> this.set_activation_state(this.display == "active"); |
|
267 </xsl:text> |
|
268 <xsl:text> } |
|
269 </xsl:text> |
|
270 <xsl:text> init() { |
330 <xsl:text> init() { |
271 </xsl:text> |
331 </xsl:text> |
272 <xsl:text> this.bound_onmouseup = this.onmouseup.bind(this); |
332 <xsl:text> this.bound_onmouseup = this.onmouseup.bind(this); |
273 </xsl:text> |
333 </xsl:text> |
274 <xsl:text> this.element.addEventListener("pointerdown", this.onmousedown.bind(this)); |
334 <xsl:text> this.element.addEventListener("pointerdown", this.onmousedown.bind(this)); |
275 </xsl:text> |
335 </xsl:text> |
276 <xsl:text> this.set_activation_state(undefined); |
336 <xsl:text> this.activity_state = undefined; |
277 </xsl:text> |
337 </xsl:text> |
278 <xsl:text> } |
338 <xsl:text> } |
279 </xsl:text> |
339 </xsl:text> |
280 </xsl:template> |
340 </xsl:template> |
281 <xsl:template match="widget[@type='CircularBar']" mode="widget_desc"> |
341 <xsl:template match="widget[@type='CircularBar']" mode="widget_desc"> |
561 <xsl:template match="widget[@type='Jump']" mode="widget_desc"> |
621 <xsl:template match="widget[@type='Jump']" mode="widget_desc"> |
562 <type> |
622 <type> |
563 <xsl:value-of select="@type"/> |
623 <xsl:value-of select="@type"/> |
564 </type> |
624 </type> |
565 <longdesc> |
625 <longdesc> |
566 <xsl:text>Jump widget brings focus to a different page. Mandatory single argument |
626 <xsl:text>Jump widget brings focus to a different page. Mandatory first argument |
567 </xsl:text> |
627 </xsl:text> |
568 <xsl:text>gives name of the page. |
628 <xsl:text>gives name of the page. |
569 </xsl:text> |
629 </xsl:text> |
570 <xsl:text> |
630 <xsl:text> |
571 </xsl:text> |
631 </xsl:text> |
572 <xsl:text>Optional single path is used as new reference when jumping to a relative |
632 <xsl:text>If first path is pointint to HMI_NODE variable is used as new reference |
573 </xsl:text> |
633 </xsl:text> |
574 <xsl:text>page, it must point to a HMI_NODE. |
634 <xsl:text>when jumping to a relative page. |
|
635 </xsl:text> |
|
636 <xsl:text> |
|
637 </xsl:text> |
|
638 <xsl:text>Additional arguments are unordered options: |
|
639 </xsl:text> |
|
640 <xsl:text> |
|
641 </xsl:text> |
|
642 <xsl:text>- Absolute: force page jump to be not relative even if first path is of type HMI_NODE |
|
643 </xsl:text> |
|
644 <xsl:text> |
|
645 </xsl:text> |
|
646 <xsl:text>- name=value: Notify PLC about jump by setting variable with path having same name assigned |
575 </xsl:text> |
647 </xsl:text> |
576 <xsl:text> |
648 <xsl:text> |
577 </xsl:text> |
649 </xsl:text> |
578 <xsl:text>"active"+"inactive" labeled elements can be provided and reflect current |
650 <xsl:text>"active"+"inactive" labeled elements can be provided and reflect current |
579 </xsl:text> |
651 </xsl:text> |
580 <xsl:text>page being shown. |
652 <xsl:text>page being shown. |
581 </xsl:text> |
653 </xsl:text> |
582 <xsl:text> |
654 <xsl:text> |
583 </xsl:text> |
655 </xsl:text> |
584 <xsl:text>"disabled" labeled element, if provided, is shown instead of "active" or |
656 <xsl:text>Exemples: |
585 </xsl:text> |
657 </xsl:text> |
586 <xsl:text>"inactive" widget when pointed HMI_NODE is null. |
658 <xsl:text> |
|
659 </xsl:text> |
|
660 <xsl:text>Relative jump: |
|
661 </xsl:text> |
|
662 <xsl:text> |
|
663 </xsl:text> |
|
664 <xsl:text>HMI:Jump:RelativePage@/PUMP9 |
|
665 </xsl:text> |
|
666 <xsl:text>HMI:Jump:RelativePage@/PUMP9@role=.userrole#role=="admin" |
|
667 </xsl:text> |
|
668 <xsl:text> |
|
669 </xsl:text> |
|
670 <xsl:text>Absolute jump: |
|
671 </xsl:text> |
|
672 <xsl:text> |
|
673 </xsl:text> |
|
674 <xsl:text>HMI:Jump:AbsolutePage |
|
675 </xsl:text> |
|
676 <xsl:text>HMI:Jump:AbsolutePage@role=.userrole#role=="admin" |
|
677 </xsl:text> |
|
678 <xsl:text> |
|
679 </xsl:text> |
|
680 <xsl:text>Forced absolute jump: |
|
681 </xsl:text> |
|
682 <xsl:text> |
|
683 </xsl:text> |
|
684 <xsl:text>HMI:Jump:AbsolutePage:Absolute@/PUMP9 |
|
685 </xsl:text> |
|
686 <xsl:text>HMI:Jump:AbsolutePage:Absolute:notify=1@notify=/PUMP9 |
|
687 </xsl:text> |
|
688 <xsl:text> |
|
689 </xsl:text> |
|
690 <xsl:text>Jump with feedback |
|
691 </xsl:text> |
|
692 <xsl:text> |
|
693 </xsl:text> |
|
694 <xsl:text>HMI:Jump:AbsolutePage:notify=1@notify=.did_jump |
|
695 </xsl:text> |
|
696 <xsl:text> |
587 </xsl:text> |
697 </xsl:text> |
588 </longdesc> |
698 </longdesc> |
589 <shortdesc> |
699 <shortdesc> |
590 <xsl:text>Jump to given page</xsl:text> |
700 <xsl:text>Jump to given page</xsl:text> |
591 </shortdesc> |
701 </shortdesc> |