svghmi/gen_index_xhtml.xslt
branchsvghmi
changeset 3181 50d0fef791d5
parent 3178 21cb76012c78
child 3185 9038655c1b18
child 3186 1e9b9d7451cd
equal deleted inserted replaced
3180:c059026d8626 3181:50d0fef791d5
     1 <?xml version="1.0"?>
     1 <?xml version="1.0"?>
     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">
     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">
     3   <xsl:output method="xml" cdata-section-elements="xhtml:script"/>
     3   <xsl:output cdata-section-elements="xhtml:script" method="xml"/>
     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>
  1691 </xsl:text>
  1691 </xsl:text>
  1692     <xsl:text>
  1692     <xsl:text>
  1693 </xsl:text>
  1693 </xsl:text>
  1694   </xsl:template>
  1694   </xsl:template>
  1695   <xsl:variable name="excluded_types" select="str:split('Page VarInit VarInitPersistent')"/>
  1695   <xsl:variable name="excluded_types" select="str:split('Page VarInit VarInitPersistent')"/>
  1696   <xsl:key use="@type" name="TypesKey" match="widget"/>
  1696   <xsl:key name="TypesKey" match="widget" use="@type"/>
  1697   <declarations:hmi-classes/>
  1697   <declarations:hmi-classes/>
  1698   <xsl:template match="declarations:hmi-classes">
  1698   <xsl:template match="declarations:hmi-classes">
  1699     <xsl:text>
  1699     <xsl:text>
  1700 </xsl:text>
  1700 </xsl:text>
  1701     <xsl:text>/* </xsl:text>
  1701     <xsl:text>/* </xsl:text>
  4533 </xsl:text>
  4533 </xsl:text>
  4534     <xsl:text>    // arbitrary defaults to avoid missing entries in query
  4534     <xsl:text>    // arbitrary defaults to avoid missing entries in query
  4535 </xsl:text>
  4535 </xsl:text>
  4536     <xsl:text>    cache = [0,100,50];
  4536     <xsl:text>    cache = [0,100,50];
  4537 </xsl:text>
  4537 </xsl:text>
  4538     <xsl:text>    init() {
  4538     <xsl:text>    init_common() {
  4539 </xsl:text>
  4539 </xsl:text>
  4540     <xsl:text>        this.spread_json_data_bound = this.spread_json_data.bind(this);
  4540     <xsl:text>        this.spread_json_data_bound = this.spread_json_data.bind(this);
  4541 </xsl:text>
  4541 </xsl:text>
  4542     <xsl:text>        this.handle_http_response_bound = this.handle_http_response.bind(this);
  4542     <xsl:text>        this.handle_http_response_bound = this.handle_http_response.bind(this);
  4543 </xsl:text>
  4543 </xsl:text>
  4938       <xsl:with-param name="hmi_element" select="$hmi_element"/>
  4938       <xsl:with-param name="hmi_element" select="$hmi_element"/>
  4939       <xsl:with-param name="labels">
  4939       <xsl:with-param name="labels">
  4940         <xsl:text>data</xsl:text>
  4940         <xsl:text>data</xsl:text>
  4941       </xsl:with-param>
  4941       </xsl:with-param>
  4942     </xsl:call-template>
  4942     </xsl:call-template>
  4943     <xsl:call-template name="defs_by_labels">
       
  4944       <xsl:with-param name="hmi_element" select="$hmi_element"/>
       
  4945       <xsl:with-param name="labels">
       
  4946         <xsl:text>forward backward cursor</xsl:text>
       
  4947       </xsl:with-param>
       
  4948       <xsl:with-param name="mandatory" select="'no'"/>
       
  4949     </xsl:call-template>
       
  4950     <xsl:variable name="data_elt" select="$result_svg_ns//*[@id = $hmi_element/@id]/*[@inkscape:label = 'data']"/>
  4943     <xsl:variable name="data_elt" select="$result_svg_ns//*[@id = $hmi_element/@id]/*[@inkscape:label = 'data']"/>
  4951     <xsl:text>    visible: </xsl:text>
  4944     <xsl:text>    visible: </xsl:text>
  4952     <xsl:value-of select="count($data_elt/*[@inkscape:label])"/>
  4945     <xsl:value-of select="count($data_elt/*[@inkscape:label])"/>
  4953     <xsl:text>,
  4946     <xsl:text>,
  4954 </xsl:text>
  4947 </xsl:text>
  4966 </xsl:text>
  4959 </xsl:text>
  4967     <xsl:apply-templates mode="json_table_render_except_comments" select="$data_elt">
  4960     <xsl:apply-templates mode="json_table_render_except_comments" select="$data_elt">
  4968       <xsl:with-param name="expressions" select="$initexpr_ns"/>
  4961       <xsl:with-param name="expressions" select="$initexpr_ns"/>
  4969       <xsl:with-param name="widget_elts" select="$hmi_element/*[@inkscape:label = 'data']/descendant::svg:*"/>
  4962       <xsl:with-param name="widget_elts" select="$hmi_element/*[@inkscape:label = 'data']/descendant::svg:*"/>
  4970     </xsl:apply-templates>
  4963     </xsl:apply-templates>
       
  4964     <xsl:text>    },
       
  4965 </xsl:text>
       
  4966     <xsl:text>    init() {
       
  4967 </xsl:text>
       
  4968     <xsl:text>       this.init_common();
       
  4969 </xsl:text>
       
  4970     <xsl:for-each select="$hmi_element/*[starts-with(@inkscape:label,'action_')]">
       
  4971       <xsl:text>        id("</xsl:text>
       
  4972       <xsl:value-of select="@id"/>
       
  4973       <xsl:text>").onclick = this.make_on_click("</xsl:text>
       
  4974       <xsl:value-of select="func:escape_quotes(@inkscape:label)"/>
       
  4975       <xsl:text>");
       
  4976 </xsl:text>
       
  4977     </xsl:for-each>
  4971     <xsl:text>    }
  4978     <xsl:text>    }
  4972 </xsl:text>
  4979 </xsl:text>
  4973   </xsl:template>
  4980   </xsl:template>
  4974   <xsl:template mode="widget_class" match="widget[@type='Jump']">
  4981   <xsl:template mode="widget_class" match="widget[@type='Jump']">
  4975     <xsl:text>    class JumpWidget extends Widget{
  4982     <xsl:text>    class JumpWidget extends Widget{
  6799       <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
  6806       <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
  6800     </xsl:comment>
  6807     </xsl:comment>
  6801     <xsl:comment>
  6808     <xsl:comment>
  6802       <xsl:apply-templates select="document('')/*/debug:*"/>
  6809       <xsl:apply-templates select="document('')/*/debug:*"/>
  6803     </xsl:comment>
  6810     </xsl:comment>
  6804     <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml">
  6811     <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  6805       <head/>
  6812       <head/>
  6806       <body style="margin:0;overflow:hidden;user-select:none;touch-action:none;">
  6813       <body style="margin:0;overflow:hidden;user-select:none;touch-action:none;">
  6807         <xsl:copy-of select="$result_svg"/>
  6814         <xsl:copy-of select="$result_svg"/>
  6808         <script>
  6815         <script>
  6809           <xsl:text>
  6816           <xsl:text>