Fix a regression of bug 4899 due to HHPv2: <h> tags now appear on tree depth levels other than the first. The 4899 aspect is easily fixed by having extractSections() look at the i attribute instead of just counting.
The implications in general are that headings inside properly-closed double braces will not have section edit links, even where the braces are broken by invalid title characters and expanded literally to recover the heading. Respecting such headings as section breaks would run into the same problems as those discussed w.r.t. LST on wikitech-l -- there's no way to recover the text for a section that starts on one tree level and finishes on a different one. The fact that higher level <h> nodes appear in the XML is just due to a shortcut in preprocessToObj(): headings are put into the stack in case the braces turn out to be unclosed, in which case the heading will be at level 1 of the tree.