RE: [xsl] HTML section headings to XML document sections

Subject: RE: [xsl] HTML section headings to XML document sections
From: "Beckers, Marc" <Marc.Beckers@xxxxxxxxxxxxxx>
Date: Thu, 9 Aug 2001 10:14:02 +0200
Hi Michael,

....
> So the question is how to know each time a <hx> (h1, h2, h3, ...) element
> is encountered what are the "open h" levels less than or equal to that
> of the current element, so that we can "close" them. In particular, before
> exiting the document we should also close the complete hierarchy
correctly.

I recently faced the same problem as you, 
but expedience being the better of elegance, 
I choose a quick and dirty route (since it was
a one-off under pressure of time):
I ran an XSLT stylesheet for each H* level,
meaning 4 or 5 conversions, each conversion run
using the output of the previous run,
thus adding one level in each run.
A hierarchy level is added simply by adding
tags as text in the right places.....
Then, it's easy. As I say, not very elegant,
but it worked.
The HTML must be consistent within itself, of course,
but that would also apply to an elegant solution
with some super-duper top-notch recursive XSLT:
if someone used an H4 because he wanted bold text,
you'll probably get an invalid result.

If you're interested, contact me off-line.

Cheers -- Marc
Dr. Marc Beckers
Documentation Consultant
Software AG
Uhlandstraße 12
D-64297 Darmstadt
Phone +49-6151-92-1322
Fax              -1612
mailto:Marc.Beckers@xxxxxxxxxxxxxx
http://www.softwareag.com


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


Current Thread