Need to do a "book style" Table of Contents

W

wardellcastles

I need to transform from an xml specification to a document with a
"book-style" table of contents; one with page numbers, not html
hyperlinks (The output of the XSLT is NOT html).

For example, here's an example of the desired output.

Title Page
.......
End of Page 1

Table Of Contents

I. Chapter 1...... Page 3
II. Chapter 2..... Page 5
III. Chapter 3.... Page 10

End of Page 2

Chapter 1
...2 pages..

Chapter 2
... 5 pages..

Chapter 3
...1 to many pages ..

I think I might be able to calculate the page numbers for the different
chapters using <msmxl:script language ...>

My challenge is that I want to calculate the pages so that I can print
the Table of Contents BEFORE I actually output Chapter 1, 2, 3.

One way I thought I could do this is via a 2 step transformation. The
first would have the output file with the TOC at the end after the
chapter page numbers are calculated, then transform again to put the
TOC at the desired location within the final document. However I
really want to do it in one transformation.

Does anyone have any suggestions?
 
A

Andy Dingley

Does anyone have any suggestions?

No. Page numbers are tricky, because there aren't any "pages" in a
document that's just a flow of objects. You can only start to identify
(and thus number) pages when you get quite close to the final output
processes - and that depends on what your output mechanism is, which you
haven't told us about.

So, it's probably ugly, it's probably multi-pass, it probbly involves
scripting, but we can't be any more specific than that/

Incidentally, it's worth reading through old (I mean _old_) textbooks
like Knuth or Kernighan & Plauger's "Software Tools In <foo>" to read of
the old dinosaur era when we had to write our own pagination algorithms
from carved sticks and wet string. Some of that stuff is still
applicable, even today.
 
W

wardellcastles

Just to clarify with everyone, at least in my specific application, the
determination of the page numbers for Chapter 1, 2, 3, etc is not my
primary concern.

The real problem is how to gather the info for the table of contents
page so that it can be printed before the chapters are printed so that
it can be done in one transformation.

Thanks!
Wardell
 
H

HALLES

Hello i have the same goal as you it seems.

Use XML and other X... files to gather and display structured infos !

It is a paradox !
A clear aim, and no one to help !

It is all OUR fault, yes, we see structured algorithms in XML and X..
files, it is not yet the case !

HALLES. french paradoxal thinker ;o)
 
R

Richard Light

In message said:
Just to clarify with everyone, at least in my specific application, the
determination of the page numbers for Chapter 1, 2, 3, etc is not my
primary concern.

The real problem is how to gather the info for the table of contents
page so that it can be printed before the chapters are printed so that
it can be done in one transformation.

As Andy says, you haven't told us what environment you _are_ trying to
generate this output in. If you use the framework which was designed to
produce paginated output from XML sources, i.e. XSL-FO, this capability
is built-in so the job becomes easy.

Richard
 
P

Peter Flynn

wardellcastles said:
I need to transform from an xml specification to a document with a
"book-style" table of contents; one with page numbers, not html
hyperlinks (The output of the XSLT is NOT html).

Transform to LaTeX and let it do it.

///Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top