forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Crossley <cross...@apache.org>
Subject Re: How-to use a local html-to-document.xsl?
Date Thu, 31 Jan 2008 00:05:05 GMT
Thorsten Scherler wrote:
> EMMEL Thomas wrote:
> > 
> > since forrest uses the html-to-document.xsl file to filter native html 
> > and I like to test several changes in this document it would be nice
> > to use a local copy of this file.

If your changes are of general use, then please consider
providing a patch.

> > However, forrest takes allways the file from the installation not
> > from my project. I put it to resources/stylesheets as there is the 
> > hello2document.xsl-file.
> 
> That is not the correct place. I assume you are using 0.8:

Both Thorsten's and Ross's answers are fantastic and should be documented.

I will attempt to explain it in words ...

> !-- All core other transforms -->
>     <match pattern="transform.*.*">

In this case the internal Cocoon engine is looking for html-to-document.xsl
so that match splits it into parameters 1=html and 2=document
i.e. transform input html into the internal xml document format.

The locationmap tries various locations until it finds it.

>       <select>
>         <location
> src="{properties:skins-dir}{forrest:forrest.skin}/xslt/html/{1}-to-{2}.xsl" />

It will first look in your project directory. The "skins-dir" location is
pre-defined in your forrest.properties file. The next is the skin
name that you have configured in forrest.properties, e.g. "pelt".
So in the default setup, Cocoon will look for 
PROJECT_HOME/src/documentation/skins/pelt/xslt/html/html-to-document.xsl

You need to create that directory and place your xsl file there.
It will be automatically found here rather than forrest core.

>         <location
> src="{forrest:forrest.context}/skins/{forrest:forrest.skin}/xslt/html/{1}-to-{2}.xsl"/>

If not found it will look in the forrest core
at a skin-specific location.

>         <location
> src="{forrest:forrest.context}/skins/common/xslt/html/{1}-to-{2}.xsl"/>

Then in the forrest core at a location common to all skins.

>         <location src="{forrest:forrest.stylesheets}/{1}-to-{2}.xsl"/>

Then in the forrest core where general stylesheets are kept.

>       </select>
>     </match>
> 
> So you place html-to-document.xsl in
> {properties:skins-dir}{forrest:forrest.skin}/xslt/html/ and it will
> automatically picked up.

As described above.

> ...or you implement 
> <match pattern="transform.html.document">
>   <location src="YourPath/html-to-document.xsl"/>
> </match>
> 
> in your locationmap.

i.e. you could over-ride everything by placing that match
in your project locationmap as described at
http://forrest.apache.org/docs/locationmap.html

-David

Mime
View raw message