svghmi/gen_index_xhtml.ysl2
author Edouard Tisserant <edouard.tisserant@gmail.com>
Sat, 18 Apr 2020 14:06:41 +0200
branchsvghmi
changeset 2939 4296ab974d4d
parent 2938 1379cd5c69dd
child 2940 034b6ce4f885
permissions -rw-r--r--
SVGHMI: Move reflective debug tags from "reflect" to "debug" namespace, preparing for per-purpose namespaces.
2753
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
     1
include yslt_noindent.yml2
2779
75c6a31caca6 SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents: 2763
diff changeset
     2
75c6a31caca6 SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents: 2763
diff changeset
     3
// overrides yslt's output function to set CDATA
2798
ddb2c4668a6b SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents: 2797
diff changeset
     4
decl output(method, cdata-section-elements="xhtml:script");
2792
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
     5
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
     6
istylesheet
2753
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
     7
            /* From Inkscape */
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
     8
            xmlns:dc="http://purl.org/dc/elements/1.1/"
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
     9
            xmlns:cc="http://creativecommons.org/ns#"
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
    10
            xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
    11
            xmlns:svg="http://www.w3.org/2000/svg"
2838
459bf80d3f46 SVGHMI: HMI:Page can now be a svg:g group or a svg:use clone, and included/linked widget are included in page. HMI:Jump was updated to be clickable through svg:use, to be generalized.
Edouard Tisserant
parents: 2837
diff changeset
    12
            xmlns:xlink="http://www.w3.org/1999/xlink"
2753
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
    13
            xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
    14
            xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
2798
ddb2c4668a6b SVGHMI : many details about communication implemented in JS, with side effects.
Edouard Tisserant
parents: 2797
diff changeset
    15
            xmlns:xhtml="http://www.w3.org/1999/xhtml"
2939
4296ab974d4d SVGHMI: Move reflective debug tags from "reflect" to "debug" namespace, preparing for per-purpose namespaces.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2938
diff changeset
    16
            xmlns:debug="debug"
2753
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
    17
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
    18
            /* Our namespace to invoke python code */
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
    19
            xmlns:ns="beremiz"
2854
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    20
            extension-element-prefixes="ns func exsl regexp str dyn"
2939
4296ab974d4d SVGHMI: Move reflective debug tags from "reflect" to "debug" namespace, preparing for per-purpose namespaces.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2938
diff changeset
    21
            exclude-result-prefixes="ns str regexp exsl func dyn debug" {
2792
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
    22
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    23
2879
58e6a91dc37f SVGHMI: Cosmetic changes
Edouard Tisserant
parents: 2878
diff changeset
    24
    const "hmi_elements", "//svg:*[starts-with(@inkscape:label, 'HMI:')]";
58e6a91dc37f SVGHMI: Cosmetic changes
Edouard Tisserant
parents: 2878
diff changeset
    25
2877
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
    26
    include hmi_tree.ysl2
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
    27
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
    28
    include geometry.ysl2
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
    29
682bce953795 SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents: 2876
diff changeset
    30
    include detachable_pages.ysl2
2853
6d39beb19f38 SVGHMI: whitespaces and comments
Edouard Tisserant
parents: 2852
diff changeset
    31
2878
bec552270ad1 SVGHMI: added inline_svg.ysl2
Edouard Tisserant
parents: 2877
diff changeset
    32
    include inline_svg.ysl2
2854
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    33
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    34
    include widgets_common.ysl2
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    35
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    36
    include widget_*.ysl2
2881
3bb49f93d48c SVGHMI: added widget_common.ysl2
Edouard Tisserant
parents: 2880
diff changeset
    37
2938
1379cd5c69dd SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2937
diff changeset
    38
    include scripts.ysl2
1379cd5c69dd SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2937
diff changeset
    39
2939
4296ab974d4d SVGHMI: Move reflective debug tags from "reflect" to "debug" namespace, preparing for per-purpose namespaces.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2938
diff changeset
    40
    template "*[namespace-uri()='debug']", mode="debug_as_comment" {
2904
92d115d8828d SVGHMI: collect debug data through xslt reflectivity instead of yml2/python trick
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2883
diff changeset
    41
        comment {
92d115d8828d SVGHMI: collect debug data through xslt reflectivity instead of yml2/python trick
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2883
diff changeset
    42
            | «local-name()» :
92d115d8828d SVGHMI: collect debug data through xslt reflectivity instead of yml2/python trick
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2883
diff changeset
    43
            apply ".", mode="debug";
92d115d8828d SVGHMI: collect debug data through xslt reflectivity instead of yml2/python trick
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2883
diff changeset
    44
        }
92d115d8828d SVGHMI: collect debug data through xslt reflectivity instead of yml2/python trick
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2883
diff changeset
    45
    }
92d115d8828d SVGHMI: collect debug data through xslt reflectivity instead of yml2/python trick
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2883
diff changeset
    46
2853
6d39beb19f38 SVGHMI: whitespaces and comments
Edouard Tisserant
parents: 2852
diff changeset
    47
    template "/" {
2793
2a97688c94c5 SVGHMI: use func:function for parsing labels so that it can be used in predicates
Edouard Tisserant
parents: 2792
diff changeset
    48
        comment > Made with SVGHMI. https://beremiz.org
2873
022db76c3bff SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2872
diff changeset
    49
2904
92d115d8828d SVGHMI: collect debug data through xslt reflectivity instead of yml2/python trick
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2883
diff changeset
    50
        // all debug output from included definitions, as comments
2939
4296ab974d4d SVGHMI: Move reflective debug tags from "reflect" to "debug" namespace, preparing for per-purpose namespaces.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2938
diff changeset
    51
        // apply "document('')/*/debug:*", mode="debug_as_comment";
2874
b67af0b8dc72 SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2873
diff changeset
    52
2840
e588f25e6c74 SVGHMI: Better and less verbose SVG namespace handling in XSLT transform
Edouard Tisserant
parents: 2839
diff changeset
    53
        html xmlns="http://www.w3.org/1999/xhtml"
e588f25e6c74 SVGHMI: Better and less verbose SVG namespace handling in XSLT transform
Edouard Tisserant
parents: 2839
diff changeset
    54
             xmlns:svg="http://www.w3.org/2000/svg"
e588f25e6c74 SVGHMI: Better and less verbose SVG namespace handling in XSLT transform
Edouard Tisserant
parents: 2839
diff changeset
    55
             xmlns:xlink="http://www.w3.org/1999/xlink" {
2792
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
    56
            head;
2808
dc78ffa5253d SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents: 2807
diff changeset
    57
            body style="margin:0;overflow:hidden;" {
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    58
                // Inline SVG
2854
c7d5f46cc306 SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents: 2853
diff changeset
    59
                copy "$result_svg";
2792
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
    60
                script{
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
    61
                    call "scripts";
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
    62
                }
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
    63
            }
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
    64
        }
0c0d3895b036 SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents: 2791
diff changeset
    65
    }
2753
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
    66
}