+ <apply-templates select="$content" mode="LesML:finalize">
+ <with-param name="used-footnotes" select="$used-footnotes"/>
+ </apply-templates>
+ </copy>
+ </if>
+ </template>
+ <template match="html:section" mode="LesML:finalize">
+ <param name="used-footnotes" select="/.."/>
+ <variable name="notinsection" select="following-sibling::node()[not(html:li/@aria-level>1)][1]"/>
+ <copy>
+ <apply-templates select="@*|html:p[1]/@*[&pilcrow-atts;]" mode="LesML:finalize"/>
+ <apply-templates select="node()" mode="LesML:finalize"/>
+ <for-each select="exslset:leading(following-sibling::node(), $notinsection)">
+ <copy>
+ <apply-templates select="@*|node()" mode="LesML:finalize">
+ <with-param name="used-footnotes" select="$used-footnotes"/>
+ </apply-templates>
+ </copy>
+ </for-each>
+ </copy>
+ </template>
+ <template match="html:*[html:li/@aria-level>1]" mode="LesML:finalize">
+ <param name="used-footnotes" select="/.."/>
+ <if test="not(preceding-sibling::node()[not(html:li/@aria-level>1)][1]/self::html:section)">
+ <copy>
+ <apply-templates select="@*|node()" mode="LesML:finalize">
+ <with-param name="used-footnotes" select="$used-footnotes"/>
+ </apply-templates>