svghmi/gen_index_xhtml.ysl2
branchsvghmi
changeset 2875 6a12e1084deb
parent 2874 b67af0b8dc72
child 2876 d2adbc273125
equal deleted inserted replaced
2874:b67af0b8dc72 2875:6a12e1084deb
    63         noindex > HMI_PLC_STATUS
    63         noindex > HMI_PLC_STATUS
    64         noindex > HMI_CURRENT_PAGE
    64         noindex > HMI_CURRENT_PAGE
    65     }
    65     }
    66     const "categories", "exsl:node-set($_categories)";
    66     const "categories", "exsl:node-set($_categories)";
    67 
    67 
    68 
       
    69     // returns all directly or indirectly refered elements
       
    70     def "func:refered_elements" {
       
    71         param "elems";
       
    72         const "descend", "$elems/descendant-or-self::svg:*";
       
    73         const "clones", "$descend[self::svg:use]";
       
    74         const "originals", "//svg:*[concat('#',@id) = $clones/@xlink:href]";
       
    75         choose {
       
    76             when "$originals"
       
    77                 result "$descend | func:refered_elements($originals)";
       
    78             otherwise
       
    79                 result "$descend";
       
    80         }
       
    81     }
       
    82 
       
    83     include geometry.ysl2
    68     include geometry.ysl2
    84 
    69 
    85 
    70     include detachable_elements.ysl2
    86     def "func:all_related_elements" {
       
    87         param "page";
       
    88         const "page_overlapping_geometry", "func:overlapping_geometry($page)";
       
    89         const "page_overlapping_elements", "//svg:*[@id = $page_overlapping_geometry/@Id]";
       
    90         const "page_sub_elements", "func:refered_elements($page | $page_overlapping_elements)";
       
    91         result "$page_sub_elements";
       
    92     }
       
    93 
       
    94     def "func:required_elements" {
       
    95         param "pages"; 
       
    96         choose{
       
    97             when "$pages"{
       
    98                 result """func:all_related_elements($pages[1])
       
    99                           | func:required_elements($pages[position()!=1])""";
       
   100             }otherwise{
       
   101                 result "/..";
       
   102             }
       
   103         }
       
   104     }
       
   105 
       
   106     const "required_elements",
       
   107         """//svg:defs/descendant-or-self::svg:*
       
   108            | func:required_elements($hmi_pages)/ancestor-or-self::svg:*""";
       
   109 
       
   110     const "discardable_elements", "//svg:*[not(@id = $required_elements/@id)]";
       
   111 
       
   112     def "func:sumarized_elements" {
       
   113         param "elements";
       
   114         const "short_list", "$elements[not(ancestor::*/@id = $elements/@id)]";
       
   115         const "filled_groups", """$short_list/parent::svg:*[
       
   116             not(descendant::*[
       
   117                 not(self::svg:g) and
       
   118                 not(@id = $discardable_elements/@id) and
       
   119                 not(@id = $short_list/descendant-or-self::*[not(self::svg:g)]/@id)
       
   120             ])]""";
       
   121         const "groups_to_add", "$filled_groups[not(ancestor::*/@id = $filled_groups/@id)]";
       
   122         result "$groups_to_add | $short_list[not(ancestor::svg:g/@id = $filled_groups/@id)]";
       
   123     }
       
   124 
       
   125     def "func:detachable_elements" {
       
   126         param "pages";
       
   127         choose{
       
   128             when "$pages"{
       
   129                 result """func:sumarized_elements(func:all_related_elements($pages[1]))
       
   130                           | func:detachable_elements($pages[position()!=1])""";
       
   131             }otherwise{
       
   132                 result "/..";
       
   133             }
       
   134         }
       
   135     }
       
   136 
       
   137     // Avoid nested detachables
       
   138     const "_detachable_elements", "func:detachable_elements($hmi_pages)";
       
   139     const "detachable_elements", "$_detachable_elements[not(ancestor::*/@id = $_detachable_elements/@id)]";
       
   140 
       
   141 
    71 
   142     include hmi_tree.ysl2
    72     include hmi_tree.ysl2
   143 
    73 
   144 
    74 
   145     def "func:is_descendant_path" {
    75     def "func:is_descendant_path" {