svghmi/gen_index_xhtml.xslt
author Edouard Tisserant
Wed, 02 Oct 2019 11:31:02 +0200
branchsvghmi
changeset 2789 ba0dd2ec6dc4
parent 2788 2ed9ff826d03
child 2790 8fab1886ebec
permissions -rw-r--r--
SVGHMI: now built.
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
<?xml version="1.0"?>
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
     2
<xsl:stylesheet xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns="beremiz" xmlns:cc="http://creativecommons.org/ns#" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/1999/xhtml" xmlns:str="http://exslt.org/strings" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:exsl="http://exslt.org/common" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" exclude-result-prefixes="ns" extension-element-prefixes="ns" version="1.0">
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
     3
  <xsl:output method="xml" 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
     4
  <xsl:variable name="geometry" select="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
     5
  <xsl:variable name="hmitree" select="ns:GetHMITree()"/>
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
     6
  <xsl:template match="@* | 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
     7
    <xsl:copy>
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
      <xsl:apply-templates select="@* | 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
     9
    </xsl:copy>
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
  </xsl:template>
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
    11
  <xsl:variable name="mark">
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
    12
    <xsl:text>=HMI=
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
    13
</xsl:text>
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
    14
  </xsl:variable>
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
    15
  <xsl:template match="/">
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
    16
    <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
    17
      <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
    18
      <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
    19
        <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
    20
          <xsl: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
    21
            <xsl:apply-templates mode="testgeo" select="$geometry"/>
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
    22
          </xsl: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
    23
          <xsl: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
    24
            <xsl:apply-templates mode="testtree" select="$hmitree"/>
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
    25
          </xsl: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
    26
          <xsl:apply-templates select="@* | 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
    27
        </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
    28
        <script>
2783
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    29
          <xsl:text>function evaluate_js_from_descriptions() {
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    30
</xsl:text>
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    31
          <xsl:text>    var Page;
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    32
</xsl:text>
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    33
          <xsl:text>    var Input;
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    34
</xsl:text>
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    35
          <xsl:text>    var Display;
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    36
</xsl:text>
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    37
          <xsl:text>    var res = [];
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    38
</xsl:text>
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
    39
          <xsl:variable name="midmark">
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
    40
            <xsl:text>
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
    41
</xsl:text>
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
    42
            <xsl:value-of select="$mark"/>
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
    43
          </xsl:variable>
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
    44
          <xsl:apply-templates mode="code_from_descs" select="//*[contains(child::svg:desc, $midmark) or                                starts-with(child::svg:desc, $mark)]"/>
2783
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    45
          <xsl:text>    return res;
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    46
</xsl:text>
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
    47
          <xsl:text>}
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
    48
