svghmi/gen_index_xhtml.ysl2
branchsvghmi
changeset 2940 034b6ce4f885
parent 2939 4296ab974d4d
child 2941 ef13a4007538
equal deleted inserted replaced
2939:4296ab974d4d 2940:034b6ce4f885
     1 include yslt_noindent.yml2
     1 include yslt_noindent.yml2
     2 
     2 
     3 // overrides yslt's output function to set CDATA
     3 // overrides yslt's output function to set CDATA
     4 decl output(method, cdata-section-elements="xhtml:script");
     4 decl output(method, cdata-section-elements="xhtml:script");
       
     5 
       
     6 // helper to emit some content to internal namespaces
       
     7 decl emit(*name) alias - {
       
     8     *name;
       
     9     template *name {
       
    10         content;
       
    11     }
       
    12 };
     5 
    13 
     6 istylesheet
    14 istylesheet
     7             /* From Inkscape */
    15             /* From Inkscape */
     8             xmlns:dc="http://purl.org/dc/elements/1.1/"
    16             xmlns:dc="http://purl.org/dc/elements/1.1/"
     9             xmlns:cc="http://creativecommons.org/ns#"
    17             xmlns:cc="http://creativecommons.org/ns#"
    11             xmlns:svg="http://www.w3.org/2000/svg"
    19             xmlns:svg="http://www.w3.org/2000/svg"
    12             xmlns:xlink="http://www.w3.org/1999/xlink"
    20             xmlns:xlink="http://www.w3.org/1999/xlink"
    13             xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
    21             xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
    14             xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
    22             xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
    15             xmlns:xhtml="http://www.w3.org/1999/xhtml"
    23             xmlns:xhtml="http://www.w3.org/1999/xhtml"
       
    24 
       
    25             /* Internal namespaces to allow emit code/content from anywhere */
    16             xmlns:debug="debug"
    26             xmlns:debug="debug"
       
    27             xmlns:preamble="preamble"
       
    28             xmlns:epilogue="epilogue"
    17 
    29 
    18             /* Our namespace to invoke python code */
    30             /* Namespace to invoke python code */
    19             xmlns:ns="beremiz"
    31             xmlns:ns="beremiz"
       
    32 
    20             extension-element-prefixes="ns func exsl regexp str dyn"
    33             extension-element-prefixes="ns func exsl regexp str dyn"
    21             exclude-result-prefixes="ns str regexp exsl func dyn debug" {
    34             exclude-result-prefixes="ns func exsl regexp str dyn debug preamble epilogue" {
    22 
       
    23 
    35 
    24     const "hmi_elements", "//svg:*[starts-with(@inkscape:label, 'HMI:')]";
    36     const "hmi_elements", "//svg:*[starts-with(@inkscape:label, 'HMI:')]";
    25 
    37 
    26     include hmi_tree.ysl2
    38     include hmi_tree.ysl2
    27 
    39 
    35 
    47 
    36     include widget_*.ysl2
    48     include widget_*.ysl2
    37 
    49 
    38     include scripts.ysl2
    50     include scripts.ysl2
    39 
    51 
    40     template "*[namespace-uri()='debug']", mode="debug_as_comment" {
       
    41         comment {
       
    42             | «local-name()» :
       
    43             apply ".", mode="debug";
       
    44         }
       
    45     }
       
    46 
       
    47     template "/" {
    52     template "/" {
    48         comment > Made with SVGHMI. https://beremiz.org
    53         comment > Made with SVGHMI. https://beremiz.org
    49 
    54 
    50         // all debug output from included definitions, as comments
    55         // all debug output from included definitions, as comments
    51         // apply "document('')/*/debug:*", mode="debug_as_comment";
    56         foreach "document('')/*/debug:*" {
       
    57             comment {
       
    58                 | «local-name()» :
       
    59                 apply ".";
       
    60             }
       
    61         }
    52 
    62 
    53         html xmlns="http://www.w3.org/1999/xhtml"
    63         html xmlns="http://www.w3.org/1999/xhtml"
    54              xmlns:svg="http://www.w3.org/2000/svg"
    64              xmlns:svg="http://www.w3.org/2000/svg"
    55              xmlns:xlink="http://www.w3.org/1999/xlink" {
    65              xmlns:xlink="http://www.w3.org/1999/xlink" {
    56             head;
    66             head;