forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <>
Subject Re: custom formatting / css
Date Fri, 14 Mar 2003 15:55:31 GMT
Hi Victor,

Sorry for the slow reply!  Started reading, got distracted, then forgot
to pick it up..

On Wed, Mar 12, 2003 at 11:10:09AM -0700, Victor Mote wrote:
> Dear Forrest developers:
> I am a sometime FOP developer, and have little (but growing) knowledge of
> most of the other Apache projects. I have spent a fair amount of time trying
> to find the answer the question below from the Forrest & Cocoon web sites,
> but I am afraid this is probably a newbie question.
> FOP has a document on its site which uses a custom DTD:
> About the time that we switched over to Forrest, I had written an XSLT
> stylesheet which converted the source XML to HTML, embedding some "class"
> attributes in the HTML <td> elements, and embedding some CSS code into the
> document head for formatting based on those classes. Specifically, I am
> trying to color-code cells in the table based on the classes. Someone (I
> think Keiron Liddle) adapted the XSLT to convert to the document-v11 format
> which is now used to generate our web site. At that time, we expected to
> lose, and did lose, the color-coding, which I am now going to try to get
> back.
> 1. Interestingly, the "class" attributes survive all the way into the
> published HTML. I would think that they might cause validation problems, as
> they are not in the DTD.
> 1. Since document-v11 is a semantic-oriented DTD, with no formatting
> information, is what I am trying to do here more-or-less violating the
> spirit of what Forrest is intended to provide?

The intermediate doc-v11 format is mostly there so we can have just one
document2fo.xsl stylesheet, not {format}2fo.xsl for every possible
<format>.  In many cases (like yours), doc-v11 isn't expressive enough,
and one has to write custom {format}2{html,fo}.xsl stylesheets.

> 2. What is the best practices way of accomplishing this (ie. essentially
> overriding the default Forrest formatting)?

Here is what Keiron added:

   <map:match pattern="body-compliance.xml">
     <map:generate type="file-nolabel" src="content/xdocs/compliance.xml"/>
     <map:transform src="resources/stylesheets/compliance2document.xsl" label="content"/>
     <map:call resource="skinit">
      <map:parameter name="type" value="document2html"/>
      <map:parameter name="path" value="compliance"/>

This pipeline creates the "body" (distinct from "menu" and "tabs") of the
compliance.html page.  It applies compliance2document.xsl, and then the
'skinit' pipeline snippet (defined in map:resources), which applies

So to get a custom HTML format, you would simply delete everything from
the transform down, and replace it with:

   <map:transform src="resources/stylesheets/compliance2html.xsl"/>
   <map:serialize type="xml"/>

Note that compliance2html.xsl has to have a root tag of <div
class="content">.  This allows the resultant HTML to be merged with the
menu and tabs.  If it doesn't work, try 'forrest run', and then request
http://localhost:8888/body-compliance.xml, and see what's actually being

> 3. Is there a mechanism for getting css code and/or references passed
> through the document-v11 document? I have noted the thread with Peter West
> about embedding ehtml documents, but I am under the impression that would be
> for <body> contents. IIUC, the custom DTD has nothing to do with this, but
> this is rather a general question that would apply to any document-v11
> document.

There isn't yet.  Perhaps there should be a 'class' attribute allowed,
with the ability to define an add-on CSS stylesheets.

> 4. Is this all documented somewhere & I just missed it?

Almost ;)  Adding compliance.html would fall under:

> TIA for your help. It has been fun to see Forrest evolve into a very useful
> product. Thanks for all of your efforts.

Thanks :)


> Victor Mote (
> 2025 Eddington Way
> Colorado Springs, Colorado 80916
> Voice +1 (719) 622-0650
> Fax   +1 (720) 293-0044

View raw message