svghmi/gen_index_xhtml.xslt
branchsvghmi
changeset 2814 2cabc4773885
parent 2811 4a81cec5f786
child 2822 9101a72a1da0
equal deleted inserted replaced
2813:ac736a878188 2814:2cabc4773885
    31   <xsl:variable name="_categories">
    31   <xsl:variable name="_categories">
    32     <noindex>
    32     <noindex>
    33       <xsl:text>HMI_ROOT</xsl:text>
    33       <xsl:text>HMI_ROOT</xsl:text>
    34     </noindex>
    34     </noindex>
    35     <noindex>
    35     <noindex>
    36       <xsl:text>HMI_LABEL</xsl:text>
    36       <xsl:text>HMI_NODE</xsl:text>
    37     </noindex>
       
    38     <noindex>
       
    39       <xsl:text>HMI_CLASS</xsl:text>
       
    40     </noindex>
    37     </noindex>
    41     <noindex>
    38     <noindex>
    42       <xsl:text>HMI_PLC_STATUS</xsl:text>
    39       <xsl:text>HMI_PLC_STATUS</xsl:text>
    43     </noindex>
    40     </noindex>
    44     <noindex>
    41     <noindex>
   121   </xsl:template>
   118   </xsl:template>
   122   <xsl:template match="/">
   119   <xsl:template match="/">
   123     <xsl:comment>
   120     <xsl:comment>
   124       <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
   121       <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
   125     </xsl:comment>
   122     </xsl:comment>
       
   123     <xsl:comment>
       
   124       <xsl:apply-templates mode="testgeo" select="$hmi_geometry"/>
       
   125     </xsl:comment>
       
   126     <xsl:comment>
       
   127       <xsl:apply-templates mode="testtree" select="$hmitree"/>
       
   128     </xsl:comment>
       
   129     <xsl:comment>
       
   130       <xsl:apply-templates mode="testtree" select="$indexed_hmitree"/>
       
   131     </xsl:comment>
   126     <html xmlns="http://www.w3.org/1999/xhtml">
   132     <html xmlns="http://www.w3.org/1999/xhtml">
   127       <head/>
   133       <head/>
   128       <body style="margin:0;overflow:hidden;">
   134       <body style="margin:0;overflow:hidden;">
   129         <xsl:apply-templates mode="inline_svg" select="svg:svg"/>
   135         <xsl:apply-templates mode="inline_svg" select="svg:svg"/>
   130         <script>
   136         <script>
   223       <xsl:for-each select="$widget/path">
   229       <xsl:for-each select="$widget/path">
   224         <xsl:variable name="hmipath" select="@value"/>
   230         <xsl:variable name="hmipath" select="@value"/>
   225         <xsl:variable name="hmitree_match" select="$indexed_hmitree/*[@hmipath = $hmipath]"/>
   231         <xsl:variable name="hmitree_match" select="$indexed_hmitree/*[@hmipath = $hmipath]"/>
   226         <xsl:if test="count($hmitree_match) = 0">
   232         <xsl:if test="count($hmitree_match) = 0">
   227           <xsl:message terminate="yes">
   233           <xsl:message terminate="yes">
   228             <xsl:text>No match for HMI </xsl:text>
   234             <xsl:text>No match for path "</xsl:text>
   229             <xsl:value-of select="$hmipath"/>
   235             <xsl:value-of select="$hmipath"/>
   230             <xsl:text>;</xsl:text>
   236             <xsl:text>" in HMI tree</xsl:text>
   231           </xsl:message>
   237           </xsl:message>
   232         </xsl:if>
   238         </xsl:if>
   233         <xsl:text>        </xsl:text>
   239         <xsl:text>        </xsl:text>
   234         <xsl:value-of select="$hmitree_match/@index"/>
   240         <xsl:value-of select="$hmitree_match/@index"/>
   235         <xsl:if test="position()!=last()">
   241         <xsl:if test="position()!=last()">
   796 </xsl:text>
   802 </xsl:text>
   797     <xsl:text>};
   803     <xsl:text>};
   798 </xsl:text>
   804 </xsl:text>
   799     <xsl:text>//})();
   805     <xsl:text>//})();
   800 </xsl:text>
   806 </xsl:text>
       
   807   </xsl:template>
       
   808   <xsl:template mode="testgeo" match="bbox">
       
   809     <xsl:text>ID: </xsl:text>
       
   810     <xsl:value-of select="@Id"/>
       
   811     <xsl:text> x: </xsl:text>
       
   812     <xsl:value-of select="@x"/>
       
   813     <xsl:text> y: </xsl:text>
       
   814     <xsl:value-of select="@y"/>
       
   815     <xsl:text> w: </xsl:text>
       
   816     <xsl:value-of select="@w"/>
       
   817     <xsl:text> h: </xsl:text>
       
   818     <xsl:value-of select="@h"/>
       
   819     <xsl:text>
       
   820 </xsl:text>
       
   821   </xsl:template>
       
   822   <xsl:template mode="testtree" match="*">
       
   823     <xsl:param name="indent" select="''"/>
       
   824     <xsl:value-of select="$indent"/>
       
   825     <xsl:text> </xsl:text>
       
   826     <xsl:value-of select="local-name()"/>
       
   827     <xsl:text> </xsl:text>
       
   828     <xsl:for-each select="@*">
       
   829       <xsl:value-of select="local-name()"/>
       
   830       <xsl:text>=</xsl:text>
       
   831       <xsl:value-of select="."/>
       
   832       <xsl:text> </xsl:text>
       
   833     </xsl:for-each>
       
   834     <xsl:text>
       
   835 </xsl:text>
       
   836     <xsl:apply-templates mode="testtree" select="*">
       
   837       <xsl:with-param name="indent">
       
   838         <xsl:value-of select="concat($indent,'&gt;')"/>
       
   839       </xsl:with-param>
       
   840     </xsl:apply-templates>
   801   </xsl:template>
   841   </xsl:template>
   802   <xsl:template name="defs_by_labels">
   842   <xsl:template name="defs_by_labels">
   803     <xsl:param name="labels" select="''"/>
   843     <xsl:param name="labels" select="''"/>
   804     <xsl:param name="mandatory" select="'yes'"/>
   844     <xsl:param name="mandatory" select="'yes'"/>
   805     <xsl:param name="hmi_element"/>
   845     <xsl:param name="hmi_element"/>