svghmi/gen_index_xhtml.ysl2
branchsvghmi
changeset 2834 6ac6a9dff594
parent 2833 e74123b966ac
child 2836 ce6cecdb7320
equal deleted inserted replaced
2833:e74123b966ac 2834:6ac6a9dff594
   225             |     ],
   225             |     ],
   226             |     indexes: [
   226             |     indexes: [
   227             foreach "$widget/path" {
   227             foreach "$widget/path" {
   228                 const "hmipath","@value";
   228                 const "hmipath","@value";
   229                 const "hmitree_match","$indexed_hmitree/*[@hmipath = $hmipath]";
   229                 const "hmitree_match","$indexed_hmitree/*[@hmipath = $hmipath]";
   230                 if "count($hmitree_match) = 0"
   230                 choose {
   231                     error > No match for path "«$hmipath»" in HMI tree
   231                     when "count($hmitree_match) = 0" {
       
   232                         warning > No match for path "«$hmipath»" in HMI tree
       
   233                     }
       
   234                     otherwise {
   232             |         «$hmitree_match/@index»`if "position()!=last()" > ,`
   235             |         «$hmitree_match/@index»`if "position()!=last()" > ,`
       
   236                     }
       
   237                 }
   233             }
   238             }
   234             |     ],
   239             |     ],
   235             |     element: document.getElementById("«@id»"),
   240             |     element: document.getElementById("«@id»"),
   236             apply "$widget", mode="widget_defs" with "hmi_element",".";
   241             apply "$widget", mode="widget_defs" with "hmi_element",".";
   237             | }`if "position()!=last()" > ,`
   242             | }`if "position()!=last()" > ,`
   326 
   331 
   327     function "defs_by_labels" {
   332     function "defs_by_labels" {
   328         param "labels","''";
   333         param "labels","''";
   329         param "mandatory","'yes'";
   334         param "mandatory","'yes'";
   330         param "hmi_element";
   335         param "hmi_element";
       
   336         const "widget_type","@type";
   331         foreach "str:split($labels)" {
   337         foreach "str:split($labels)" {
   332             const "name",".";
   338             const "name",".";
   333             const "elt_id","$hmi_element//*[@inkscape:label=$name][1]/@id";
   339             const "elt_id","$hmi_element//*[@inkscape:label=$name][1]/@id";
   334             if "$mandatory='yes' and not($elt_id)" error > Meter widget must have a «$name» element
   340             if "$mandatory='yes' and not($elt_id)"
       
   341                 warning > «$widget_type» widget must have a «$name» element
   335             | «$name»_elt: document.getElementById("«$elt_id»"),
   342             | «$name»_elt: document.getElementById("«$elt_id»"),
   336         }
   343         }
   337     }
   344     }
   338 
   345 
   339 
   346 
   345             when "$hmi_element[self::svg:text]"{
   352             when "$hmi_element[self::svg:text]"{
   346             // TODO : care about <tspan> ?
   353             // TODO : care about <tspan> ?
   347         |   this.element.textContent = String(value);
   354         |   this.element.textContent = String(value);
   348             }
   355             }
   349             otherwise {
   356             otherwise {
   350                 error > Display widget as a group not implemented
   357                 warning > Display widget as a group not implemented
   351             }
   358             }
   352         }
   359         }
   353         | },
   360         | },
   354 
   361 
   355     }
   362     }