You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ulrich Mayring <ul...@denic.de> on 2000/02/18 14:20:29 UTC

Multiple Choice: Table of Contents in cocoon?

Hello all,

I want to use cocoon to create a TOC (Table of Contents) for our
website. This is basically a list of XML documents in the current
directory and all subdirectories. Right now in every directory I have a
toc.html file that looks like this, when requested (the first line is a
clickable URL):

index.en.html
     -- Database / Domain Registration
     -- in English, last changed at 02/01/2000, 12:47:41 PM

index.html
     -- Datenbank / Domain-Registrierung
     -- in German, last changed at 02/01/2000, 12:48:03 PM

DENICdirect/preisliste.en.html
     -- Database / Domain Registration / DENICdirect / Prices
     -- in English, last changed at 02/01/2000, 1:29:47 PM

DENICdirect/preisliste.html
     -- Datenbank / Domain-Registrierung / DENICdirect / Preisliste
     -- in German, last changed at 02/01/2000, 1:30:18 PM

So, whenever the toc.html file is requested I want to call an XSP page
that generates this content on the fly for this directory and all
subdirectories. For this functionality I need two things:

1) a directory traverser. This is probably already implemented in some
Java API, so I know what I have to do here.

2) a way to read each of the files returned by the traverser, in order
to determine if they should be included in the TOC. (For example, the
toc.html file itself should not be included). Since these are all XML
files, they contain a tag like:

<type>content</type> (Page with real content) or <type>nav</type>
navigational page)

So, what I could do is apply an XSLT transform to each of the returned
pages, which will select or unselect them for inclusion in the TOC.
Also, this transform will generate the rest of the information that you
see above (like modification date and language) and ultimately produce
the toc.html page. This XSLT transform is already done, as I'm using it
in other parts of our website.

My question now: what is the "best" way to do the TOC? Check one or more:

[ ] do all processing in Java custom code, i.e. read the files with the
Java FileReader classes and process them directly in Java without using
XSLT

[ ] do just directory traversal in Java and then read the whole DOM tree
of the returned documents using the Xerces API and apply the XSLT
transform using the Xalan API

[ ] do some clever cocoon stuff with the cocoon API (which classes
should I look at?)

[ ] other

[ ] don't bother, this is hell to implement and really slow in
execution, keep on using your present (custom-made, not standards-based)
system to generate the TOC

Thanks in advance for any opinions,

Ulrich

-- 
Ulrich Mayring
DENIC eG, software development
ulim@denic.de