19 extension-element-prefixes="ns func exsl regexp str dyn" |
19 extension-element-prefixes="ns func exsl regexp str dyn" |
20 exclude-result-prefixes="ns func exsl regexp str dyn" { |
20 exclude-result-prefixes="ns func exsl regexp str dyn" { |
21 |
21 |
22 const "svg", "/svg:svg"; |
22 const "svg", "/svg:svg"; |
23 const "hmi_elements", "//svg:*[starts-with(@inkscape:label, 'HMI:')]"; |
23 const "hmi_elements", "//svg:*[starts-with(@inkscape:label, 'HMI:')]"; |
|
24 const "subhmitree", "ns:GetSubHMITree()"; |
24 |
25 |
|
26 const "indexed_hmitree", "/.."; // compatibility with parse_labels.ysl2 |
25 include parse_labels.ysl2 |
27 include parse_labels.ysl2 |
|
28 const "_parsed_widgets" apply "$hmi_elements", mode="parselabel"; |
|
29 const "parsed_widgets","exsl:node-set($_parsed_widgets)"; |
26 |
30 |
27 svgtmpl "@*", mode="inline_svg" xsl:copy; |
31 svgtmpl "@*", mode="inline_svg" xsl:copy; |
28 |
32 |
29 template "node()", mode="inline_svg" { |
33 template "node()", mode="inline_svg" { |
30 xsl:copy apply "@* | node()", mode="inline_svg"; |
34 xsl:copy apply "@* | node()", mode="inline_svg"; |
31 } |
35 } |
32 |
36 |
|
37 |
|
38 const "NODES_TYPES","str:split('HMI_ROOT HMI_NODE')"; |
|
39 const "HMI_NODES_COMPAT","str:split('Page Jump Foreach')"; |
33 template "/" { |
40 template "/" { |
34 comment > Widget dropped in Inkscape from Beremiz |
41 comment > Widget dropped in Inkscape from Beremiz |
|
42 |
|
43 const "selected_node_type","local-name($subhmitree)"; |
|
44 const "svg_widget_type", "$parsed_widgets/widget[1]/@type"; |
|
45 const "svg_widget_count", "count($parsed_widgets/widget)"; |
|
46 |
|
47 choose { |
|
48 when "$svg_widget_count < 1" |
|
49 error > No widget detected on selected SVG |
|
50 when "$svg_widget_count > 1" |
|
51 error > Multiple widget DnD not yet supported |
|
52 when """$selected_node_type = $NODES_TYPES and \ |
|
53 not($svg_widget_type = $HMI_NODES_COMPAT)""" |
|
54 error > Widget incopatible with selected HMI tree node |
|
55 } |
|
56 const "testmsg" { |
|
57 msg value "$selected_node_type"; |
|
58 msg value "$svg_widget_type"; |
|
59 } |
|
60 |
|
61 value "ns:GiveDetails($testmsg)"; |
35 |
62 |
36 apply "/", mode="inline_svg"; |
63 apply "/", mode="inline_svg"; |
37 } |
64 } |
38 } |
65 } |