svghmi/gen_dnd_widget_svg.xslt
changeset 3506 ca312be56929
parent 3414 0ff608310312
child 3507 e87a2daace80
equal deleted inserted replaced
3505:a27b5862e363 3506:ca312be56929
     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:ns="beremiz" version="1.0" extension-element-prefixes="ns func exsl regexp str dyn" exclude-result-prefixes="ns func exsl regexp str dyn">
     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:ns="beremiz" version="1.0" extension-element-prefixes="ns func exsl regexp str dyn" exclude-result-prefixes="ns func exsl regexp str dyn">
     3   <xsl:output method="xml"/>
     3   <xsl:output method="xml"/>
     4   <xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/>
     4   <xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/>
     5   <xsl:variable name="widgetparams" select="ns:GetWidgetParams()"/>
     5   <xsl:variable name="widgetparams" select="ns:GetWidgetParams()"/>
     6   <xsl:variable name="indexed_hmitree" select="/.."/>
     6   <xsl:variable name="indexed_hmitree" select="/.."/>
     7   <xsl:variable name="pathregex" select="'^([^\[,]+)(\[[^\]]+\])?([\d,]*)$'"/>
     7   <xsl:variable name="pathregex" select="'^([^\[,]+)(\[[^\]]+\])?([-.\d,]*)$'"/>
     8   <xsl:template mode="parselabel" match="*">
     8   <xsl:template mode="parselabel" match="*">
     9     <xsl:variable name="label" select="@inkscape:label"/>
     9     <xsl:variable name="label" select="@inkscape:label"/>
    10     <xsl:variable name="id" select="@id"/>
    10     <xsl:variable name="id" select="@id"/>
    11     <xsl:variable name="description" select="substring-after($label,'HMI:')"/>
    11     <xsl:variable name="description" select="substring-after($label,'HMI:')"/>
    12     <xsl:variable name="_args" select="substring-before($description,'@')"/>
    12     <xsl:variable name="_args" select="substring-before($description,'@')"/>
    50         </xsl:attribute>
    50         </xsl:attribute>
    51         <xsl:attribute name="type">
    51         <xsl:attribute name="type">
    52           <xsl:value-of select="$type"/>
    52           <xsl:value-of select="$type"/>
    53         </xsl:attribute>
    53         </xsl:attribute>
    54         <xsl:if test="$freq">
    54         <xsl:if test="$freq">
       
    55           <xsl:if test="not(regexp:test($freq,'^[0-9]*(\.[0-9]+)?[smh]?'))">
       
    56             <xsl:message terminate="yes">
       
    57               <xsl:text>Widget id:</xsl:text>
       
    58               <xsl:value-of select="$id"/>
       
    59               <xsl:text> label:</xsl:text>
       
    60               <xsl:value-of select="$label"/>
       
    61               <xsl:text> has wrong syntax of frequency forcing </xsl:text>
       
    62               <xsl:value-of select="$freq"/>
       
    63             </xsl:message>
       
    64           </xsl:if>
    55           <xsl:attribute name="freq">
    65           <xsl:attribute name="freq">
    56             <xsl:value-of select="$freq"/>
    66             <xsl:value-of select="$freq"/>
    57           </xsl:attribute>
    67           </xsl:attribute>
    58         </xsl:if>
    68         </xsl:if>
    59         <xsl:for-each select="str:split(substring-after($args, ':'), ':')">
    69         <xsl:for-each select="str:split(substring-after($args, ':'), ':')">