Edouard@2753: include yslt_noindent.yml2 Edouard@2779: Edouard@2779: // overrides yslt's output function to set CDATA Edouard@2798: decl output(method, cdata-section-elements="xhtml:script"); Edouard@2792: Edouard@2792: istylesheet Edouard@2753: /* From Inkscape */ Edouard@2753: xmlns:dc="http://purl.org/dc/elements/1.1/" Edouard@2753: xmlns:cc="http://creativecommons.org/ns#" Edouard@2753: xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" Edouard@2753: xmlns:svg="http://www.w3.org/2000/svg" Edouard@2838: xmlns:xlink="http://www.w3.org/1999/xlink" Edouard@2753: xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" Edouard@2753: xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" Edouard@2798: xmlns:xhtml="http://www.w3.org/1999/xhtml" edouard@2904: xmlns:reflect="reflect" Edouard@2753: Edouard@2753: /* Our namespace to invoke python code */ Edouard@2753: xmlns:ns="beremiz" Edouard@2854: extension-element-prefixes="ns func exsl regexp str dyn" edouard@2904: exclude-result-prefixes="ns str regexp exsl func dyn reflect" { Edouard@2792: Edouard@2790: Edouard@2879: const "hmi_elements", "//svg:*[starts-with(@inkscape:label, 'HMI:')]"; Edouard@2879: Edouard@2877: include hmi_tree.ysl2 Edouard@2877: Edouard@2877: include geometry.ysl2 Edouard@2877: Edouard@2877: include detachable_pages.ysl2 Edouard@2853: Edouard@2878: include inline_svg.ysl2 Edouard@2854: edouard@2883: include widgets_common.ysl2 edouard@2883: edouard@2883: include widget_*.ysl2 Edouard@2881: edouard@2904: template "*[namespace-uri()='reflect']", mode="debug_as_comment" { edouard@2904: comment { edouard@2904: | «local-name()» : edouard@2904: apply ".", mode="debug"; edouard@2904: } edouard@2904: } edouard@2904: Edouard@2853: template "/" { Edouard@2793: comment > Made with SVGHMI. https://beremiz.org edouard@2873: edouard@2904: // all debug output from included definitions, as comments edouard@2904: // apply "document('')/*/reflect:*", mode="debug_as_comment"; edouard@2874: Edouard@2840: html xmlns="http://www.w3.org/1999/xhtml" Edouard@2840: xmlns:svg="http://www.w3.org/2000/svg" Edouard@2840: xmlns:xlink="http://www.w3.org/1999/xlink" { Edouard@2792: head; Edouard@2808: body style="margin:0;overflow:hidden;" { edouard@2883: // Inline SVG Edouard@2854: copy "$result_svg"; Edouard@2792: script{ Edouard@2792: call "scripts"; Edouard@2792: } Edouard@2792: } Edouard@2792: } Edouard@2792: } Edouard@2792: Edouard@2792: function "scripts" Edouard@2792: { Edouard@2798: | edouard@2847: | id = idstr => document.getElementById(idstr); edouard@2847: | Edouard@2797: | var hmi_hash = [«$hmitree/@hash»]; Edouard@2792: Edouard@2797: | var hmi_widgets = { Edouard@2881: apply "$hmi_elements", mode="hmi_elements"; Edouard@2797: | } Edouard@2797: | Edouard@2822: | var heartbeat_index = «$indexed_hmitree/*[@hmipath = '/HEARTBEAT']/@index»; Edouard@2822: | Edouard@2798: | var hmitree_types = [ Edouard@2798: Edouard@2792: foreach "$indexed_hmitree/*" { edouard@2849: | /* «@index» «@hmipath» */ "«substring(local-name(), 5)»"`if "position()!=last()" > ,` Edouard@2792: } Edouard@2792: Edouard@2797: | ] Edouard@2792: | Edouard@2843: edouard@2847: | var detachable_elements = { edouard@2847: foreach "$detachable_elements"{ edouard@2850: | "«@id»":[id("«@id»"), id("«../@id»")]`if "position()!=last()" > ,` edouard@2847: } edouard@2847: | } edouard@2847: edouard@2847: | Edouard@2792: | var page_desc = { Edouard@2877: apply "$hmi_pages", mode="page_desc"; Edouard@2792: | } Edouard@2792: Edouard@2911: | var keypads = { Edouard@2911: foreach "$keypads_descs"{ Edouard@2911: const "keypad_id","@id"; Edouard@2911: foreach "arg"{ Edouard@2913: const "g", "$geometry[@Id = $keypad_id]"; Edouard@2913: | "«@value»":["«$keypad_id»", «$g/@x», «$g/@y»], Edouard@2911: } Edouard@2911: } Edouard@2911: | } Edouard@2911: Edouard@2911: Edouard@2795: | Edouard@2795: | var default_page = "«$default_page»"; Edouard@2879: | var svg_root = id("«/svg:svg/@id»"); Edouard@2792: include text svghmi.js Edouard@2808: } Edouard@2753: }