author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Tue, 01 Aug 2023 21:04:00 +0200 | |
changeset 3840 | c2b6354f036f |
parent 3630 | 921f620577e8 |
permissions | -rw-r--r-- |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
1 |
<?xml version="1.0"?> |
3234
f2bfb047d0e6
SVGHMI: drop useless code from gen_dnd_widget.yslt2, renamed python callback to pass messages
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3229
diff
changeset
|
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:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:ns="beremiz" version="1.0" extension-element-prefixes="ns func exsl regexp str dyn" exclude-result-prefixes="ns func exsl regexp str dyn"> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
3 |
<xsl:output method="xml"/> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
4 |
<xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/> |
3264 | 5 |
<xsl:variable name="widgetparams" select="ns:GetWidgetParams()"/> |
3222
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
6 |
<xsl:variable name="indexed_hmitree" select="/.."/> |
3621 | 7 |
<xsl:variable name="pathregex" select="'^(\w+=)?([^,=]+)([-.\d,]*)$'"/> |
8 |
<xsl:variable name="newline"> |
|
9 |
<xsl:text> |
|
10 |
</xsl:text> |
|
11 |
</xsl:variable> |
|
12 |
<xsl:variable name="twonewlines" select="concat($newline,$newline)"/> |
|
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
13 |
<xsl:template mode="parselabel" match="*"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
14 |
<xsl:variable name="label" select="@inkscape:label"/> |
3621 | 15 |
<xsl:variable name="desc" select="svg:desc"/> |
16 |
<xsl:variable name="len" select="string-length($label)"/> |
|
17 |
<xsl:variable name="has_continuation" select="substring($label,$len,1)='\'"/> |
|
18 |
<xsl:variable name="full_decl"> |
|
19 |
<xsl:choose> |
|
20 |
<xsl:when test="$has_continuation"> |
|
21 |
<xsl:variable name="_continuation" select="substring-before($desc, $twonewlines)"/> |
|
22 |
<xsl:variable name="continuation"> |
|
23 |
<xsl:choose> |
|
24 |
<xsl:when test="$_continuation"> |
|
25 |
<xsl:value-of select="$_continuation"/> |
|
26 |
</xsl:when> |
|
27 |
<xsl:otherwise> |
|
28 |
<xsl:value-of select="$desc"/> |
|
29 |
</xsl:otherwise> |
|
30 |
</xsl:choose> |
|
31 |
</xsl:variable> |
|
32 |
<xsl:value-of select="concat(substring($label,1,$len - 1),translate($continuation,$newline,''))"/> |
|
33 |
</xsl:when> |
|
34 |
<xsl:otherwise> |
|
35 |
<xsl:value-of select="$label"/> |
|
36 |
</xsl:otherwise> |
|
37 |
</xsl:choose> |
|
38 |
</xsl:variable> |
|
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
39 |
<xsl:variable name="id" select="@id"/> |
3621 | 40 |
<xsl:variable name="declaration" select="substring-after($full_decl,'HMI:')"/> |
41 |
<xsl:variable name="_args" select="substring-before($declaration,'@')"/> |
|
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
42 |
<xsl:variable name="args"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
43 |
<xsl:choose> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
44 |
<xsl:when test="$_args"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
45 |
<xsl:value-of select="$_args"/> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
46 |
</xsl:when> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
47 |
<xsl:otherwise> |
3621 | 48 |
<xsl:value-of select="$declaration"/> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
49 |
</xsl:otherwise> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
50 |
</xsl:choose> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
51 |
</xsl:variable> |
3410 | 52 |
<xsl:variable name="_typefreq" select="substring-before($args,':')"/> |
53 |
<xsl:variable name="typefreq"> |
|
54 |
<xsl:choose> |
|
55 |
<xsl:when test="$_typefreq"> |
|
56 |
<xsl:value-of select="$_typefreq"/> |
|
57 |
</xsl:when> |
|
58 |
<xsl:otherwise> |
|
59 |
<xsl:value-of select="$args"/> |
|
60 |
</xsl:otherwise> |
|
61 |
</xsl:choose> |
|
62 |
</xsl:variable> |
|
3414
0ff608310312
SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3410
diff
changeset
|
63 |
<xsl:variable name="freq" select="substring-after($typefreq,'|')"/> |
3410 | 64 |
<xsl:variable name="_type" select="substring-before($typefreq,'|')"/> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
65 |
<xsl:variable name="type"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
66 |
<xsl:choose> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
67 |
<xsl:when test="$_type"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
68 |
<xsl:value-of select="$_type"/> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
69 |
</xsl:when> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
70 |
<xsl:otherwise> |
3410 | 71 |
<xsl:value-of select="$typefreq"/> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
72 |
</xsl:otherwise> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
73 |
</xsl:choose> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
74 |
</xsl:variable> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
75 |
<xsl:if test="$type"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
76 |
<widget> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
77 |
<xsl:attribute name="id"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
78 |
<xsl:value-of select="$id"/> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
79 |
</xsl:attribute> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
80 |
<xsl:attribute name="type"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
81 |
<xsl:value-of select="$type"/> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
82 |
</xsl:attribute> |
3414
0ff608310312
SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3410
diff
changeset
|
83 |
<xsl:if test="$freq"> |
3478
c04c6db09eff
SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3414
diff
changeset
|
84 |
<xsl:if test="not(regexp:test($freq,'^[0-9]*(\.[0-9]+)?[smh]?'))"> |
c04c6db09eff
SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3414
diff
changeset
|
85 |
<xsl:message terminate="yes"> |
c04c6db09eff
SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3414
diff
changeset
|
86 |
<xsl:text>Widget id:</xsl:text> |
c04c6db09eff
SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3414
diff
changeset
|
87 |
<xsl:value-of select="$id"/> |
c04c6db09eff
SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3414
diff
changeset
|
88 |
<xsl:text> label:</xsl:text> |
3621 | 89 |
<xsl:value-of select="$full_decl"/> |
3478
c04c6db09eff
SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3414
diff
changeset
|
90 |
<xsl:text> has wrong syntax of frequency forcing </xsl:text> |
c04c6db09eff
SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3414
diff
changeset
|
91 |
<xsl:value-of select="$freq"/> |
c04c6db09eff
SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3414
diff
changeset
|
92 |
</xsl:message> |
c04c6db09eff
SVGHMI: fix active/inactive being swapped in ToggleButton
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3414
diff
changeset
|
93 |
</xsl:if> |
3414
0ff608310312
SVGHMI: update generated xslt, and svghmi test project files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3410
diff
changeset
|
94 |
<xsl:attribute name="freq"> |
3410 | 95 |
<xsl:value-of select="$freq"/> |
96 |
</xsl:attribute> |
|
97 |
</xsl:if> |
|
3621 | 98 |
<xsl:variable name="tail" select="substring-after($declaration,'@')"/> |
99 |
<xsl:variable name="taillen" select="string-length($tail)"/> |
|
100 |
<xsl:variable name="has_enable" select="contains($tail, '#')"/> |
|
101 |
<xsl:variable name="paths"> |
|
102 |
<xsl:choose> |
|
103 |
<xsl:when test="$has_enable"> |
|
104 |
<xsl:value-of select="substring-before($tail,'#')"/> |
|
105 |
</xsl:when> |
|
106 |
<xsl:otherwise> |
|
107 |
<xsl:value-of select="$tail"/> |
|
108 |
</xsl:otherwise> |
|
109 |
</xsl:choose> |
|
110 |
</xsl:variable> |
|
111 |
<xsl:if test="$has_enable"> |
|
112 |
<xsl:variable name="enable_expr" select="substring-after($tail,'#')"/> |
|
113 |
<xsl:attribute name="enable_expr"> |
|
114 |
<xsl:value-of select="$enable_expr"/> |
|
115 |
</xsl:attribute> |
|
116 |
</xsl:if> |
|
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
117 |
<xsl:for-each select="str:split(substring-after($args, ':'), ':')"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
118 |
<arg> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
119 |
<xsl:attribute name="value"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
120 |
<xsl:value-of select="."/> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
121 |
</xsl:attribute> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
122 |
</arg> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
123 |
</xsl:for-each> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
124 |
<xsl:for-each select="str:split($paths, '@')"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
125 |
<xsl:if test="string-length(.) > 0"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
126 |
<path> |
3234
f2bfb047d0e6
SVGHMI: drop useless code from gen_dnd_widget.yslt2, renamed python callback to pass messages
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3229
diff
changeset
|
127 |
<xsl:variable name="path_match" select="regexp:match(.,$pathregex)"/> |
3621 | 128 |
<xsl:variable name="pathassign" select="substring-before($path_match[2],'=')"/> |
3234
f2bfb047d0e6
SVGHMI: drop useless code from gen_dnd_widget.yslt2, renamed python callback to pass messages
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3229
diff
changeset
|
129 |
<xsl:variable name="pathminmax" select="str:split($path_match[4],',')"/> |
3621 | 130 |
<xsl:variable name="path" select="$path_match[3]"/> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
131 |
<xsl:variable name="pathminmaxcount" select="count($pathminmax)"/> |
3621 | 132 |
<xsl:if test="not($path)"> |
133 |
<xsl:message terminate="yes"> |
|
134 |
<xsl:text>Widget id:</xsl:text> |
|
135 |
<xsl:value-of select="$id"/> |
|
136 |
<xsl:text> label:</xsl:text> |
|
137 |
<xsl:value-of select="$full_decl"/> |
|
138 |
<xsl:text> has wrong syntax</xsl:text> |
|
139 |
</xsl:message> |
|
140 |
</xsl:if> |
|
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
141 |
<xsl:attribute name="value"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
142 |
<xsl:value-of select="$path"/> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
143 |
</xsl:attribute> |
3621 | 144 |
<xsl:if test="$pathassign"> |
145 |
<xsl:attribute name="assign"> |
|
146 |
<xsl:value-of select="$pathassign"/> |
|
3234
f2bfb047d0e6
SVGHMI: drop useless code from gen_dnd_widget.yslt2, renamed python callback to pass messages
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3229
diff
changeset
|
147 |
</xsl:attribute> |
f2bfb047d0e6
SVGHMI: drop useless code from gen_dnd_widget.yslt2, renamed python callback to pass messages
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3229
diff
changeset
|
148 |
</xsl:if> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
149 |
<xsl:choose> |
3234
f2bfb047d0e6
SVGHMI: drop useless code from gen_dnd_widget.yslt2, renamed python callback to pass messages
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3229
diff
changeset
|
150 |
<xsl:when test="$pathminmaxcount = 2"> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
151 |
<xsl:attribute name="min"> |
3234
f2bfb047d0e6
SVGHMI: drop useless code from gen_dnd_widget.yslt2, renamed python callback to pass messages
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3229
diff
changeset
|
152 |
<xsl:value-of select="$pathminmax[1]"/> |
f2bfb047d0e6
SVGHMI: drop useless code from gen_dnd_widget.yslt2, renamed python callback to pass messages
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3229
diff
changeset
|
153 |
</xsl:attribute> |
f2bfb047d0e6
SVGHMI: drop useless code from gen_dnd_widget.yslt2, renamed python callback to pass messages
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3229
diff
changeset
|
154 |
<xsl:attribute name="max"> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
155 |
<xsl:value-of select="$pathminmax[2]"/> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
156 |
</xsl:attribute> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
157 |
</xsl:when> |
3234
f2bfb047d0e6
SVGHMI: drop useless code from gen_dnd_widget.yslt2, renamed python callback to pass messages
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3229
diff
changeset
|
158 |
<xsl:when test="$pathminmaxcount = 1 or $pathminmaxcount > 2"> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
159 |
<xsl:message terminate="yes"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
160 |
<xsl:text>Widget id:</xsl:text> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
161 |
<xsl:value-of select="$id"/> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
162 |
<xsl:text> label:</xsl:text> |
3621 | 163 |
<xsl:value-of select="$full_decl"/> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
164 |
<xsl:text> has wrong syntax of path section </xsl:text> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
165 |
<xsl:value-of select="$pathminmax"/> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
166 |
</xsl:message> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
167 |
</xsl:when> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
168 |
</xsl:choose> |
3229
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
169 |
<xsl:if test="$indexed_hmitree"> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
170 |
<xsl:choose> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
171 |
<xsl:when test="regexp:test($path,'^\.[a-zA-Z0-9_]+$')"> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
172 |
<xsl:attribute name="type"> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
173 |
<xsl:text>PAGE_LOCAL</xsl:text> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
174 |
</xsl:attribute> |
3229
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
175 |
</xsl:when> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
176 |
<xsl:when test="regexp:test($path,'^[a-zA-Z0-9_]+$')"> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
177 |
<xsl:attribute name="type"> |
3229
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
178 |
<xsl:text>HMI_LOCAL</xsl:text> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
179 |
</xsl:attribute> |
3229
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
180 |
</xsl:when> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
181 |
<xsl:otherwise> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
182 |
<xsl:variable name="item" select="$indexed_hmitree/*[@hmipath = $path]"/> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
183 |
<xsl:variable name="pathtype" select="local-name($item)"/> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
184 |
<xsl:if test="$pathminmaxcount = 3 and not($pathtype = 'HMI_INT' or $pathtype = 'HMI_REAL')"> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
185 |
<xsl:message terminate="yes"> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
186 |
<xsl:text>Widget id:</xsl:text> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
187 |
<xsl:value-of select="$id"/> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
188 |
<xsl:text> label:</xsl:text> |
3621 | 189 |
<xsl:value-of select="$full_decl"/> |
3229
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
190 |
<xsl:text> path section </xsl:text> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
191 |
<xsl:value-of select="$pathminmax"/> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
192 |
<xsl:text> use min and max on non mumeric value</xsl:text> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
193 |
</xsl:message> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
194 |
</xsl:if> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
195 |
<xsl:if test="count($item) = 1"> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
196 |
<xsl:attribute name="index"> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
197 |
<xsl:value-of select="$item/@index"/> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
198 |
</xsl:attribute> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
199 |
<xsl:attribute name="type"> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
200 |
<xsl:value-of select="$pathtype"/> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
201 |
</xsl:attribute> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
202 |
</xsl:if> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
203 |
</xsl:otherwise> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
204 |
</xsl:choose> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
205 |
</xsl:if> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
206 |
</path> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
207 |
</xsl:if> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
208 |
</xsl:for-each> |
3621 | 209 |
<xsl:choose> |
210 |
<xsl:when test="$has_continuation"> |
|
211 |
<xsl:variable name="_continuation" select="substring-after($desc, $twonewlines)"/> |
|
212 |
<xsl:if test="$_continuation"> |
|
213 |
<desc> |
|
214 |
<xsl:value-of select="$_continuation"/> |
|
215 |
</desc> |
|
216 |
</xsl:if> |
|
217 |
</xsl:when> |
|
218 |
<xsl:otherwise> |
|
219 |
<xsl:if test="$desc"> |
|
220 |
<desc> |
|
221 |
<xsl:value-of select="$desc/text()"/> |
|
222 |
</desc> |
|
223 |
</xsl:if> |
|
224 |
</xsl:otherwise> |
|
225 |
</xsl:choose> |
|
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
226 |
</widget> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
227 |
</xsl:if> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
228 |
</xsl:template> |
3229
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
229 |
<xsl:template mode="genlabel" match="arg"> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
230 |
<xsl:text>:</xsl:text> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
231 |
<xsl:value-of select="@value"/> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
232 |
</xsl:template> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
233 |
<xsl:template mode="genlabel" match="path"> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
234 |
<xsl:text>@</xsl:text> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
235 |
<xsl:value-of select="@value"/> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
236 |
<xsl:if test="string-length(@min)>0 or string-length(@max)>0"> |
3234
f2bfb047d0e6
SVGHMI: drop useless code from gen_dnd_widget.yslt2, renamed python callback to pass messages
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3229
diff
changeset
|
237 |
<xsl:text>,</xsl:text> |
3229
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
238 |
<xsl:value-of select="@min"/> |
3234
f2bfb047d0e6
SVGHMI: drop useless code from gen_dnd_widget.yslt2, renamed python callback to pass messages
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3229
diff
changeset
|
239 |
<xsl:text>,</xsl:text> |
3229
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
240 |
<xsl:value-of select="@max"/> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
241 |
</xsl:if> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
242 |
</xsl:template> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
243 |
<xsl:template mode="genlabel" match="widget"> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
244 |
<xsl:text>HMI:</xsl:text> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
245 |
<xsl:value-of select="@type"/> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
246 |
<xsl:apply-templates mode="genlabel" select="arg"/> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
247 |
<xsl:apply-templates mode="genlabel" select="path"/> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
248 |
</xsl:template> |
3222
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
249 |
<xsl:variable name="_parsed_widgets"> |
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
250 |
<xsl:apply-templates mode="parselabel" select="$hmi_elements"/> |
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
251 |
</xsl:variable> |
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
252 |
<xsl:variable name="parsed_widgets" select="exsl:node-set($_parsed_widgets)"/> |
3223
061796d9855e
SVGHMI: Widget transform before DnD now should have HMI path as a parameter, but this path isn't computed for some reason... WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3222
diff
changeset
|
253 |
<xsl:variable name="svg_widget" select="$parsed_widgets/widget[1]"/> |
061796d9855e
SVGHMI: Widget transform before DnD now should have HMI path as a parameter, but this path isn't computed for some reason... WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3222
diff
changeset
|
254 |
<xsl:variable name="svg_widget_type" select="$svg_widget/@type"/> |
061796d9855e
SVGHMI: Widget transform before DnD now should have HMI path as a parameter, but this path isn't computed for some reason... WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3222
diff
changeset
|
255 |
<xsl:variable name="svg_widget_path" select="$svg_widget/@path"/> |
061796d9855e
SVGHMI: Widget transform before DnD now should have HMI path as a parameter, but this path isn't computed for some reason... WIP.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3222
diff
changeset
|
256 |
<xsl:variable name="svg_widget_count" select="count($parsed_widgets/widget)"/> |
3264 | 257 |
<xsl:template mode="replace_params" match="@* | node()"> |
3229
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
258 |
<xsl:copy> |
3264 | 259 |
<xsl:apply-templates mode="replace_params" select="@* | node()"/> |
3229
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
260 |
</xsl:copy> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
261 |
</xsl:template> |
3264 | 262 |
<xsl:template mode="replace_params" match="arg"/> |
263 |
<xsl:template mode="replace_params" match="path"/> |
|
264 |
<xsl:template mode="replace_params" match="widget"> |
|
265 |
<xsl:copy> |
|
266 |
<xsl:apply-templates mode="replace_params" select="@* | node()"/> |
|
267 |
<xsl:copy-of select="$widgetparams/*"/> |
|
268 |
</xsl:copy> |
|
3229
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
269 |
</xsl:template> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
270 |
<xsl:template xmlns="http://www.w3.org/2000/svg" mode="inline_svg" match="@*"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
271 |
<xsl:copy/> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
272 |
</xsl:template> |
3229
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
273 |
<xsl:template xmlns="http://www.w3.org/2000/svg" mode="inline_svg" match="@inkscape:label[starts-with(., 'HMI:')]"/> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
274 |
<xsl:template mode="inline_svg" match="node()"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
275 |
<xsl:copy> |
3229
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
276 |
<xsl:if test="@id = $svg_widget/@id"> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
277 |
<xsl:variable name="substituted_widget"> |
3264 | 278 |
<xsl:apply-templates mode="replace_params" select="$svg_widget"/> |
3229
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
279 |
</xsl:variable> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
280 |
<xsl:variable name="substituted_widget_ns" select="exsl:node-set($substituted_widget)"/> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
281 |
<xsl:variable name="new_label"> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
282 |
<xsl:apply-templates mode="genlabel" select="$substituted_widget_ns"/> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
283 |
</xsl:variable> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
284 |
<xsl:attribute name="inkscape:label"> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
285 |
<xsl:value-of select="$new_label"/> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
286 |
</xsl:attribute> |
c5be4fd425e7
SVGHMI: still quite naive path substitution whn prepearing widget for DnD, but now uses label generation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3225
diff
changeset
|
287 |
</xsl:if> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
288 |
<xsl:apply-templates mode="inline_svg" select="@* | node()"/> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
289 |
</xsl:copy> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
290 |
</xsl:template> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
291 |
<xsl:template match="/"> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
292 |
<xsl:comment> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
293 |
<xsl:text>Widget dropped in Inkscape from Beremiz</xsl:text> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
294 |
</xsl:comment> |
3222
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
295 |
<xsl:choose> |
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
296 |
<xsl:when test="$svg_widget_count < 1"> |
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
297 |
<xsl:message terminate="yes"> |
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
298 |
<xsl:text>No widget detected on selected SVG</xsl:text> |
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
299 |
</xsl:message> |
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
300 |
</xsl:when> |
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
301 |
<xsl:when test="$svg_widget_count > 1"> |
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
302 |
<xsl:message terminate="yes"> |
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
303 |
<xsl:text>Multiple widget DnD not yet supported</xsl:text> |
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
304 |
</xsl:message> |
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
305 |
</xsl:when> |
6adeeb16ac3e
SVGHMI: Widget DnD to Inkscape : Added source SVG widget label parsing and pass selecte HMI subtree to XSLT tranform, so that SVG containing multiple widgets can later be matched against hmi tree fragments, in order to DnD complex groups of widgets.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3221
diff
changeset
|
306 |
</xsl:choose> |
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
307 |
<xsl:apply-templates mode="inline_svg" select="/"/> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
308 |
</xsl:template> |
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
309 |
</xsl:stylesheet> |