19 |
19 |
20 /* This retrieves geometry obtained through "inkscape -S" |
20 /* This retrieves geometry obtained through "inkscape -S" |
21 * already parsed by python and presented as a list of |
21 * already parsed by python and presented as a list of |
22 * <bbox x="0" y="0" w="42" h="42"> |
22 * <bbox x="0" y="0" w="42" h="42"> |
23 */ |
23 */ |
24 variable "geometry", "ns:GetSVGGeometry()"; |
24 const "geometry", "ns:GetSVGGeometry()"; |
25 variable "hmitree", "ns:GetHMITree()"; |
25 const "hmitree", "ns:GetHMITree()"; |
26 |
26 |
27 variable "_categories" { |
27 const "_categories" { |
28 noindex > HMI_ROOT |
28 noindex > HMI_ROOT |
29 noindex > HMI_LABEL |
29 noindex > HMI_LABEL |
30 noindex > HMI_CLASS |
30 noindex > HMI_CLASS |
31 noindex > HMI_PLC_STATUS |
31 noindex > HMI_PLC_STATUS |
32 noindex > HMI_CURRENT_PAGE |
32 noindex > HMI_CURRENT_PAGE |
33 } |
33 } |
34 variable "categories", "exsl:node-set($_categories)"; |
34 const "categories", "exsl:node-set($_categories)"; |
35 //variable "indexed_hmitree", "$hmitree[not(local-name() = $categories/noindex/text())]"; |
35 //const "indexed_hmitree", "$hmitree[not(local-name() = $categories/noindex/text())]"; |
36 variable "indexed_hmitree" apply "$hmitree", mode="index"; |
36 const "_indexed_hmitree" apply "$hmitree", mode="index"; |
|
37 const "indexed_hmitree", "exsl:node-set($_indexed_hmitree)"; |
37 |
38 |
38 template "node()", mode="index"{ |
39 template "*", mode="index"{ |
39 param "index", "0"; |
40 param "index", "0"; |
40 variable "content" { |
41 param "parentpath", "''"; |
|
42 const "content" { |
|
43 const "path" |
|
44 choose { |
|
45 when "local-name() = 'HMI_ROOT'" > «$parentpath» |
|
46 otherwise > «$parentpath»/«@name» |
|
47 } |
41 choose { |
48 choose { |
42 when "not(local-name() = $categories/noindex)" { |
49 when "not(local-name() = $categories/noindex)" { |
43 xsl:copy { |
50 xsl:copy { |
44 attrib "index" > «$index» |
51 attrib "index" > «$index» |
|
52 attrib "hmipath" > «$path» |
45 foreach "@*" xsl:copy; |
53 foreach "@*" xsl:copy; |
46 } |
54 } |
47 /* no node expected below value nodes */ |
55 /* no node expected below value nodes */ |
48 } |
56 } |
49 otherwise { |
57 otherwise { |
50 apply "*[1]", mode="index"{ |
58 apply "*[1]", mode="index"{ |
51 with "index", "$index"; |
59 with "index", "$index"; |
|
60 with "parentpath" > «$path» |
52 } |
61 } |
53 } |
62 } |
54 } |
63 } |
55 } |
64 } |
56 |
65 |
57 copy "$content"; |
66 copy "$content"; |
58 apply "following-sibling::*[1]", mode="index" { |
67 apply "following-sibling::*[1]", mode="index" { |
59 with "index", "$index + count(exsl:node-set($content)/*)"; |
68 with "index", "$index + count(exsl:node-set($content)/*)"; |
|
69 with "parentpath" > «$parentpath» |
60 } |
70 } |
61 } |
71 } |
62 |
72 |
63 /* Identity template : |
73 /* Identity template : |
64 * - copy every attributes |
74 * - copy every attributes |
65 * - copy every sub-elements |
75 * - copy every sub-elements |
66 */ |
76 */ |
67 template "@* | node()" { |
77 template "@* | node()", mode="identity_svg" { |
68 /* use real xsl:copy instead copy-of alias from yslt.yml2 */ |
78 /* use real xsl:copy instead copy-of alias from yslt.yml2 */ |
69 xsl:copy apply "@* | node()"; |
79 xsl:copy apply "@* | node()", mode="identity_svg"; |
70 } |
80 } |
71 |
81 |
72 variable "mark" > =HMI=\n |
82 const "mark" > =HMI=\n |
73 |
83 |
74 /* copy root node and add geometry as comment for a test */ |
84 /* copy root node and add geometry as comment for a test */ |
75 template "/" |
85 template "/" |
76 html xmlns="http://www.w3.org/1999/xhtml" { |
86 html xmlns="http://www.w3.org/1999/xhtml" { |
77 head; |
87 head; |