# HG changeset patch # User Edouard Tisserant # Date 1587203342 -7200 # Node ID 9226a830fbc31e55334ff54d712907516042f890 # Parent 53fb11263ff10a3cf85a17e97449a3c08b422f5a SVGHMI: moving code wher it belongs, and reformulate some declarations for better readability. diff -r 53fb11263ff1 -r 9226a830fbc3 svghmi/gen_index_xhtml.ysl2 --- a/svghmi/gen_index_xhtml.ysl2 Thu Apr 16 10:21:25 2020 +0200 +++ b/svghmi/gen_index_xhtml.ysl2 Sat Apr 18 11:49:02 2020 +0200 @@ -3,20 +3,6 @@ // overrides yslt's output function to set CDATA decl output(method, cdata-section-elements="xhtml:script"); -in xsl decl labels(*ptr, name="defs_by_labels") alias call-template { - with "hmi_element", "$hmi_element"; - with "labels"{text *ptr}; -}; - -in xsl decl optional_labels(*ptr, name="defs_by_labels") alias call-template { - with "hmi_element", "$hmi_element"; - with "labels"{text *ptr}; - with "mandatory","'no'"; -}; - -in xsl decl svgtmpl(match, xmlns="http://www.w3.org/2000/svg") alias template; -in xsl decl svgfunc(name, xmlns="http://www.w3.org/2000/svg") alias template; - istylesheet /* From Inkscape */ xmlns:dc="http://purl.org/dc/elements/1.1/" diff -r 53fb11263ff1 -r 9226a830fbc3 svghmi/inline_svg.ysl2 --- a/svghmi/inline_svg.ysl2 Thu Apr 16 10:21:25 2020 +0200 +++ b/svghmi/inline_svg.ysl2 Sat Apr 18 11:49:02 2020 +0200 @@ -2,6 +2,11 @@ // // Produce Inline SVG element of resulting XHTML page. +// Since stylesheet output namespace is xhtml, templates that output svg have to be explicitely declared as such +in xsl decl svgtmpl(match, xmlns="http://www.w3.org/2000/svg") alias template; +in xsl decl svgfunc(name, xmlns="http://www.w3.org/2000/svg") alias template; + + // Identity template : // - copy every attributes // - copy every sub-elements diff -r 53fb11263ff1 -r 9226a830fbc3 svghmi/widgets_common.ysl2 --- a/svghmi/widgets_common.ysl2 Thu Apr 16 10:21:25 2020 +0200 +++ b/svghmi/widgets_common.ysl2 Sat Apr 18 11:49:02 2020 +0200 @@ -3,19 +3,22 @@ in xsl decl labels(*ptr, name="defs_by_labels") alias call-template { with "hmi_element", "$hmi_element"; with "labels"{text *ptr}; + content; }; -in xsl decl optional_labels(*ptr, name="defs_by_labels") alias call-template { - with "hmi_element", "$hmi_element"; - with "labels"{text *ptr}; - with "mandatory","'no'"; +decl optional_labels(*ptr) alias - { + /* TODO add some per label xslt variable to check if exist */ + labels(*ptr){ + with "mandatory","'no'"; + content; + } }; -in xsl decl activable_labels(*ptr, name="defs_by_labels") alias call-template { - with "hmi_element", "$hmi_element"; - with "labels"{text *ptr}; - with "mandatory","'no'"; - with "subelements","'active inactive'"; +decl activable_labels(*ptr) alias - { + optional_labels(*ptr) { + with "subelements","'active inactive'"; + content; + } }; template "svg:*", mode="hmi_elements" {