svghmi/gen_index_xhtml.xslt
changeset 3355 b16e9561a3c1
parent 3299 8b45d8494fae
child 3326 18d743e517b5
equal deleted inserted replaced
3354:819b0bdfa705 3355:b16e9561a3c1
   430     <xsl:param name="elt"/>
   430     <xsl:param name="elt"/>
   431     <xsl:variable name="g" select="$geometry[@Id = $elt/@id]"/>
   431     <xsl:variable name="g" select="$geometry[@Id = $elt/@id]"/>
   432     <xsl:variable name="candidates" select="$geometry[@Id != $elt/@id]"/>
   432     <xsl:variable name="candidates" select="$geometry[@Id != $elt/@id]"/>
   433     <func:result select="$candidates[(@Id = $groups/@id and (func:intersect($g, .) = 9)) or &#10;                          (not(@Id = $groups/@id) and (func:intersect($g, .) &gt; 0 ))]"/>
   433     <func:result select="$candidates[(@Id = $groups/@id and (func:intersect($g, .) = 9)) or &#10;                          (not(@Id = $groups/@id) and (func:intersect($g, .) &gt; 0 ))]"/>
   434   </func:function>
   434   </func:function>
       
   435   <xsl:variable name="hmi_lists_descs" select="$parsed_widgets/widget[@type = 'List']"/>
       
   436   <xsl:variable name="hmi_lists" select="$hmi_elements[@id = $hmi_lists_descs/@id]"/>
       
   437   <xsl:variable name="hmi_textlists_descs" select="$parsed_widgets/widget[@type = 'TextList']"/>
       
   438   <xsl:variable name="hmi_textlists" select="$hmi_elements[@id = $hmi_textlists_descs/@id]"/>
       
   439   <xsl:variable name="hmi_textstylelists_descs" select="$parsed_widgets/widget[@type = 'TextStyleList']"/>
       
   440   <xsl:variable name="hmi_textstylelists" select="$hmi_elements[@id = $hmi_textstylelists_descs/@id]"/>
       
   441   <xsl:variable name="textstylelist_related">
       
   442     <xsl:for-each select="$hmi_textstylelists">
       
   443       <list>
       
   444         <xsl:attribute name="listid">
       
   445           <xsl:value-of select="@id"/>
       
   446         </xsl:attribute>
       
   447         <xsl:for-each select="func:refered_elements(.)">
       
   448           <elt>
       
   449             <xsl:attribute name="eltid">
       
   450               <xsl:value-of select="@id"/>
       
   451             </xsl:attribute>
       
   452           </elt>
       
   453         </xsl:for-each>
       
   454       </list>
       
   455     </xsl:for-each>
       
   456   </xsl:variable>
       
   457   <xsl:variable name="textstylelist_related_ns" select="exsl:node-set($textstylelist_related)"/>
   435   <xsl:variable name="hmi_pages_descs" select="$parsed_widgets/widget[@type = 'Page']"/>
   458   <xsl:variable name="hmi_pages_descs" select="$parsed_widgets/widget[@type = 'Page']"/>
   436   <xsl:variable name="hmi_pages" select="$hmi_elements[@id = $hmi_pages_descs/@id]"/>
   459   <xsl:variable name="hmi_pages" select="$hmi_elements[@id = $hmi_pages_descs/@id]"/>
   437   <xsl:variable name="default_page">
   460   <xsl:variable name="default_page">
   438     <xsl:choose>
   461     <xsl:choose>
   439       <xsl:when test="count($hmi_pages) &gt; 1">
   462       <xsl:when test="count($hmi_pages) &gt; 1">
   524         <func:result select="/.."/>
   547         <func:result select="/.."/>
   525       </xsl:otherwise>
   548       </xsl:otherwise>
   526     </xsl:choose>
   549     </xsl:choose>
   527   </func:function>
   550   </func:function>
   528   <xsl:variable name="required_page_elements" select="func:required_elements($hmi_pages | $keypads)/ancestor-or-self::svg:*"/>
   551   <xsl:variable name="required_page_elements" select="func:required_elements($hmi_pages | $keypads)/ancestor-or-self::svg:*"/>
   529   <xsl:variable name="hmi_lists_descs" select="$parsed_widgets/widget[@type = 'List']"/>
   552   <xsl:variable name="required_list_elements" select="func:refered_elements(($hmi_lists | $hmi_textlists)[@id = $required_page_elements/@id])"/>
   530   <xsl:variable name="hmi_lists" select="$hmi_elements[@id = $hmi_lists_descs/@id]"/>
       
   531   <xsl:variable name="required_list_elements" select="func:refered_elements($hmi_lists[@id = $required_page_elements/@id])"/>
       
   532   <xsl:variable name="required_elements" select="$defs | $required_list_elements | $required_page_elements"/>
   553   <xsl:variable name="required_elements" select="$defs | $required_list_elements | $required_page_elements"/>
   533   <xsl:variable name="discardable_elements" select="//svg:*[not(@id = $required_elements/@id)]"/>
   554   <xsl:variable name="discardable_elements" select="//svg:*[not(@id = $required_elements/@id)]"/>
   534   <func:function name="func:sumarized_elements">
   555   <func:function name="func:sumarized_elements">
   535     <xsl:param name="elements"/>
   556     <xsl:param name="elements"/>
   536     <xsl:variable name="short_list" select="$elements[not(ancestor::*/@id = $elements/@id)]"/>
   557     <xsl:variable name="short_list" select="$elements[not(ancestor::*/@id = $elements/@id)]"/>
  1881       <xsl:otherwise>
  1902       <xsl:otherwise>
  1882         <func:result select="$txt"/>
  1903         <func:result select="$txt"/>
  1883       </xsl:otherwise>
  1904       </xsl:otherwise>
  1884     </xsl:choose>
  1905     </xsl:choose>
  1885   </func:function>
  1906   </func:function>
       
  1907   <func:function name="func:reverse">
       
  1908     <xsl:param name="content"/>
       
  1909     <xsl:choose>
       
  1910       <xsl:when test="count($content) &gt; 0">
       
  1911         <func:result select="func:reverse($content[position() &gt; 1]) | $content[1]"/>
       
  1912       </xsl:when>
       
  1913       <xsl:otherwise>
       
  1914         <func:result select="/.."/>
       
  1915       </xsl:otherwise>
       
  1916     </xsl:choose>
       
  1917   </func:function>
  1886   <xsl:template match="widget[@type='Animate']" mode="widget_class">
  1918   <xsl:template match="widget[@type='Animate']" mode="widget_class">
  1887     <xsl:text>class </xsl:text>
  1919     <xsl:text>class </xsl:text>
  1888     <xsl:text>AnimateWidget</xsl:text>
  1920     <xsl:text>AnimateWidget</xsl:text>
  1889     <xsl:text> extends Widget{
  1921     <xsl:text> extends Widget{
  1890 </xsl:text>
  1922 </xsl:text>
  3713 </xsl:text>
  3745 </xsl:text>
  3714       <xsl:text>arguments. Single variable path is index of selection.
  3746       <xsl:text>arguments. Single variable path is index of selection.
  3715 </xsl:text>
  3747 </xsl:text>
  3716       <xsl:text>
  3748       <xsl:text>
  3717 </xsl:text>
  3749 </xsl:text>
  3718       <xsl:text>It needs "text" (svg:text), "box" (svg:rect), "button" (svg:*),
  3750       <xsl:text>It needs "text" (svg:text or svg:use referring to svg:text),
  3719 </xsl:text>
  3751 </xsl:text>
  3720       <xsl:text>and "highlight" (svg:rect) labeled elements.
  3752       <xsl:text>"box" (svg:rect), "button" (svg:*), and "highlight" (svg:rect)
       
  3753 </xsl:text>
       
  3754       <xsl:text>labeled elements.
  3721 </xsl:text>
  3755 </xsl:text>
  3722       <xsl:text>
  3756       <xsl:text>
  3723 </xsl:text>
  3757 </xsl:text>
  3724       <xsl:text>When user clicks on "button", "text" is duplicated to display enties in the
  3758       <xsl:text>When user clicks on "button", "text" is duplicated to display enties in the
  3725 </xsl:text>
  3759 </xsl:text>
  3727 </xsl:text>
  3761 </xsl:text>
  3728       <xsl:text>texts. "highlight" is moved over pre-selected entry.
  3762       <xsl:text>texts. "highlight" is moved over pre-selected entry.
  3729 </xsl:text>
  3763 </xsl:text>
  3730       <xsl:text>
  3764       <xsl:text>
  3731 </xsl:text>
  3765 </xsl:text>
  3732       <xsl:text>When only one argument is given, and argment contains "#langs" then list of
  3766       <xsl:text>When only one argument is given and argment contains "#langs" then list of
  3733 </xsl:text>
  3767 </xsl:text>
  3734       <xsl:text>texts is automatically set to the list of human-readable languages supported
  3768       <xsl:text>texts is automatically set to the human-readable list of supported
  3735 </xsl:text>
  3769 </xsl:text>
  3736       <xsl:text>by this HMI. 
  3770       <xsl:text>languages by this HMI. 
       
  3771 </xsl:text>
       
  3772       <xsl:text>
       
  3773 </xsl:text>
       
  3774       <xsl:text>If "text" labeled element is of type svg:use and refers to a svg:text 
       
  3775 </xsl:text>
       
  3776       <xsl:text>element part of a TextList widget, no argument is expected. In that case
       
  3777 </xsl:text>
       
  3778       <xsl:text>list of texts is set to TextList content.
  3737 </xsl:text>
  3779 </xsl:text>
  3738     </longdesc>
  3780     </longdesc>
  3739     <shortdesc>
  3781     <shortdesc>
  3740       <xsl:text>Let user select text entry in a drop-down menu</xsl:text>
  3782       <xsl:text>Let user select text entry in a drop-down menu</xsl:text>
  3741     </shortdesc>
  3783     </shortdesc>
  3757 </xsl:text>
  3799 </xsl:text>
  3758     <xsl:text>        }
  3800     <xsl:text>        }
  3759 </xsl:text>
  3801 </xsl:text>
  3760     <xsl:text>        init() {
  3802     <xsl:text>        init() {
  3761 </xsl:text>
  3803 </xsl:text>
       
  3804     <xsl:text>            this.init_specific();
       
  3805 </xsl:text>
  3762     <xsl:text>            this.button_elt.onclick = this.on_button_click.bind(this);
  3806     <xsl:text>            this.button_elt.onclick = this.on_button_click.bind(this);
  3763 </xsl:text>
  3807 </xsl:text>
  3764     <xsl:text>            // Save original size of rectangle
  3808     <xsl:text>            // Save original size of rectangle
  3765 </xsl:text>
  3809 </xsl:text>
  3766     <xsl:text>            this.box_bbox = this.box_elt.getBBox()
  3810     <xsl:text>            this.box_bbox = this.box_elt.getBBox()
  3847 </xsl:text>
  3891 </xsl:text>
  3848     <xsl:text>            if(value &gt;= 0 &amp;&amp; value &lt; this.content.length){
  3892     <xsl:text>            if(value &gt;= 0 &amp;&amp; value &lt; this.content.length){
  3849 </xsl:text>
  3893 </xsl:text>
  3850     <xsl:text>                // if valid selection resolve content
  3894     <xsl:text>                // if valid selection resolve content
  3851 </xsl:text>
  3895 </xsl:text>
  3852     <xsl:text>                display_str = this.content[value];
  3896     <xsl:text>                display_str = gettext(this.content[value]);
  3853 </xsl:text>
  3897 </xsl:text>
  3854     <xsl:text>                this.last_selection = value;
  3898     <xsl:text>                this.last_selection = value;
  3855 </xsl:text>
  3899 </xsl:text>
  3856     <xsl:text>            } else {
  3900     <xsl:text>            } else {
  3857 </xsl:text>
  3901 </xsl:text>
  4059 </xsl:text>
  4103 </xsl:text>
  4060     <xsl:text>            for(let item of this.content){
  4104     <xsl:text>            for(let item of this.content){
  4061 </xsl:text>
  4105 </xsl:text>
  4062     <xsl:text>                let span=spans[c];
  4106     <xsl:text>                let span=spans[c];
  4063 </xsl:text>
  4107 </xsl:text>
  4064     <xsl:text>                span.textContent = item;
  4108     <xsl:text>                span.textContent = gettext(item);
  4065 </xsl:text>
  4109 </xsl:text>
  4066     <xsl:text>                let sel = c;
  4110     <xsl:text>                let sel = c;
  4067 </xsl:text>
  4111 </xsl:text>
  4068     <xsl:text>                this.make_clickable(span, (evt) =&gt; this.bound_on_selection_click(sel));
  4112     <xsl:text>                this.make_clickable(span, (evt) =&gt; this.bound_on_selection_click(sel));
  4069 </xsl:text>
  4113 </xsl:text>
  4191 </xsl:text>
  4235 </xsl:text>
  4192     <xsl:text>                // otherwise normal content
  4236     <xsl:text>                // otherwise normal content
  4193 </xsl:text>
  4237 </xsl:text>
  4194     <xsl:text>                }else{
  4238     <xsl:text>                }else{
  4195 </xsl:text>
  4239 </xsl:text>
  4196     <xsl:text>                    span.textContent = this.content[i];
  4240     <xsl:text>                    span.textContent = gettext(this.content[i]);
  4197 </xsl:text>
  4241 </xsl:text>
  4198     <xsl:text>                    let sel = i;
  4242     <xsl:text>                    let sel = i;
  4199 </xsl:text>
  4243 </xsl:text>
  4200     <xsl:text>                    onclickfunc = (evt) =&gt; this.bound_on_selection_click(sel);
  4244     <xsl:text>                    onclickfunc = (evt) =&gt; this.bound_on_selection_click(sel);
  4201 </xsl:text>
  4245 </xsl:text>
  4409   <xsl:template match="widget[@type='DropDown']" mode="widget_defs">
  4453   <xsl:template match="widget[@type='DropDown']" mode="widget_defs">
  4410     <xsl:param name="hmi_element"/>
  4454     <xsl:param name="hmi_element"/>
  4411     <xsl:call-template name="defs_by_labels">
  4455     <xsl:call-template name="defs_by_labels">
  4412       <xsl:with-param name="hmi_element" select="$hmi_element"/>
  4456       <xsl:with-param name="hmi_element" select="$hmi_element"/>
  4413       <xsl:with-param name="labels">
  4457       <xsl:with-param name="labels">
  4414         <xsl:text>text box button highlight</xsl:text>
  4458         <xsl:text>box button highlight</xsl:text>
  4415       </xsl:with-param>
  4459       </xsl:with-param>
  4416     </xsl:call-template>
  4460     </xsl:call-template>
  4417     <xsl:text>  content:</xsl:text>
  4461     <xsl:variable name="text_elt" select="$hmi_element//*[@inkscape:label='text'][1]"/>
       
  4462     <xsl:text>init_specific: function() {
       
  4463 </xsl:text>
  4418     <xsl:choose>
  4464     <xsl:choose>
  4419       <xsl:when test="count(arg) = 1 and arg[1]/@value = '#langs'">
  4465       <xsl:when test="count(arg) = 1 and arg[1]/@value = '#langs'">
  4420         <xsl:text>langs</xsl:text>
  4466         <xsl:text>  this.text_elt = id("</xsl:text>
       
  4467         <xsl:value-of select="$text_elt/@id"/>
       
  4468         <xsl:text>");
       
  4469 </xsl:text>
       
  4470         <xsl:text>  this.content = langs;
       
  4471 </xsl:text>
       
  4472       </xsl:when>
       
  4473       <xsl:when test="count(arg) = 0">
       
  4474         <xsl:if test="not($text_elt[self::svg:use])">
       
  4475           <xsl:message terminate="yes">
       
  4476             <xsl:text>No argrument for HMI:DropDown widget id="</xsl:text>
       
  4477             <xsl:value-of select="$hmi_element/@id"/>
       
  4478             <xsl:text>" and "text" labeled element is not a svg:use element</xsl:text>
       
  4479           </xsl:message>
       
  4480         </xsl:if>
       
  4481         <xsl:variable name="real_text_elt" select="$result_widgets[@id = $hmi_element/@id]//*[@original=$text_elt/@id]/svg:text"/>
       
  4482         <xsl:text>  this.text_elt = id("</xsl:text>
       
  4483         <xsl:value-of select="$real_text_elt/@id"/>
       
  4484         <xsl:text>");
       
  4485 </xsl:text>
       
  4486         <xsl:variable name="from_list_id" select="substring-after($text_elt/@xlink:href,'#')"/>
       
  4487         <xsl:variable name="from_list" select="$hmi_textlists[(@id | */@id) = $from_list_id]"/>
       
  4488         <xsl:if test="count($from_list) = 0">
       
  4489           <xsl:message terminate="yes">
       
  4490             <xsl:text>HMI:DropDown widget id="</xsl:text>
       
  4491             <xsl:value-of select="$hmi_element/@id"/>
       
  4492             <xsl:text>" "text" labeled element does not point to a svg:text owned by a HMI:List widget</xsl:text>
       
  4493           </xsl:message>
       
  4494         </xsl:if>
       
  4495         <xsl:text>  this.content = hmi_widgets["</xsl:text>
       
  4496         <xsl:value-of select="$from_list/@id"/>
       
  4497         <xsl:text>"].texts;
       
  4498 </xsl:text>
  4421       </xsl:when>
  4499       </xsl:when>
  4422       <xsl:otherwise>
  4500       <xsl:otherwise>
  4423         <xsl:text>[
  4501         <xsl:text>  this.text_elt = id("</xsl:text>
       
  4502         <xsl:value-of select="$text_elt/@id"/>
       
  4503         <xsl:text>");
       
  4504 </xsl:text>
       
  4505         <xsl:text>  this.content = [
  4424 </xsl:text>
  4506 </xsl:text>
  4425         <xsl:for-each select="arg">
  4507         <xsl:for-each select="arg">
  4426           <xsl:text>"</xsl:text>
  4508           <xsl:text>"</xsl:text>
  4427           <xsl:value-of select="@value"/>
  4509           <xsl:value-of select="@value"/>
  4428           <xsl:text>",
  4510           <xsl:text>",
  4429 </xsl:text>
  4511 </xsl:text>
  4430         </xsl:for-each>
  4512         </xsl:for-each>
  4431         <xsl:text>  ]</xsl:text>
  4513         <xsl:text>  ];
       
  4514 </xsl:text>
  4432       </xsl:otherwise>
  4515       </xsl:otherwise>
  4433     </xsl:choose>
  4516     </xsl:choose>
  4434     <xsl:text>,
  4517     <xsl:text>}
       
  4518 </xsl:text>
       
  4519   </xsl:template>
       
  4520   <declarations:DropDown/>
       
  4521   <xsl:template match="declarations:DropDown">
       
  4522     <xsl:text>
       
  4523 </xsl:text>
       
  4524     <xsl:text>/* </xsl:text>
       
  4525     <xsl:value-of select="local-name()"/>
       
  4526     <xsl:text> */
       
  4527 </xsl:text>
       
  4528     <xsl:text>
       
  4529 </xsl:text>
       
  4530     <xsl:text>function gettext(o) {
       
  4531 </xsl:text>
       
  4532     <xsl:text>    if(typeof(o) == "string"){
       
  4533 </xsl:text>
       
  4534     <xsl:text>        return o;
       
  4535 </xsl:text>
       
  4536     <xsl:text>    }
       
  4537 </xsl:text>
       
  4538     <xsl:text>    return svg_text_to_multiline(o);
       
  4539 </xsl:text>
       
  4540     <xsl:text>};
       
  4541 </xsl:text>
       
  4542     <xsl:text>
  4435 </xsl:text>
  4543 </xsl:text>
  4436   </xsl:template>
  4544   </xsl:template>
  4437   <xsl:template match="widget[@type='ForEach']" mode="widget_desc">
  4545   <xsl:template match="widget[@type='ForEach']" mode="widget_desc">
  4438     <type>
  4546     <type>
  4439       <xsl:value-of select="@type"/>
  4547       <xsl:value-of select="@type"/>
  5114       <xsl:text>JsonTable Widget can't contain element of type </xsl:text>
  5222       <xsl:text>JsonTable Widget can't contain element of type </xsl:text>
  5115       <xsl:value-of select="local-name()"/>
  5223       <xsl:value-of select="local-name()"/>
  5116       <xsl:text>.</xsl:text>
  5224       <xsl:text>.</xsl:text>
  5117     </xsl:message>
  5225     </xsl:message>
  5118   </xsl:template>
  5226   </xsl:template>
  5119   <xsl:variable name="hmi_textstylelists_descs" select="$parsed_widgets/widget[@type = 'TextStyleList']"/>
       
  5120   <xsl:variable name="hmi_textstylelists" select="$hmi_elements[@id = $hmi_textstylelists_descs/@id]"/>
       
  5121   <xsl:variable name="textstylelist_related">
       
  5122     <xsl:for-each select="$hmi_textstylelists">
       
  5123       <list>
       
  5124         <xsl:attribute name="listid">
       
  5125           <xsl:value-of select="@id"/>
       
  5126         </xsl:attribute>
       
  5127         <xsl:for-each select="func:refered_elements(.)">
       
  5128           <elt>
       
  5129             <xsl:attribute name="eltid">
       
  5130               <xsl:value-of select="@id"/>
       
  5131             </xsl:attribute>
       
  5132           </elt>
       
  5133         </xsl:for-each>
       
  5134       </list>
       
  5135     </xsl:for-each>
       
  5136   </xsl:variable>
       
  5137   <xsl:variable name="textstylelist_related_ns" select="exsl:node-set($textstylelist_related)"/>
       
  5138   <func:function name="func:json_expressions">
  5227   <func:function name="func:json_expressions">
  5139     <xsl:param name="expressions"/>
  5228     <xsl:param name="expressions"/>
  5140     <xsl:param name="label"/>
  5229     <xsl:param name="label"/>
  5141     <xsl:choose>
  5230     <xsl:choose>
  5142       <xsl:when test="$label">
  5231       <xsl:when test="$label">
  6007   </xsl:template>
  6096   </xsl:template>
  6008   <xsl:template match="widget[@type='List']" mode="widget_desc">
  6097   <xsl:template match="widget[@type='List']" mode="widget_desc">
  6009     <type>
  6098     <type>
  6010       <xsl:value-of select="@type"/>
  6099       <xsl:value-of select="@type"/>
  6011     </type>
  6100     </type>
       
  6101     <longdesc>
       
  6102       <xsl:text>List widget is a svg:group, list items are labeled elements
       
  6103 </xsl:text>
       
  6104       <xsl:text>in that group.
       
  6105 </xsl:text>
       
  6106       <xsl:text>
       
  6107 </xsl:text>
       
  6108       <xsl:text>To use a List, clone (svg:use) one of the items inside the widget that
       
  6109 </xsl:text>
       
  6110       <xsl:text>expects a List.
       
  6111 </xsl:text>
       
  6112       <xsl:text>
       
  6113 </xsl:text>
       
  6114       <xsl:text>Positions of items are relative to each other, and they must all be in the
       
  6115 </xsl:text>
       
  6116       <xsl:text>same place. In order to make editing easier it is therefore recommanded to
       
  6117 </xsl:text>
       
  6118       <xsl:text>make stacked clones of svg elements spread nearby the list.
       
  6119 </xsl:text>
       
  6120     </longdesc>
       
  6121     <shortdesc>
       
  6122       <xsl:text>A named list of named graphical elements</xsl:text>
       
  6123     </shortdesc>
       
  6124     <arg name="listname"/>
  6012   </xsl:template>
  6125   </xsl:template>
  6013   <xsl:template match="widget[@type='List']" mode="widget_defs">
  6126   <xsl:template match="widget[@type='List']" mode="widget_defs">
  6014     <xsl:param name="hmi_element"/>
  6127     <xsl:param name="hmi_element"/>
  6015     <xsl:text>    items: {
  6128     <xsl:text>    items: {
  6016 </xsl:text>
  6129 </xsl:text>
  6017     <xsl:for-each select="$hmi_element/*[@inkscape:label]">
  6130     <xsl:for-each select="$hmi_element/*[@inkscape:label]">
  6018       <xsl:text>        </xsl:text>
  6131       <xsl:text>        </xsl:text>
  6019       <xsl:value-of select="@inkscape:label"/>
  6132       <xsl:value-of select="@inkscape:label"/>
  6020       <xsl:text>: "</xsl:text>
  6133       <xsl:text>: "</xsl:text>
  6021       <xsl:value-of select="@id"/>
  6134       <xsl:value-of select="@id"/>
  6022       <xsl:text>",
       
  6023 </xsl:text>
       
  6024     </xsl:for-each>
       
  6025     <xsl:text>    },
       
  6026 </xsl:text>
       
  6027   </xsl:template>
       
  6028   <xsl:template match="widget[@type='TextStyleList']" mode="widget_defs">
       
  6029     <xsl:param name="hmi_element"/>
       
  6030   </xsl:template>
       
  6031   <xsl:template match="widget[@type='TextStyleList']" mode="widget_defs">
       
  6032     <xsl:param name="hmi_element"/>
       
  6033     <xsl:text>    styles: {
       
  6034 </xsl:text>
       
  6035     <xsl:for-each select="$hmi_element/*[@inkscape:label]">
       
  6036       <xsl:variable name="style" select="func:refered_elements(.)[self::svg:text]/@style"/>
       
  6037       <xsl:text>        </xsl:text>
       
  6038       <xsl:value-of select="@inkscape:label"/>
       
  6039       <xsl:text>: "</xsl:text>
       
  6040       <xsl:value-of select="$style"/>
       
  6041       <xsl:text>",
  6135       <xsl:text>",
  6042 </xsl:text>
  6136 </xsl:text>
  6043     </xsl:for-each>
  6137     </xsl:for-each>
  6044     <xsl:text>    },
  6138     <xsl:text>    },
  6045 </xsl:text>
  6139 </xsl:text>
  7330 </xsl:text>
  7424 </xsl:text>
  7331     </xsl:for-each>
  7425     </xsl:for-each>
  7332     <xsl:text>    ],
  7426     <xsl:text>    ],
  7333 </xsl:text>
  7427 </xsl:text>
  7334   </xsl:template>
  7428   </xsl:template>
       
  7429   <xsl:template match="widget[@type='TextList']" mode="widget_desc">
       
  7430     <type>
       
  7431       <xsl:value-of select="@type"/>
       
  7432     </type>
       
  7433     <longdesc>
       
  7434       <xsl:text>TextList widget is a svg:group, list items are labeled elements
       
  7435 </xsl:text>
       
  7436       <xsl:text>in that group.
       
  7437 </xsl:text>
       
  7438       <xsl:text>
       
  7439 </xsl:text>
       
  7440       <xsl:text>To use a TextList, clone (svg:use) one of the items inside the widget 
       
  7441 </xsl:text>
       
  7442       <xsl:text>that expects a TextList.
       
  7443 </xsl:text>
       
  7444       <xsl:text>
       
  7445 </xsl:text>
       
  7446       <xsl:text>In this list, (translated) text content is what matters. Nevertheless
       
  7447 </xsl:text>
       
  7448       <xsl:text>text style of the cloned item will be applied in client widget.
       
  7449 </xsl:text>
       
  7450     </longdesc>
       
  7451     <shortdesc>
       
  7452       <xsl:text>A named list of ordered texts </xsl:text>
       
  7453     </shortdesc>
       
  7454     <arg name="listname"/>
       
  7455   </xsl:template>
       
  7456   <xsl:template match="widget[@type='TextList']" mode="widget_defs">
       
  7457     <xsl:param name="hmi_element"/>
       
  7458     <xsl:text>    texts: [
       
  7459 </xsl:text>
       
  7460     <xsl:for-each select="func:refered_elements($hmi_element/*[@inkscape:label])[self::svg:text]">
       
  7461       <xsl:text>        id("</xsl:text>
       
  7462       <xsl:value-of select="@id"/>
       
  7463       <xsl:text>"),
       
  7464 </xsl:text>
       
  7465     </xsl:for-each>
       
  7466     <xsl:text>    ].reverse(),
       
  7467 </xsl:text>
       
  7468   </xsl:template>
       
  7469   <xsl:template match="widget[@type='TextStyleList']" mode="widget_desc">
       
  7470     <type>
       
  7471       <xsl:value-of select="@type"/>
       
  7472     </type>
       
  7473     <longdesc>
       
  7474       <xsl:text>TextStyleList widget is a svg:group, list items are labeled elements
       
  7475 </xsl:text>
       
  7476       <xsl:text>in that group.
       
  7477 </xsl:text>
       
  7478       <xsl:text>
       
  7479 </xsl:text>
       
  7480       <xsl:text>To use a TextStyleList, clone (svg:use) one of the items inside the widget 
       
  7481 </xsl:text>
       
  7482       <xsl:text>that expects a TextStyleList.
       
  7483 </xsl:text>
       
  7484       <xsl:text>
       
  7485 </xsl:text>
       
  7486       <xsl:text>In this list, only style matters. Text content is ignored.
       
  7487 </xsl:text>
       
  7488     </longdesc>
       
  7489     <shortdesc>
       
  7490       <xsl:text>A named list of named texts</xsl:text>
       
  7491     </shortdesc>
       
  7492     <arg name="listname"/>
       
  7493   </xsl:template>
       
  7494   <xsl:template match="widget[@type='TextStyleList']" mode="widget_defs">
       
  7495     <xsl:param name="hmi_element"/>
       
  7496     <xsl:text>    styles: {
       
  7497 </xsl:text>
       
  7498     <xsl:for-each select="$hmi_element/*[@inkscape:label]">
       
  7499       <xsl:variable name="style" select="func:refered_elements(.)[self::svg:text]/@style"/>
       
  7500       <xsl:text>        </xsl:text>
       
  7501       <xsl:value-of select="@inkscape:label"/>
       
  7502       <xsl:text>: "</xsl:text>
       
  7503       <xsl:value-of select="$style"/>
       
  7504       <xsl:text>",
       
  7505 </xsl:text>
       
  7506     </xsl:for-each>
       
  7507     <xsl:text>    },
       
  7508 </xsl:text>
       
  7509   </xsl:template>
  7335   <xsl:template match="widget[@type='ToggleButton']" mode="widget_desc">
  7510   <xsl:template match="widget[@type='ToggleButton']" mode="widget_desc">
  7336     <type>
  7511     <type>
  7337       <xsl:value-of select="@type"/>
  7512       <xsl:value-of select="@type"/>
  7338     </type>
  7513     </type>
  7339     <longdesc>
  7514     <longdesc>