I've been looking in depth at Linda's example with the two style sheets
which creates the TOC down the left-hand side, and I have a more general
question on the flow of the processing.
Since the toc is created in the left-hand column, and needs information from
the entire xml document; and since the body of the document is created in
the right-hand column and also needs information from the entire xml
document; am I right in thinking that the xml document is actually processed
twice, once to create the toc and then again to create the body of the page?
As I work through the style sheets, that's how it looks -- I don't see
anything in the XSL code that allows you to store information and reference
it later. But it must be there, otherwise how would you create links to
things (you need the information once for the link and then again for the
target, to create a matching id, right?).
As opposed to processing the document once; storing each toc element in
memory as it's encountered; storing the body information in memory as its
encountered; and then at the end spitting out all the toc information into
the first <td></td> followed by all the body information in the next
Hope this question makes sense. We used to process structured documents
using a language called Omnimark, which processed the document sequentially
once, matching each element using the equivalent of templates, but it didn't
output anything until the complete document had been passed through the
code; this allowed you to store various bits of information in different
buffers and arrays, insert placeholders that were resolved at the end of
processing, and generally manipulate the entire document structure as
desired, prior to actually outputting anything. I'm used to thinking in
this manner and don't quite grasp the flow for XSLT yet.