Re: [xsl] keys and variables

Subject: Re: [xsl] keys and variables
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Sat, 21 Aug 2004 10:14:26 +0100
Hi Bruce,

> In short, and in an ideal world of course, I want to be able to use
> the same core logic to format bibliographies and citations whether
> it is for a TEI, DocBook, OpenOffice or even WordML document data,
> or with different bibliographic metadata schema like MODS. I want
> the same core formatter to read the same XML formatting style files.

You have two options:

1. Use a core format, write code to generate HTML (or whatever) from
that format, and write code to convert from each of the other formats
into that core format:

  TEI ---------------|
  DocBook --------v  v
  OpenOffice --> core format ----> XHTML
  WordML ---------^  ^
  MODS --------------|

Each of the transformations is likely to be relatively easy to write
and to debug; you have to write a lot of them, but you can do it as
the requirement arises.
  
2. Use a meta-stylesheet that generates another stylesheet using
configuration files to identify what information to put where, and
write configuration files for each of the formats you want to support.

  TEI config ------------------|
  DocBook config ---------v    v
  OpenOffice config --> meta-stylesheet --> stylesheet
  WordML config ----------^    ^
  MODS config -----------------|

The meta-stylesheet is likely to be difficult to write and hard to
debug, but you only have to write one of them and once it's done,
you're done. (The debugging is the killer: it's hard to know whether
an error comes from the design of the stylesheet you've generated,
from the meta-stylesheet not generating the right thing, or from the
configuration file not being correct. Also, you're likely to find
things that the meta-stylesheet doesn't do when you come to actually
writing the configuration files for the other formats that you need to
support, so you're not actually *done* when you've written the
stylesheet.)


I've often made the mistake of building in too much configurability
too early (ref. http://www.extremeprogramming.org/rules/early.html).
My advice would be that if all you need right now is MODS -> XHTML,
then build that transformation. If you later need DocBook -> XHTML
then you can write DocBook -> MODS and use two steps to get to XHTML.
(Actually, you're already using an intermediate format, so you'd
actually build a DocBook -> intermediate format transformation.)

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Current Thread