RE: [xsl] Combining HTML/FO StyleSheets ( Indirection/Abstraction Methods) - Non-Trivial

Subject: RE: [xsl] Combining HTML/FO StyleSheets ( Indirection/Abstraction Methods) - Non-Trivial
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 04 Mar 2002 14:17:06 -0500
Peter,

My guess is that the approach you suggest, namely targeting an intermediate processed format that you can then take both to HTML and to XSLFO, thereby sparing you the headache of duplicating processing logic, will get more common as applications like yours get more mature.

Either XHTML as a source for FO, or FO as a source for HTML, have their shortcomings IMHO. Both an XHTML->XSLFO stylesheet and an XSLFO->XHTML stylesheet would pretend to be very generic stylesheets, i.e. useful on any XHTML or FO, but in practice I think issues of styling and the split between good screen display and good print layout, will make this very difficult. (There is probably somewhere an HTML backend for FO: this implements, in effect, one of these.) In theory, CSS could provide a common ground of display semantics in the two cases. But this would mean having a CSS-aware super-XSLT processor (haven't seen one yet), and also doesn't account for the probability that you don't really want your web pages to look just like the print in any case.

Going from a unified, pre-processed format into either terminal target format will make for a cleaner separation of source content, processed content (basically a "content view"), and format. In particular, targeting an initial format and then going through a more generic transform to the terminal format, may be nice for implementating "house style" types of applications, where diverse material is to be funnelled into a single look-and-feel.

Whether your architecture and performance requirements can tolerate the multiple transformations this implies, is of course a question not answerable in the general case.

Also keep in mind, however, that the designers of XSLT do seem to have anticipated this scenario in providing xsl:import. The idea is that your processing logic would be in a single stylesheet, which would be imported by either of the others. The processor then gets a single transformation to do, not two. Both xsl:call-template and xsl:apply-imports ought to be very useful there.

Cheers,
Wendell

At 09:22 PM 3/3/2002, Joshua K. wrote:
>       After slaving way at the problem I'll discuss below and
> coming up with
> several non-working solutions, I was wondering "Do people create
> intermediate markup languages to ease the generation of both HTML and
> FO?" By this I mean do people generate and intermediate format (XML)
> which has all of the complex processing completed, and then have
> trivial conversion style sheets from that format to HTML or XSL:FO as
> appropriate? ((Example: intermediate tag like <paragraph> -> <p> or
> <fo:block> depending on the desired output format))

...


Let's say I have report_html.xsl, report_fo.xsl and report_csv.xsl. One partial solution I developed was to write a stylesheet that transformed the report_html.xsl into report_fo.xsl. However, this was only a partial solution because I still needed to tweak the individual files as HTML doesn't require <fo:table-column> elements.

With hindsight, one thing I would have changed is writing the report_fo.xsl first as this is more detailed, and then writing the stylesheet to transform it to report_html.xsl. In one sense, this is using XSL-FO as the intermediary format you mentioned. With the XSL-FO you can either generate the PDF, or generate the HTML.


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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



Current Thread