xsl-list
[Top] [All Lists]

Re: Finding topmost element of a nested, nested list

2003-10-29 10:47:05
Steve,

Would it work if each level checks to see whether its first child has an image descendant?

What should happen if you have

  <level>I.
    <level>A.
      <section>1</section>
      <section>2</section>
    </level>
    <!-- end-page here? -->
    <level>B.
      <section>3</section>
      <section>4
        <image/>
      </section>
    </level>
  </level>

Cheers,
Wendell

At 09:31 AM 10/29/2003, you wrote:
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>


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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



<Prev in Thread] Current Thread [Next in Thread>