[xsl] html subsection headers xpath

Subject: [xsl] html subsection headers xpath
From: Jack Bates <ms419@xxxxxxxxxxxxxx>
Date: Wed, 03 Oct 2007 02:36:37 -0700
I'm trying to select all the <h4> elements under the current <h3>
element, in a document which otherwise doesn't have any useful
structure.

This template selects <h4> elements following the current <h3> element:


  <xsl:template match="h3">
    <fieldset class="collapsible">
      <legend><xsl:value-of select="normalize-space(.)"/></legend>
      <xsl:apply-templates select="following::h4"/>
    </fieldset>
  </xsl:template>


How do I limit to <h4> elements following the current <h3> element, up
until the next <h3> element?

I assume I can generalize to: "select <h4> elements following the
current <h3> element, up until the next <h3>, <h2> or <h1> element"

Much thanks, Jack

Current Thread