[xsl] Finding topmost element of a nested, nested list

Subject: [xsl] Finding topmost element of a nested, nested list
From: "Liguori, Steven" <steven.liguori@xxxxxxxxxxx>
Date: Wed, 29 Oct 2003 08:31:48 -0600
As you'll see, I'm working on a process for print rendering. The basic idea
is that images, along with their immediate level(s) and section, should
start on a new page. A sample with the hoped for locations of the end-pages
is shown below.

I've been matching on level, looking for a descendant with matching criteria
before starting the process (the vast majority won't need it), and
outputting the end-page. I've been turning off the output when the level is
a descendant of another level. This is okay for level 3 but it obviously
won't work for level B which is the second child of the open level element.

I've tried various combinations of ancestors, descendants and position() but
still can't get this to work. Is this even possible with XSLT? Would I just
need the RIGHT combination of ancestor, descendant and position() tests?
Would changing the data model help? Any thoughts greatly appreciated.

<chapter>1.
  <level>I.
    <level>A.
      <section>1</section>
      <section>2</section>
    </level>
    <!-- end-page here -->
    <level>B.
      <section>3
        <image/>
      </section>
    </level>
  </level>
  <level>II.
    <level>A.
      <section>4</section>
    </level>
    <!-- end-page here -->
    <level>B.
      <section>5
        <image/>
      </section>
    </level>
  </level>
  <!-- end-page here -->
  <level>III.
    <level>A.
      <section>6
        <image/>
      </section>
    </level>
  </level>
</chapter>

Thanks again!
--Steve


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread