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 "hmi_lists_descs", "$parsed_widgets/widget[@type = 'List']"; |
50 const "hmi_lists_descs", "$parsed_widgets/widget[@type = 'List']"; |
51 const "hmi_lists", "$hmi_elements[@id = $hmi_lists_descs/@id]"; |
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:*"; |
52 const "targets_not_to_unlink", "$hmi_lists/descendant-or-self::svg:*"; |
53 const "to_unlink", "$hmi_elements[not(@id = $hmi_pages/@id)]/descendant-or-self::svg:use"; |
53 const "to_unlink", "$hmi_elements[not(@id = $hmi_pages/@id)]/descendant-or-self::svg:use"; |
54 svgtmpl "svg:use", mode="inline_svg" |
54 svgtmpl "svg:use", mode="inline_svg" |
55 { |
55 { |
|
56 param "seed"; |
56 const "targetid","substring-after(@xlink:href,'#')"; |
57 const "targetid","substring-after(@xlink:href,'#')"; |
57 choose { |
58 choose { |
58 when "@id = $to_unlink/@id and not($targetid = $targets_not_to_unlink/@id)" { |
59 when "@id = $to_unlink/@id and not($targetid = $targets_not_to_unlink/@id)" { |
59 call "unlink_clone" with "targetid", "$targetid"; |
60 call "unlink_clone" { |
|
61 with "targetid", "$targetid"; |
|
62 with "seed","$seed"; |
|
63 } |
60 } |
64 } |
61 otherwise |
65 otherwise |
62 xsl:copy apply "@* | node()", mode="inline_svg"; |
66 xsl:copy apply "@* | node()", mode="inline_svg"; |
63 } |
67 } |
64 } |
68 } |
80 } |
85 } |
81 const "merge_use_attrs","exsl:node-set($_merge_use_attrs)"; |
86 const "merge_use_attrs","exsl:node-set($_merge_use_attrs)"; |
82 |
87 |
83 svgfunc "unlink_clone"{ |
88 svgfunc "unlink_clone"{ |
84 param "targetid"; |
89 param "targetid"; |
|
90 param "seed"; |
85 const "target", "//svg:*[@id = $targetid]"; |
91 const "target", "//svg:*[@id = $targetid]"; |
|
92 const "seeded_id","concat($seed, @id)"; |
86 g{ |
93 g{ |
|
94 attrib "id" value "$seeded_id"; |
87 choose { |
95 choose { |
88 when "$target[self::svg:g]" { |
96 when "$target[self::svg:g]" { |
89 foreach "@*[not(local-name() = $excluded_use_attrs/name | $merge_use_attrs)]" |
97 foreach "@*[not(local-name() = $excluded_use_attrs/name | $merge_use_attrs)]" |
90 attrib "{name()}" > «.» |
98 attrib "{name()}" > «.» |
91 |
99 |
102 if "@transform and $target/@transform" > |
110 if "@transform and $target/@transform" > |
103 > «$target/@transform» |
111 > «$target/@transform» |
104 } |
112 } |
105 |
113 |
106 apply "$target/*", mode="unlink_clone"{ |
114 apply "$target/*", mode="unlink_clone"{ |
107 with "seed","@id"; |
115 with "seed","concat($seed, @id)"; |
108 } |
116 } |
109 } |
117 } |
110 otherwise { |
118 otherwise { |
111 // include non excluded attributes |
119 // include non excluded attributes |
112 foreach "@*[not(local-name() = $excluded_use_attrs/name)]" |
120 foreach "@*[not(local-name() = $excluded_use_attrs/name)]" |
113 attrib "{name()}" > «.» |
121 attrib "{name()}" > «.» |
114 |
122 |
115 apply "$target", mode="unlink_clone"{ |
123 apply "$target", mode="unlink_clone"{ |
116 with "seed","@id"; |
124 with "seed","concat($seed, @id)"; |
117 } |
125 } |
118 } |
126 } |
119 } |
127 } |
120 } |
128 } |
121 } |
129 } |
126 param "seed"; |
134 param "seed"; |
127 attrib "id" > «$seed»_«.» |
135 attrib "id" > «$seed»_«.» |
128 } |
136 } |
129 |
137 |
130 svgtmpl "@*", mode="unlink_clone" xsl:copy; |
138 svgtmpl "@*", mode="unlink_clone" xsl:copy; |
|
139 |
|
140 svgtmpl "svg:use", mode="unlink_clone" { |
|
141 param "seed"; |
|
142 apply "." mode="inline_svg" with "seed","concat($seed, '_')"; |
|
143 } |
131 |
144 |
132 // copying widgets would have unwanted effect |
145 // copying widgets would have unwanted effect |
133 // instead widget is refered through a svg:use. |
146 // instead widget is refered through a svg:use. |
134 svgtmpl "svg:*", mode="unlink_clone" { |
147 svgtmpl "svg:*", mode="unlink_clone" { |
135 param "seed"; |
148 param "seed"; |