svghmi/inline_svg.ysl2
branchsvghmi
changeset 2995 7769e7c7f925
parent 2968 556ef07a7e31
child 3027 d660b1b6bf4f
equal deleted inserted replaced
2994:b6a9ef7f7e43 2995:7769e7c7f925
    45 //    the same position in all instances
    45 //    the same position in all instances
    46 //
    46 //
    47 // For now, clone unlinkink applies to descendants of all widget except HMI:Page
    47 // For now, clone unlinkink applies to descendants of all widget except HMI:Page
    48 // TODO: narrow application of clone unlinking to active elements,
    48 // TODO: narrow application of clone unlinking to active elements,
    49 //       while keeping static decoration cloned
    49 //       while keeping static decoration cloned
    50 const "to_unlink", "$hmi_elements[not(@id = $hmi_pages)]/descendant-or-self::svg:use";
    50 const "hmi_lists_descs", "$parsed_widgets/widget[@type = 'List']";
       
    51 const "hmi_lists", "$hmi_elements[@id = $hmi_lists_descs/@id]";
       
    52 const "targets_not_to_unlink", "$hmi_elements[@id = $hmi_lists/@id]/descendant::svg:*";
       
    53 const "to_unlink", "$hmi_elements[not(@id = $hmi_pages/@id)]/descendant-or-self::svg:use";
    51 svgtmpl "svg:use", mode="inline_svg"
    54 svgtmpl "svg:use", mode="inline_svg"
    52 {
    55 {
       
    56     const "targetid","substring-after(@xlink:href,'#')";
    53     choose {
    57     choose {
    54         when "@id = $to_unlink/@id"
    58         when "@id = $to_unlink/@id and not($targetid = $targets_not_to_unlink/@id)" {
    55             call "unlink_clone";
    59             call "unlink_clone" with "targetid", "$targetid";
       
    60         }
    56         otherwise
    61         otherwise
    57             xsl:copy apply "@* | node()", mode="inline_svg";
    62             xsl:copy apply "@* | node()", mode="inline_svg";
    58     }
    63     }
    59 }
    64 }
    60 
    65 
    74     name > style
    79     name > style
    75 }
    80 }
    76 const "merge_use_attrs","exsl:node-set($_merge_use_attrs)";
    81 const "merge_use_attrs","exsl:node-set($_merge_use_attrs)";
    77 
    82 
    78 svgfunc "unlink_clone"{
    83 svgfunc "unlink_clone"{
    79     const "targetid","substring-after(@xlink:href,'#')";
    84     param "targetid";
    80     const "target", "//svg:*[@id = $targetid]";
    85     const "target", "//svg:*[@id = $targetid]";
    81     g{
    86     g{
    82         choose {
    87         choose {
    83             when "$target[self::svg:g]" {
    88             when "$target[self::svg:g]" {
    84                 foreach "@*[not(local-name() = $excluded_use_attrs/name | $merge_use_attrs)]"
    89                 foreach "@*[not(local-name() = $excluded_use_attrs/name | $merge_use_attrs)]"
   156     |
   161     |
   157     | Unlinked :
   162     | Unlinked :
   158     foreach "$to_unlink"{
   163     foreach "$to_unlink"{
   159         | «@id»
   164         | «@id»
   160     }
   165     }
       
   166     | Not to unlink :
       
   167     foreach "$targets_not_to_unlink"{
       
   168         | «@id»
       
   169     }
   161 }
   170 }