You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Ross Gardler <rg...@apache.org> on 2004/02/24 15:57:14 UTC

The process of turning XDoc into XHTML (Re: Philosophy: Why id but no class?)


Moshe Yudkowsky wrote:
> Ross Gardler wrote:
> 
>  >> Moshe Yudkowsky wrote:

<snip/>

>  >> A future version of Forrest will be moving to a subset of XHTML2 as the
>  >> intermediate format (replacing Document V1.2, which will become a 
> source
>  >> format to maintain backward compatability). When this happens we will
>  >> have class on all elements.
>  >>

<snip/>

> One obstacle is that even after reading the documentation I have no real 
> feel
> for the flow of a document through the system. I deduce that it's along the
> lines of document2html.xsl followed by site2xhtml.xsl, but I deduce that
> there's other steps. To the best of my knownledge there's no flow 
> chart/figure
> that captures the entire process. And depsite a bit of fiddling around I 
> have
> no idea of how to capture an intermediate document to examine it.

I am assuming you are using XDoc as your source format. Here's how a 
typical XDOC gets turned into XHTML document.

The request is matched against the following pipeline in sitemap.xmap 
(there's another for requets in the root directory, but it works the 
same way using pattern="*.html"):

       <map:match pattern="**/*.html">
         <map:aggregate element="site">
           <map:part src="cocoon:/{1}/tab-{2}.html"/>
           <map:part src="cocoon:/{1}/menu-{2}.html"/>
           <map:part src="cocoon:/{1}/body-{2}.html"/>
         </map:aggregate>
         <map:call resource="skinit">
           <map:parameter name="type" value="site2xhtml"/>
           <map:parameter name="path" value="{0}"/>
         </map:call>
       </map:match>

The map:aggregate parts takes generates three partial documents and 
joins them together. These are generated by processing the tabs.xml, 
site.xml (or book.xml if present) and your xdoc (body). This is done by 
calling the pipelines identified in the map:part elements. So if you 
request "http://loclahost:8888/subdir/document.html", Forrest generates 
three new requests (subdir/tab-document.html, subdir/menu-document.html, 
and subdir/body-document.html). These are put together in a single 
document. The resulting document is then skinned using the skinit 
resource and the supplied parameters.

> In other words, I have very nice "clean" templates and skin right now that
> works very well to produce a pure CSS-based site. However, if I want to 
> modify
> the DTD to include "class," I need to know more about the intermediate
> transformations. While I can make very good guesses based on the XSL I see,
> it'd be nice to have tools to examine the intermediate file formats.

To really understand what is going on you need to be able to read 
understand the Cocoon sitemap, see 
http://cocoon.apache.org/2.1/userdocs/index.html and 
http://wiki.cocoondev.org

You can look at any of the intermediate steps by requesting the urls 
"http://localhost:8888/subdir/tab-document.html", 
"http://localhost:8888/subdir/menu-document.html" and 
"http://localhost:8888/subdir/body-document.html".

Is that what you mean by the intermediate stages?

 > (Documentation would also be good!)

Patches are always welcome ;-), even if it is only a couple of lines 
gleaned from the list. Every little helps.

Ross