forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ross Gardler <rgard...@apache.org>
Subject Re: Using locationmap in sitemap.xmap
Date Tue, 23 Sep 2008 22:34:51 GMT
Pablo Barrera wrote:
> Hello
> 
> I am trying to read several files from a directory to extract some 
> information from each one and create a resume. I am being looking at 
> org.apache.forrest.plugin.input.Resume. I have my sitemap working but I 
> use this line (a copy from a similar line in the plugin code):
> 
> <map:transform 
> src="{properties:resources}/stylesheets/alldocs-to-revisions.xsl" />
> 
> I tried to use locationmap to look for the xsl code, so I changed the 
> line to
> 
> <map:transform src="{lm:transformation.alldocs.revisions}" />
> 
> and then to
> 
> <map:transform src="{lm:alldocs-to-revisions.xsl}" />
> 
> as commented in [1], but it's not working. My locationmap looks at 
> /PATH-TO-MY-SITE/src/documentation/skins/pelt/xslt/html/alldocs-to-revisions.xsl 
> 
> 
> Why is it looking to pelt/xslt/html? Any idea?

The locationmap looks in a number of places for your required file, if 
it doesn't find it in the first location it falls back to the next 
possible location. I'm pretty sure the above location is only *one* 
location that the system is looking since it comes from the first 
location in the following match from the locationmap-transform.xml file [2]:

<!-- 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>


Since you say that it was working with

<map:transform
src="{properties:resources}/stylesheets/alldocs-to-revisions.xsl" />

That tells me that your stylesheet is in

${project.content-dir}/resources/stylesheets/alldocs-to-revisions.xsl

There are two solutions to this. The first is to copy the above match to 
your project locationmap and add (as the first location):

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

This will work for all stylesheets located in your project directory.

The second solution seems more appropriate to me. It is likely that 
content objects will provide their own stylesheets on occasion (as you 
are doing) and therefore this match should be added to the default 
locationmap [1]. Please try this latter solution and, if it works, send 
us a patch.

However....

Since I know what you are doing here (remember folks, Pablo is currently 
working in my team) let me go a step further...

Pablo is aggregating the content of a directory with TEI documents in 
order to create sorted lists of documents based on their revision headers.

I'd suggest that this functionality actually belongs in the TEI plugin 
not in the content object. That way it can be reused by other folk 
working with TEI in this way.

To do this you need a plugin specific location, as an example see [3] 
where you will find:

     <match pattern="pdf.transform.*.*">
       <select>
         <location src="resources/stylesheets/{1}-to-{2}.xsl"/>
         <location
 
src="{forrest:forrest.plugins}/org.apache.forrest.plugin.output.pdf/resources/stylesheets/{1}-to-{2}.xsl"/>
       </select>
     </match>

coupled with xmap [4] such as of:

<map:transform src="{lm:pdf.transform.document.fo}">

Ross

> [1] http://forrest.apache.org/docs_0_80/locationmap.html
[2] 
http://svn.apache.org/repos/asf/forrest/trunk/main/webapp/locationmap-transforms.xml
[3] 
http://svn.apache.org/repos/asf/forrest/trunk/plugins/org.apache.forrest.plugin.output.pdf/locationmap.xml

Mime
View raw message