Mailing List Archive

How-to use a local html-to-document.xsl?
Hi,

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.

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.

Maybe this is the worng place or I need to configure something I haven't
found yet.

Any help appriciated

Thomas
Re: How-to use a local html-to-document.xsl? [ In reply to ]
On Wed, 2008-01-30 at 09:58 +0100, EMMEL Thomas wrote:
> Hi,
>
> 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.
>
> 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:
!-- All core other transforms -->
<match pattern="transform.*.*">
<select>
<location
src="{properties:skins-dir}{forrest:forrest.skin}/xslt/html/{1}-to-{2}.xsl" />
<location

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

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

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

in your locationmap.

salu2
>
> Maybe this is the worng place or I need to configure something I haven't
> found yet.
>
> Any help appriciated
>
> Thomas
--
Thorsten Scherler thorsten.at.apache.org
Open Source Java consulting, training and solutions
Re: How-to use a local html-to-document.xsl? [ In reply to ]
EMMEL Thomas wrote:
> Hi,
>
> 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.
>
> 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.
>
> Maybe this is the worng place or I need to configure something I haven't
> found yet.
>
> Any help appriciated

You don't say what version of Forrest you are using. I am going to
assume 0.8 or 0.9-dev (i.e. this will not work in 0.7)

All resources are resolved via a file called the locationmap. This is
documented at [1]

Scanning this document I don't see an example of how to override values
in the way you require, so here is an overview. It would be highly
beneficial to the project if you could add this documentation to [1] and
submit a patch to our issue tracker [2]

A default locationmap is provided by Forrest core and by each plugin but
there is also a project specific locationmap at
PROJECT_HOME/src/documentation/content/locationmap.xml

You can override any value in the the core or plugin locationmaps simply
by adding a match to your project locationmap. For example:

<match pattern="transform.html.document">
<location src="{properties:resources.stylesheets}/html-to-document.xsl"/>
</match>

And put your custom stylesheet in PROJECT_HOME/src/resources/stylesheets

Ross

[1] http://forrest.apache.org/docs_0_80/locationmap.html
[2] http://issues.apache.org/jira/browse/FOR
Re: How-to use a local html-to-document.xsl? [ In reply to ]
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