You are running into the classic "grouping"
problem in XSL. You might check this article as a starting point, or Jeni
Tennison's book "XSLT and XPath On the Edge" which has a lot about
grouping.
----- Original Message -----
Sent: Thursday, July 29, 2004 8:21
AM
Subject: [docbook-apps] XSL trouble with
generating XHTML from TOC
Hello all,
I have a file called book.xml which via
XPointers includes "sect1"s into its book element. Apart from being a book,
the sect1s are used as independent articles on a website where each
chapter is a category for the articles(sect1s).
I am having
trouble generating the website navigation for these articles. I want it to
be like the "Audio & Video" category and similar, found on
www.download.com, but where the entries are aligned vertically below.
My book have 5 chapters, but when generating a table with one row(tr)
and five cells(td) each containing a table with a tr encapsulating a td
for each sect1 and the chapter's title(as on download.com but vertical),
it gets too wide for 1024x768. In other words, I need to do a break where
the first "line" contains 3 categories, and the one below 2.
I have
trouble getting this right with my XSL(attached) -- when the for-each loop
have iterated over 3 chapters, it needs to "pop out" and start a new row.
With an ordinary programming language that would have been easy, but I
can't get the template thinking right.
Another problem, probably
caused by my incapable HTML skills, is the categories gets formatted
unevenly because they contains different amounts of sect1. I tried to
solve this by putting 'valign="top"' in the table but that didn't help;
still those containing less entries are centered and not on the same
"rows". One method is to somehow find out what the maximum number of
sect1s that exists in any chapter, and then insert(by looping?) empty
cells in each category so all categories have the same amount of cells. Or
control the formatting somehow. Any ideas?
Thanks in
advance,
Frans
|