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