svghmi/gen_index_xhtml.xslt
branchsvghmi
changeset 3079 1021c6c74dde
parent 3069 a9b03c2634c5
child 3080 e5fa1f49f0b9
equal deleted inserted replaced
3078:d345673610b0 3079:1021c6c74dde
     1 <?xml version="1.0"?>
     1 <?xml version="1.0"?>
     2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:str="http://exslt.org/strings" xmlns:func="http://exslt.org/functions" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:debug="debug" xmlns:preamble="preamble" xmlns:declarations="declarations" xmlns:definitions="definitions" xmlns:epilogue="epilogue" xmlns:ns="beremiz" version="1.0" extension-element-prefixes="ns func exsl regexp str dyn" exclude-result-prefixes="ns func exsl regexp str dyn debug preamble epilogue declarations definitions">
     2 <xsl:stylesheet xmlns:ns="beremiz" xmlns:definitions="definitions" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:func="http://exslt.org/functions" xmlns:epilogue="epilogue" xmlns:preamble="preamble" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:svg="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:str="http://exslt.org/strings" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:exsl="http://exslt.org/common" xmlns:declarations="declarations" xmlns:debug="debug" exclude-result-prefixes="ns func exsl regexp str dyn debug preamble epilogue declarations definitions" extension-element-prefixes="ns func exsl regexp str dyn" version="1.0">
     3   <xsl:output cdata-section-elements="xhtml:script" method="xml"/>
     3   <xsl:output method="xml" cdata-section-elements="xhtml:script"/>
     4   <xsl:variable name="svg" select="/svg:svg"/>
     4   <xsl:variable name="svg" select="/svg:svg"/>
     5   <xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/>
     5   <xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/>
     6   <xsl:variable name="hmitree" select="ns:GetHMITree()"/>
     6   <xsl:variable name="hmitree" select="ns:GetHMITree()"/>
     7   <xsl:variable name="_categories">
     7   <xsl:variable name="_categories">
     8     <noindex>
     8     <noindex>
  5940       <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
  5940       <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
  5941     </xsl:comment>
  5941     </xsl:comment>
  5942     <xsl:comment>
  5942     <xsl:comment>
  5943       <xsl:apply-templates select="document('')/*/debug:*"/>
  5943       <xsl:apply-templates select="document('')/*/debug:*"/>
  5944     </xsl:comment>
  5944     </xsl:comment>
  5945     <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  5945     <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml">
  5946       <head/>
  5946       <head/>
  5947       <body style="margin:0;overflow:hidden;">
  5947       <body style="margin:0;overflow:hidden;user-select:none;">
  5948         <xsl:copy-of select="$result_svg"/>
  5948         <xsl:copy-of select="$result_svg"/>
  5949         <script>
  5949         <script>
  5950           <xsl:text>
  5950           <xsl:text>
  5951 //
  5951 //
  5952 //
  5952 //
  6509 </xsl:text>
  6509 </xsl:text>
  6510           <xsl:text>}
  6510           <xsl:text>}
  6511 </xsl:text>
  6511 </xsl:text>
  6512           <xsl:text>
  6512           <xsl:text>
  6513 </xsl:text>
  6513 </xsl:text>
  6514           <xsl:text>quotes = {"'":null, '"':null};
  6514           <xsl:text>const quotes = {"'":null, '"':null};
  6515 </xsl:text>
  6515 </xsl:text>
  6516           <xsl:text>
  6516           <xsl:text>
  6517 </xsl:text>
  6517 </xsl:text>
  6518           <xsl:text>function change_hmi_value(index, opstr) {
  6518           <xsl:text>function change_hmi_value(index, opstr) {
  6519 </xsl:text>
  6519 </xsl:text>
  6807 </xsl:text>
  6807 </xsl:text>
  6808           <xsl:text>var xmlns = "http://www.w3.org/2000/svg";
  6808           <xsl:text>var xmlns = "http://www.w3.org/2000/svg";
  6809 </xsl:text>
  6809 </xsl:text>
  6810           <xsl:text>var edit_callback;
  6810           <xsl:text>var edit_callback;
  6811 </xsl:text>
  6811 </xsl:text>
       
  6812           <xsl:text>const localtypes = {"PAGE_LOCAL":null, "HMI_LOCAL":null}
       
  6813 </xsl:text>
  6812           <xsl:text>function edit_value(path, valuetype, callback, initial, size) {
  6814           <xsl:text>function edit_value(path, valuetype, callback, initial, size) {
  6813 </xsl:text>
  6815 </xsl:text>
  6814           <xsl:text>
  6816           <xsl:text>    if(valuetype in localtypes){
       
  6817 </xsl:text>
       
  6818           <xsl:text>        valuetype = (typeof initial) == "number" ? "HMI_REAL" : "HMI_STRING";
       
  6819 </xsl:text>
       
  6820           <xsl:text>    }
  6815 </xsl:text>
  6821 </xsl:text>
  6816           <xsl:text>    let [keypadid, xcoord, ycoord] = keypads[valuetype];
  6822           <xsl:text>    let [keypadid, xcoord, ycoord] = keypads[valuetype];
  6817 </xsl:text>
  6823 </xsl:text>
  6818           <xsl:text>    edit_callback = callback;
  6824           <xsl:text>    edit_callback = callback;
  6819 </xsl:text>
  6825 </xsl:text>
  6820           <xsl:text>    let widget = hmi_widgets[keypadid];
  6826           <xsl:text>    let widget = hmi_widgets[keypadid];
  6821 </xsl:text>
  6827 </xsl:text>
  6822           <xsl:text>    widget.start_edit(path, valuetype, callback, initial, size);
  6828           <xsl:text>    widget.start_edit(path, valuetype, callback, initial, size);
  6823 </xsl:text>
  6829 </xsl:text>
  6824           <xsl:text>};
  6830           <xsl:text>};
       
  6831 </xsl:text>
       
  6832           <xsl:text>
       
  6833 </xsl:text>
       
  6834           <xsl:text>
  6825 </xsl:text>
  6835 </xsl:text>
  6826           <xsl:text>
  6836           <xsl:text>
  6827 </xsl:text>
  6837 </xsl:text>
  6828           <xsl:text>var current_modal; /* TODO stack ?*/
  6838           <xsl:text>var current_modal; /* TODO stack ?*/
  6829 </xsl:text>
  6839 </xsl:text>