</xsl:text>
2788
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    49
          <xsl:text>// svghmi.js
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    50
</xsl:text>
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    51
          <xsl:text>
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    52
</xsl:text>
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
    53
          <xsl:text>(function(){
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
    54
</xsl:text>
2788
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    55
          <xsl:text>    // Open WebSocket to relative "/ws" address
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
    56
</xsl:text>
2788
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    57
          <xsl:text>    var ws = new WebSocket(window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws'));
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    58
</xsl:text>
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    59
          <xsl:text>
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    60
</xsl:text>
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    61
          <xsl:text>    // Register message reception handler 
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
    62
</xsl:text>
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
    63
          <xsl:text>    ws.onmessage = function (evt) {
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
    64
</xsl:text>
2788
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    65
          <xsl:text>        // TODO : dispatch and cache hmi tree updates
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    66
</xsl:text>
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    67
          <xsl:text>
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    68
</xsl:text>
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
    69
          <xsl:text>        var received_msg = evt.data;
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
    70
</xsl:text>
2788
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    71
          <xsl:text>        // TODO : check for hmitree hash header
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    72
</xsl:text>
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    73
          <xsl:text>        //        if not matching, reload page
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    74
</xsl:text>
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
          <xsl:text>        alert("Message is received..."+received_msg); 
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
</xsl:text>
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
          <xsl:text>    };
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
</xsl:text>
2788
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    79
          <xsl:text>
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    80
</xsl:text>
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    81
          <xsl:text>    // Once connection established
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    82
</xsl:text>
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
    83
          <xsl:text>    ws.onopen = function (evt) {
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
</xsl:text>
2788
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    85
          <xsl:text>        // TODO : enable the HMI (was previously offline, or just starts)
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    86
</xsl:text>
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    87
          <xsl:text>        //        show main page
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    88
</xsl:text>
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    89
          <xsl:text>
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    90
</xsl:text>
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    91
          <xsl:text>
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    92
</xsl:text>
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    93
          <xsl:text>        // TODO : prefix with hmitree hash header
2ed9ff826d03 SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents: 2783
diff changeset
    94
</xsl:text>
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
    95
          <xsl:text>        ws.send("test");
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
    96
</xsl:text>
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
    97
          <xsl:text>    };
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
    98
</xsl:text>
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
    99
          <xsl:text>})();
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
   100
</xsl:text>
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
   101
        </script>
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
   102
      </body>
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
   103
    </html>
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
   104
  </xsl:template>
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
   105
  <xsl:template mode="code_from_descs" match="*">
2783
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   106
    <xsl:text>{
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   107
</xsl:text>
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   108
    <xsl:text>    var path, role, name, priv;
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   109
</xsl:text>
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   110
    <xsl:text>    var id = "</xsl:text>
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
   111
    <xsl:value-of select="@id"/>
2783
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   112
    <xsl:text>";
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
   113
</xsl:text>
2789
ba0dd2ec6dc4 SVGHMI: now built.
Edouard Tisserant
parents: 2788
diff changeset
   114
    <xsl:if test="@inkscape:label">
2783
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   115
      <xsl:text>name = "</xsl:text>
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   116
      <xsl:value-of select="@inkscape:label"/>
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   117
      <xsl:text>";
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
   118
</xsl:text>
2783
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   119
    </xsl:if>
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   120
    <xsl:text>/* -------------- */
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
   121
</xsl:text>
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
   122
    <xsl:value-of select="substring-after(svg:desc, $mark)"/>
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
   123
    <xsl:text>
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
   124
</xsl:text>
2783
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   125
    <xsl:text>    /* -------------- */
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   126
</xsl:text>
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   127
    <xsl:text>    res.push({
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   128
</xsl:text>
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   129
    <xsl:text>        path:path,
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   130
</xsl:text>
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   131
    <xsl:text>        role:role,
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   132
</xsl:text>
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   133
    <xsl:text>        name:name,
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   134
</xsl:text>
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   135
    <xsl:text>        priv:priv
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   136
</xsl:text>
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   137
    <xsl:text>    })
5ee6967f721d SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents: 2782
diff changeset
   138
</xsl:text>
2782
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
   139
    <xsl:text>}
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
   140
</xsl:text>
723e420dfe72 SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents: 2779
diff changeset
   141
  </xsl:template>
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
   142
  <xsl:template mode="testgeo" match="bbox">
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
   143
    <xsl:text>ID: </xsl:text>
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
   144
    <xsl:value-of select="@Id"/>
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
   145
    <xsl:text> x: </xsl:text>
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
   146
    <xsl:value-of select="@x"/>
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
   147
    <xsl:text> y: </xsl:text>
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
   148
    <xsl:value-of select="@y"/>
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
   149
    <xsl:text> w: </xsl:text>
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
   150
    <xsl:value-of select="@w"/>
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
   151
    <xsl:text> h: </xsl:text>
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
   152
    <xsl:value-of select="@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
   153
    <xsl:text>
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
   154
</xsl:text>
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
   155
  </xsl:template>
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
   156
  <xsl:template mode="testtree" match="*">
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
   157
    <xsl:param name="indent" select="''"/>
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
   158
    <xsl:value-of select="$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
   159
    <xsl:text> </xsl:text>
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
   160
    <xsl:value-of select="local-name()"/>
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
   161
    <xsl:text> </xsl:text>
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
   162
    <xsl:value-of select="@name"/>
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
    <xsl:text> </xsl:text>
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
    <xsl:value-of select="@type"/>
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
    <xsl:text> </xsl:text>
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
    <xsl:value-of select="@path"/>
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
    <xsl:text>
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
   168
</xsl:text>
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
   169
    <xsl:apply-templates mode="testtree" select="*">
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
   170
      <xsl:with-param name="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
   171
        <xsl:value-of select="concat($indent,'&gt;')"/>
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
      </xsl:with-param>
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
    </xsl:apply-templates>
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
  </xsl: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
   175
</xsl:stylesheet>