diff -r 2a97688c94c5 -r c10069a02ed0 svghmi/gen_index_xhtml.ysl2 --- a/svghmi/gen_index_xhtml.ysl2 Wed Oct 09 09:04:35 2019 +0200 +++ b/svghmi/gen_index_xhtml.ysl2 Wed Oct 09 11:15:14 2019 +0200 @@ -24,6 +24,11 @@ const "geometry", "ns:GetSVGGeometry()"; const "hmitree", "ns:GetHMITree()"; + const "hmi_elements", "//*[starts-with(@inkscape:label, 'HMI:')]"; + const "hmi_geometry", "$geometry[@Id = $hmi_elements/@id]"; + + const "hmi_pages", "$hmi_elements[func:parselabel(@inkscape:label)/widget/@type = 'Page']"; + const "_categories" { noindex > HMI_ROOT noindex > HMI_LABEL @@ -36,7 +41,7 @@ const "_indexed_hmitree" apply "$hmitree", mode="index"; const "indexed_hmitree", "exsl:node-set($_indexed_hmitree)"; - template "*", mode="index"{ + template "*", mode="index" { param "index", "0"; param "parentpath", "''"; const "content" { @@ -79,7 +84,7 @@ xsl:copy apply "@* | node()", mode="identity_svg"; } - const "mark" > =HMI=\n + /*const "mark" > =HMI=\n*/ /* copy root node and add geometry as comment for a test */ template "/" { @@ -89,7 +94,7 @@ body style="margin:0;" { xsl:copy { comment { - apply "$geometry", mode="testgeo"; + apply "$hmi_geometry", mode="testgeo"; } comment { apply "$hmitree", mode="testtree"; @@ -124,7 +129,7 @@ const "ast" if "$type" widget { attrib "type" > «$type» - foreach "str:split($args, ':')" { + foreach "str:split(substring-after($args, ':'), ':')" { arg { attrib "value" > «.» } @@ -188,11 +193,19 @@ | | var page_desc = { - // apply "//*[substring-after(substring-before(@inkscape:label, '@'), 'HMI' - foreach "//*[func:parselabel(@inkscape:label)/widget/@type = 'Page']" { - | «@inkscape:label» - const "ast", "func:parselabel(@inkscape:label)"; - apply "$ast", mode="testtree"; + foreach "$hmi_pages" { + const "desc", "func:parselabel(@inkscape:label)/widget"; + | "«$desc/arg[1]/@value»": { + | id: "«@id»" + | widgets: [ + const "page", "."; + const "p", "$hmi_geometry[@Id = $page/@id]"; + foreach """$hmi_geometry[@Id != $page/@id and + @x >= $p/@x and @y >= $p/@y and + @w <= $p/@w and @h <= $p/@h]""" { + | "«@Id»"`if "position()!=last()" > ,` + } + | ] } | }