integrating complex XSLT-based formatting; OOo styling system?

I’m cc-ing this to various lists; sorry for the cross-posting, but am
not sure exactly where it should be focused:

I’m co-project lead for the OpenOffice Bibliographic Project (OOoBib).
Along with Daniel Vogelheim, I authored the citation coding schema
recently approved by the OASIS TC for inclusion in the file format.
This will set the low-level groundwork for dramatically improved
bibliographic and citation support in OOo.

I am also currently working on another piece of this puzzle: a
comprehensive XSLT-based formatting solution that I’d like to just
drop-in to OOo. This system uses XSLT 2.0, and communicates with a
bibliographic database over http, with no other code required.

So, the process is:

1)   run the processor (Saxon, in this case) against the source 

document to scan for all of the citation ids
2) assemble a query based on them
3) request the complete raw bibliographic data from the database
4) format bibs and citations according to detailed specifications in
a (non-XSLT) XML config file

This is basically the bibtex model, only better.

One of the reasons I’m quite excited about this is that it really opens
up some doors with respect to interoperability. So long as a database
can a return MODS XML records based on an http query, it can work with
the stylesheets. Given the growing importance of a standardized
url-based query system in SRU, there’s a lot of promise here.

I thus want to start a discussion about how to make this happen in OOo.
Details include, how might OOo be enhanced – by Sun – such that
inclusion of such a mechanism would be as simple as possible (maybe via
the proposed ‘Intelligent Document Tags’ functionality?? )?

I want it to be brain-dead simple to integrate from a programming
perspective because I want these stylesheets to be useable in a
wide-range of XML contexts. So far, I have designed them to not rely
on any code other than XSLT, and I want to keep it that way. I also
want it to be brain-dead simple for users to install (something like
Firefox’s extension interface for OOo maybe?).

If any Sun engineers want to look at the details (which I hope is the
case), please contact me about it. I think the problems we need to
solve are rather general problems for extending OOo.

The other issue, and the more immediate concern of this note, is about
how to integrate with OOo styling system.

I’m working on revamping my stylesheets a bit to make them more
flexible. The basic idea is, we (I’m getting help) are going to create
an intermediate representation, which then gets converted to different
output formats (xhtml, OOo, WordML, TeX). So, I need to know how best
to design that intermediate representation to work with OOo.

Anyway, as a start, let’s look at what I do with xhtml:

Amin, A. (1994) Post-Fordism: Models, Fantasies and Phantoms of Transition, In A. Amin Ed., Post-Fordism: A Reader (Oxford:Blackwell Publishers) pp. 23–45.

Most of the above classes are semantic (metadata), but “italic” is a
presentational class. There are really two alternatives:

  1. dynamically generate the styling for each class each time (somewhat
    difficult, and adds processing time).
  2. use inline styling for that formatting (e.g. A Title).

My question is, how best to handle this in the OOo format? I’m less
concerned with how things are necessarily now, than in an ideal
approach (OOo will have to be upgraded to support what we’re doing
anyway). Put another way, what would be the best way to code the xhtml
to enable it to be seamlessly transformed to a proper OOo
representation? Alternately, OOo code could be used as that
intermediate format, so long as it is easy to transform to other
formats (xhtml, WordML, FO, etc.).