author | Edouard Tisserant |
Mon, 07 Oct 2019 12:02:45 +0200 | |
branch | svghmi |
changeset 2791 | d022523cb621 |
parent 2790 | 8fab1886ebec |
child 2792 | 0c0d3895b036 |
permissions | -rw-r--r-- |
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"?> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
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:str="http://exslt.org/strings" xmlns:xhtml="http://www.w3.org/1999/xhtml" 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()"/> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
6 |
<xsl:variable name="_categories"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
7 |
<noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
8 |
<xsl:text>HMI_ROOT</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
9 |
</noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
10 |
<noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
11 |
<xsl:text>HMI_LABEL</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
12 |
</noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
13 |
<noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
14 |
<xsl:text>HMI_CLASS</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
15 |
</noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
16 |
<noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
17 |
<xsl:text>HMI_PLC_STATUS</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
18 |
</noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
19 |
<noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
20 |
<xsl:text>HMI_CURRENT_PAGE</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
21 |
</noindex> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
22 |
</xsl:variable> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
23 |
<xsl:variable name="categories" select="exsl:node-set($_categories)"/> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
24 |
<xsl:variable name="_indexed_hmitree"> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
25 |
<xsl:apply-templates mode="index" select="$hmitree"/> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
26 |
</xsl:variable> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
27 |
<xsl:variable name="indexed_hmitree" select="exsl:node-set($_indexed_hmitree)"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
28 |
<xsl:template mode="index" match="*"> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
29 |
<xsl:param name="index" select="0"/> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
30 |
<xsl:param name="parentpath" select="''"/> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
31 |
<xsl:variable name="content"> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
32 |
<xsl:variable name="path"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
33 |
<xsl:choose> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
34 |
<xsl:when test="local-name() = 'HMI_ROOT'"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
35 |
<xsl:value-of select="$parentpath"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
36 |
</xsl:when> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
37 |
<xsl:otherwise> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
38 |
<xsl:value-of select="$parentpath"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
39 |
<xsl:text>/</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
40 |
<xsl:value-of select="@name"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
41 |
</xsl:otherwise> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
42 |
</xsl:choose> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
43 |
</xsl:variable> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
44 |
<xsl:choose> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
45 |
<xsl:when test="not(local-name() = $categories/noindex)"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
46 |
<xsl:copy> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
47 |
<xsl:attribute name="index"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
48 |
<xsl:value-of select="$index"/> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
49 |
</xsl:attribute> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
50 |
<xsl:attribute name="hmipath"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
51 |
<xsl:value-of select="$path"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
52 |
</xsl:attribute> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
53 |
<xsl:for-each select="@*"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
54 |
<xsl:copy/> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
55 |
</xsl:for-each> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
56 |
</xsl:copy> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
57 |
</xsl:when> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
58 |
<xsl:otherwise> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
59 |
<xsl:apply-templates mode="index" select="*[1]"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
60 |
<xsl:with-param name="index" select="$index"/> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
61 |
<xsl:with-param name="parentpath"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
62 |
<xsl:value-of select="$path"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
63 |
</xsl:with-param> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
64 |
</xsl:apply-templates> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
65 |
</xsl:otherwise> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
66 |
</xsl:choose> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
67 |
</xsl:variable> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
68 |
<xsl:copy-of select="$content"/> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
69 |
<xsl:apply-templates mode="index" select="following-sibling::*[1]"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
70 |
<xsl:with-param name="index" select="$index + count(exsl:node-set($content)/*)"/> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
71 |
<xsl:with-param name="parentpath"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
72 |
<xsl:value-of select="$parentpath"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
73 |
</xsl:with-param> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
74 |
</xsl:apply-templates> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
75 |
</xsl:template> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
76 |
<xsl:template mode="identity_svg" match="@* | node()"> |
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
|
77 |
<xsl:copy> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
78 |
<xsl:apply-templates mode="identity_svg" select="@* | node()"/> |
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
|
79 |
</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
|
80 |
</xsl:template> |
2782
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
81 |
<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
|
82 |
<xsl:text>=HMI= |
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
83 |
</xsl:text> |
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
84 |
</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
|
85 |
<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
|
86 |
<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
|
87 |
<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
|
88 |
<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
|
89 |
<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
|
90 |
<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
|
91 |
<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
|
92 |
</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
|
93 |
<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
|
94 |
<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
|
95 |
</xsl:comment> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
96 |
<xsl:comment> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
97 |
<xsl:apply-templates mode="testtree" select="$indexed_hmitree"/> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
98 |
</xsl:comment> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
99 |
<xsl:apply-templates mode="identity_svg" select="@* | node()"/> |
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
|
100 |
</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
|
101 |
<script> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
102 |
<xsl:text>var subscriptions = { |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
103 |
</xsl:text> |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
104 |
<xsl:variable name="svg" select="/"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
105 |
<xsl:for-each select="$indexed_hmitree/*"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
106 |
<xsl:value-of select="@index"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
107 |
<xsl:text>: { |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
108 |
</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
109 |
<xsl:text> name: "</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
110 |
<xsl:value-of select="@name"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
111 |
<xsl:text>", |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
112 |
</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
113 |
<xsl:text> hmipath: "</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
114 |
<xsl:value-of select="@hmipath"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
115 |
<xsl:text>" |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
116 |
</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
117 |
<xsl:text> ids: [ |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
118 |
</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
119 |
<xsl:variable name="hmipath" select="@hmipath"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
120 |
<xsl:for-each select="$svg//*[substring-after(@inkscape:label,'@') = $hmipath]"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
121 |
<xsl:text> "</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
122 |
<xsl:value-of select="@id"/> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
123 |
<xsl:text>"</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
124 |
<xsl:if test="position()!=last()"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
125 |
<xsl:text>,</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
126 |
</xsl:if> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
127 |
<xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
128 |
</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
129 |
</xsl:for-each> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
130 |
<xsl:text> ] |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
131 |
</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
132 |
<xsl:text>}</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
133 |
<xsl:if test="position()!=last()"> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
134 |
<xsl:text>,</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
135 |
</xsl:if> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
136 |
<xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
137 |
</xsl:text> |
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
138 |
</xsl:for-each> |
2783
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
139 |
<xsl:text>} |
2782
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
140 |
</xsl:text> |
2788
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
141 |
<xsl:text>// svghmi.js |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
142 |
</xsl:text> |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
143 |
<xsl:text> |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
144 |
</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
|
145 |
<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
|
146 |
</xsl:text> |
2788
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
147 |
<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
|
148 |
</xsl:text> |
2788
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
149 |
<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
|
150 |
</xsl:text> |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
151 |
<xsl:text> |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
152 |
</xsl:text> |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
153 |
<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
|
154 |
</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
|
155 |
<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
|
156 |
</xsl:text> |
2788
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
157 |
<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
|
158 |
</xsl:text> |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
159 |
<xsl:text> |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
160 |
</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
|
161 |
<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
|
162 |
</xsl:text> |
2788
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
163 |
<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
|
164 |
</xsl:text> |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
165 |
<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
|
166 |
</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
|
167 |
<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
|
168 |
</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
|
169 |
<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
|
170 |
</xsl:text> |
2788
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
171 |
<xsl:text> |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
172 |
</xsl:text> |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
173 |
<xsl:text> // Once connection established |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
174 |
</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
|
175 |
<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
|
176 |
</xsl:text> |
2788
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
177 |
<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
|
178 |
</xsl:text> |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
179 |
<xsl:text> // show main page |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
180 |
</xsl:text> |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
181 |
<xsl:text> |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
182 |
</xsl:text> |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
183 |
<xsl:text> |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
184 |
</xsl:text> |
2ed9ff826d03
SVGHMI: Work in progress. C side mostly implemented, neither built nor tested.
Edouard Tisserant
parents:
2783
diff
changeset
|
185 |
<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
|
186 |
</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
|
187 |
<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
|
188 |
</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
|
189 |
<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
|
190 |
</xsl:text> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
191 |
<xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
192 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
193 |
<xsl:text> var pending_updates = {}; |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
194 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
195 |
<xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
196 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
197 |
<xsl:text> // subscription state, as it should be in hmi server |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
198 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
199 |
<xsl:text> // expected {index:period} |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
200 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
201 |
<xsl:text> var subscriptions = {}; |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
202 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
203 |
<xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
204 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
205 |
<xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
206 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
207 |
<xsl:text> // subscription state as needed by widget now |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
208 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
209 |
<xsl:text> // expected {index:[widgets]}; |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
210 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
211 |
<xsl:text> var subscribers = {}; |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
212 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
213 |
<xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
214 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
215 |
<xsl:text> // return the diff in between curently subscribed and subscription |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
216 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
217 |
<xsl:text> function update_subscriptions() { |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
218 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
219 |
<xsl:text> let result = []; |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
220 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
221 |
<xsl:text> Object.keys(subscribers).forEach(index => { |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
222 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
223 |
<xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
224 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
225 |
<xsl:text> let previous_period = subscriptions[index]; |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
226 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
227 |
<xsl:text> let new_period = Math.min(...widgets.map(widget => widget.period)); |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
228 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
229 |
<xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
230 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
231 |
<xsl:text> if(previous_period != new_period) |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
232 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
233 |
<xsl:text> result.push({index: index, period: new_period}); |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
234 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
235 |
<xsl:text> }) |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
236 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
237 |
<xsl:text> } |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
238 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
239 |
<xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
240 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
241 |
<xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
242 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
243 |
<xsl:text> function update_value(index, value) { |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
244 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
245 |
<xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
246 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
247 |
<xsl:text> }; |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
248 |
</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
249 |
<xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
250 |
</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
|
251 |
<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
|
252 |
</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
|
253 |
</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
|
254 |
</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
|
255 |
</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
|
256 |
</xsl:template> |
2782
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
257 |
<xsl:template mode="code_from_descs" match="*"> |
2783
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
258 |
<xsl:text>{ |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
259 |
</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
260 |
<xsl:text> var path, role, name, priv; |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
261 |
</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
262 |
<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
|
263 |
<xsl:value-of select="@id"/> |
2783
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
264 |
<xsl:text>"; |
2782
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
265 |
</xsl:text> |
2789 | 266 |
<xsl:if test="@inkscape:label"> |
2783
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
267 |
<xsl:text>name = "</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
268 |
<xsl:value-of select="@inkscape:label"/> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
269 |
<xsl:text>"; |
2782
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
270 |
</xsl:text> |
2783
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
271 |
</xsl:if> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
272 |
<xsl:text>/* -------------- */ |
2782
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
273 |
</xsl:text> |
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
274 |
<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
|
275 |
<xsl:text> |
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
276 |
</xsl:text> |
2783
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
277 |
<xsl:text> /* -------------- */ |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
278 |
</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
279 |
<xsl:text> res.push({ |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
280 |
</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
281 |
<xsl:text> path:path, |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
282 |
</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
283 |
<xsl:text> role:role, |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
284 |
</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
285 |
<xsl:text> name:name, |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
286 |
</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
287 |
<xsl:text> priv:priv |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
288 |
</xsl:text> |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
289 |
<xsl:text> }) |
5ee6967f721d
SVGHMI: Starting to define JS side more in details.
Edouard Tisserant
parents:
2782
diff
changeset
|
290 |
</xsl:text> |
2782
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
291 |
<xsl:text>} |
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
292 |
</xsl:text> |
723e420dfe72
SVGHMI: added transformation of code given in inkscape's description fields into javascript functions
Edouard Tisserant
parents:
2779
diff
changeset
|
293 |
</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
|
294 |
<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
|
295 |
<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
|
296 |
<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
|
297 |
<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
|
298 |
<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
|
299 |
<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
|
300 |
<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
|
301 |
<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
|
302 |
<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
|
303 |
<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
|
304 |
<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
|
305 |
<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
|
306 |
</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
|
307 |
</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
|
308 |
<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
|
309 |
<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
|
310 |
<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
|
311 |
<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
|
312 |
<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
|
313 |
<xsl:text> </xsl:text> |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
314 |
<xsl:for-each select="@*"> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
315 |
<xsl:value-of select="local-name()"/> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
316 |
<xsl:text>=</xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
317 |
<xsl:value-of select="."/> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
318 |
<xsl:text> </xsl:text> |
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
319 |
</xsl:for-each> |
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
|
320 |
<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
|
321 |
</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
|
322 |
<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
|
323 |
<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
|
324 |
<xsl:value-of select="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
|
325 |
</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
|
326 |
</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
|
327 |
</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
|
328 |
</xsl:stylesheet> |