svghmi/gen_index_xhtml.ysl2
author Edouard Tisserant
Sat, 05 Oct 2019 09:45:58 +0200
branchsvghmi
changeset 2790 8fab1886ebec
parent 2789 ba0dd2ec6dc4
child 2791 d022523cb621
permissions -rw-r--r--
SVGHI: compute hmitree variables ordered index in xslt
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
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
     4
decl output(method, cdata-section-elements="script");
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
     5
istylesheet 
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
     6
            /* 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
     7
            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
     8
            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
     9
            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
    10
            xmlns:svg="http://www.w3.org/2000/svg"
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: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
    12
            xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    13
            xmlns:xhtml="http://www.w3.org/1999/xhtml"
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
    14
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
    15
            /* 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
    16
            xmlns:ns="beremiz"
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
            extension-element-prefixes="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
    18
            exclude-result-prefixes="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
    19
    
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
    20
    /* This retrieves geometry obtained through "inkscape -S" 
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
    21
     * already parsed by python and presented as a list of 
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
    22
     * <bbox x="0" y="0" w="42" h="42">
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
    23
     */
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
    24
    variable "geometry", "ns:GetSVGGeometry()";
2763
ce04d79b8e57 Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents: 2756
diff changeset
    25
    variable "hmitree", "ns:GetHMITree()";
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    26
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    27
    variable "_categories" {
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    28
        noindex > HMI_ROOT
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    29
        noindex > HMI_LABEL
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    30
        noindex > HMI_CLASS
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    31
        noindex > HMI_PLC_STATUS
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    32
        noindex > HMI_CURRENT_PAGE
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    33
    }
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    34
    variable "categories", "exsl:node-set($_categories)";
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    35
    //variable "indexed_hmitree", "$hmitree[not(local-name() = $categories/noindex/text())]";
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    36
    variable "indexed_hmitree" apply "$hmitree", mode="index";
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    37
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    38
    template "node()", mode="index"{
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    39
        param "index", "0";
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    40
        variable "content" {
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    41
            choose {
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    42
                when "not(local-name() = $categories/noindex)" {
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    43
                    xsl:copy {
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    44
                        attrib "index" > «$index»
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    45
                        foreach "@*" xsl:copy;
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    46
                    }
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    47
                    /* no node expected below value nodes */
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    48
                }
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    49
                otherwise {
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    50
                    apply "*[1]", mode="index"{
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    51
                        with "index", "$index";
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    52
                    }
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    53
                }
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    54
            }
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    55
        }
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    56
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    57
        copy "$content";
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    58
        apply "following-sibling::*[1]", mode="index" {
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    59
            with "index", "$index + count(exsl:node-set($content)/*)";
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    60
        }
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    61
    }
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    62
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
    63
    /* Identity template :
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
    64
     *  - copy every attributes 
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
    65
     *  - copy every sub-elements
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
     */
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
    67
    template "@* | node()" {
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
    68
      /* use real xsl:copy instead copy-of alias from yslt.yml2 */
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
    69
      xsl:copy apply "@* | node()";
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
    70
    }
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
    71
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2780
diff changeset
    72
    variable "mark" > =HMI=\n
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2780
diff changeset
    73
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
    74
    /* copy root node and add geometry as comment for a test */
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
    75
    template "/" 
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
    76
      html xmlns="http://www.w3.org/1999/xhtml" {
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
    77
          head;
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
    78
          body style="margin:0;" {
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
    79
              xsl:copy {
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
    80
                  comment {
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
    81
                      apply "$geometry", mode="testgeo";
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
    82
                  }
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
    83
                  comment {
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
    84
                      apply "$hmitree", mode="testtree";
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
    85
                  }
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    86
                  comment {
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    87
                      apply "exsl:node-set($indexed_hmitree)", mode="testtree";
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    88
                  }
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
    89
                  apply "@* | node()";
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
    90
              }
2780
e468f18df200 SVGHMI: moved static JS code to a separate file included at xhtml generation time
Edouard Tisserant
parents: 2779
diff changeset
    91
              script{
2788
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    92
                  /* TODO : paste hmitree hash stored in hmi tree root node */
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    93
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
    94
                  /* TODO re-enable
2783
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    95
                  ||
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    96
                  function evaluate_js_from_descriptions() {
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    97
                      var Page;
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    98
                      var Input;
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    99
                      var Display;
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   100
                      var res = [];
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   101
                  ||
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2780
diff changeset
   102
                  variable "midmark" > \n«$mark»
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2780
diff changeset
   103
                  apply """//*[contains(child::svg:desc, $midmark) or \
2783
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   104
                               starts-with(child::svg:desc, $mark)]""",2 
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2780
diff changeset
   105
                        mode="code_from_descs";
2783
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   106
                  ||
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   107
                      return res;
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   108
                  }
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   109
                  ||
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   110
                  */
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2780
diff changeset
   111
2780
e468f18df200 SVGHMI: moved static JS code to a separate file included at xhtml generation time
Edouard Tisserant
parents: 2779
diff changeset
   112
                  /*TODO add :
e468f18df200 SVGHMI: moved static JS code to a separate file included at xhtml generation time
Edouard Tisserant
parents: 2779
diff changeset
   113
                    - pages content
e468f18df200 SVGHMI: moved static JS code to a separate file included at xhtml generation time
Edouard Tisserant
parents: 2779
diff changeset
   114
                      + with ref to elt ?
e468f18df200 SVGHMI: moved static JS code to a separate file included at xhtml generation time
Edouard Tisserant
parents: 2779
diff changeset
   115
                    - widgets parameters
e468f18df200 SVGHMI: moved static JS code to a separate file included at xhtml generation time
Edouard Tisserant
parents: 2779
diff changeset
   116
                  */
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2780
diff changeset
   117
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   118
                  ||
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   119
                  var subscriptions = {
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   120
                  ||
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   121
                  //    apply "$hmitree", mode="subscription_";
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   122
                  ||
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   123
                      return res;
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   124
                  }
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   125
                  ||
2780
e468f18df200 SVGHMI: moved static JS code to a separate file included at xhtml generation time
Edouard Tisserant
parents: 2779
diff changeset
   126
                  include text svghmi.js
e468f18df200 SVGHMI: moved static JS code to a separate file included at xhtml generation time
Edouard Tisserant
parents: 2779
diff changeset
   127
              }
2763
ce04d79b8e57 Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents: 2756
diff changeset
   128
          }
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
   129
    }
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
   130
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2780
diff changeset
   131
    template "*", mode="code_from_descs" {
2783
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   132
        ||
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   133
        {
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   134
            var path, role, name, priv;
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   135
            var id = "«@id»";
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   136
        ||
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   137
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   138
        /* if label is used, use it as default name */
2789
ba0dd2ec6dc4 SVGHMI: now built.
Edouard Tisserant
parents: 2788
diff changeset
   139
        if "@inkscape:label"
2783
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   140
            |> name = "«@inkscape:label»";
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   141
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   142
        | /* -------------- */
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   143
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   144
        // this breaks indent, but fixing indent could break string literals
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2780
diff changeset
   145
        value "substring-after(svg:desc, $mark)";
2783
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   146
        // nobody reads generated code anyhow...
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   147
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   148
        ||
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   149
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   150
            /* -------------- */
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   151
            res.push({
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   152
                path:path,
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   153
                role:role,
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   154
                name:name,
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   155
                priv:priv
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   156
            })
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   157
        }
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   158
        ||
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2780
diff changeset
   159
    }
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2780
diff changeset
   160
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2780
diff changeset
   161
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
   162
    template "bbox", mode="testgeo"{
2763
ce04d79b8e57 Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents: 2756
diff changeset
   163
        | ID: «@Id» x: «@x» y: «@y» w: «@w» h: «@h»
ce04d79b8e57 Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents: 2756
diff changeset
   164
    }
ce04d79b8e57 Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents: 2756
diff changeset
   165
ce04d79b8e57 Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents: 2756
diff changeset
   166
    template "*", mode="testtree"{
ce04d79b8e57 Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents: 2756
diff changeset
   167
        param "indent", "''";
2790
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   168
        > «$indent» «local-name()» 
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   169
        foreach "@*" > «local-name()»=«.» 
8fab1886ebec SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents: 2789
diff changeset
   170
        > \n
2763
ce04d79b8e57 Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents: 2756
diff changeset
   171
        apply "*", mode="testtree" {
ce04d79b8e57 Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents: 2756
diff changeset
   172
            with "indent" value "concat($indent,'>')"
ce04d79b8e57 Pass HMITree to SVG transform. It seems it could really help to reduce JS tree binding logic in the end.
Edouard Tisserant
parents: 2756
diff changeset
   173
        };
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
   174
    }
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
   175
}