On Wed, 07 Jan 2004 16:35:05 +0100, David <dv@quicknet.nl> wrote:
Hello list,
I'm using XML + XSL + CSS to display my data to the web. I also want
to publish my pages in PDF format. To accomplish this I first must
transform my XML + XSL + CSS in XSL-FO. Is there a know technique to
transform my data to XSL-FO without loosing my markup. For example,
transformation my data to XHTML first and later from XHTML to XSL-FO?
You're probably better off drawing from the initial XML (which has all
the domain markup) for both the XHTML and XSL-FO. That is
XML -> XHTML
-> XSL-FO
will probably be better for you than
XML -> XHTML -> XSL-FO
XHTML and XSL-FO are both presentation models. They'll have elements
that are there in order to get things formatted the way you want. Even
if you add attributes that would allow you to reconstruct the original
structure, it'd be a lot of work (possibly very tricky work) to get it
right.
For instance, you might have an array of things (field descriptions for
a database table is one I run across often). It may may sense to
display this as a table, but then you might having something like
<table class='fielddefs'>
<tr>
<th>#</th>
<th>Field Name</th>
<th>Type</th>
<th>Size</th>
</tr>
<tr class='fielddef'>
<td>1</td>
<td>Item_ID</td>
<td>char</td>
<td>10</td>
</tr>
</table>
You could probably pull this back out if you had to. However, if you
had more complete documentation (description of constraints, behavior,
acceptable values, etc. for each table), with field summaries in a table
such as above and full descriptions below[1], you'll have to find a way
to join them up again... which results in juggling more information and
making your script more complex.
OTOH, if you have an XHTML transformation for 'dbtable' and 'dbfield' it
is fairly simple (even for the presentation described above), and the
XSL-FO transformation for the same is about as simple. Each is
insulated from the other, you can share common code between the two
scripts, and they stay relatively simple.
[1] useful, IMO -- most of the time people just need a reminder of
structure, so the table is very useful, but having full doco below
makes it better.
All IMO, of course. It depends a lot on the complexity of the data and
layout for presentation.
Keith
--
Keith Davies "Your ability to bang your head against
ke**********@kjdavies.org reality in the hope that reality will
crack first is impressive, but futile"
-- Geoffrey Brent, rec.games.frp.dnd