[xsl] Request for design tips: transforming XML topics + map to various XHTML + meta data formats

Subject: [xsl] Request for design tips: transforming XML topics + map to various XHTML + meta data formats
From: Graham Hannington <Ghannington@xxxxxxx>
Date: Fri, 20 Feb 2004 16:52:04 -0000
Let's say I have some DITA-source topics and a topic map. Or, roughly
equivalently, some XHTML files and an XML file that does roughly what a DITA
topic map does (list XHTML files in a nested hierarchy, with, say, a
"publication"-level title and other meta data).

I want to transform those "topics + map" source files into JavaHelp, or
Eclipse Help, or HTML Help 1.x, or MS Help 2, or... any format where the
content is (X)HTML (okay, perhaps HTML 3.2, or 4.01, if you're picky ;-),
with one or more format-specific meta data files for navigating that XHTML
(such as table of contents and index entries).

Typically, the format-specific meta data files consist of data gleaned from
both the XML topics and the topic map. For example, to create an HTML Help
1.x .hhc file (which is essentially just a set of nested unordered HTML
lists, where each list item contain a topic heading and, optionally, a topic
file path), you need to combine the TOC hierarchy and file paths from the
topic map with the heading text from each topic. And to create a .hhk
(keyword index) file, you need to use the topic map to collect index entries
defined in each topic.

I'd like to supply a topic map to a single XSLT stylesheet, and have that
XSLT stylesheet output, for example (for HTML Help 1.x):

- The topics referred to in the map, transformed to (X)HTML (or, if they
began life as XHTML, transformed to some simplified XHTML; without, for
example, development-environment specific <meta> elements)... I'm assuming
here a one-to-one relationship with the original topic source files and
these resulting (X)HTML files.
- .hhc
- .hhk
- .hhp

I'd really appreciate advice on the most efficient way to manage the
processing of all this stuff between the various templates in the XSLT style
sheet.

For example (again, for HTML Help 1.x): to produce the .hhc, I need to parse
the input topic map and retrieve the headings from each topic. Easy: match
the topic map root element, traverse the topic map items, and use their
topic file paths in conjunction with the document function to get the
headings for each topic.  And the .hhp is just as straightforward. But I'm
trying to conceive of some way of accessing each topic once only, to extract
the heading text for the .hhc, the index keywords for the .hhk, and the
content for the simplified XHTML.

Can anyone point me to an example, or offer guidance on the XSLT style sheet
design? To recap: I want a *single* XSLT style sheet (okay; it will probably
import style sheets for each "component") that takes as input a topic map,
and outputs HTML files and format-specific meta files. I'd like the internal
processing to be streamlined, so that topics are only opened once (or am I
making it unnecessarily hard for myself, by making this a requirement?).

And finally... I know, this is probably asking too much... since the
transformations to Eclipse Help, HTML Help 1.x, or MS Help 2 all involve
pretty much the same sort of processing (such as merging map hierarchy with
topic titles), I'm wondering how hard it would be to have a generalized XSLT
stylesheet for creating "HTML plus format-specific meta data" from "topics
(containing contents amd some imbedded meta data) plus topic map (topic
hierarchy and some other meta data)". Where the output format is specified
as an XSLT parameter that acts as a switch to select format-specific
template processing... or even... the topic map itself specifies the desired
output formats, and the XSLT style sheet produces them all in a single
pass... (not iteratively: call XSLT stylesheet with output parameter set to
"Eclipse", then call it again with output parameter set to "HTML Help",
then...) Am I dreaming?

Graham Hannington

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


Current Thread