Mailing List Archive

Using locationmap in sitemap.xmap
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?

Thanks

[1] http://forrest.apache.org/docs_0_80/locationmap.html

--
Pablo Barrera
http://gsyc.es/~barrera/
Re: Using locationmap in sitemap.xmap [ In reply to ]
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
Re: Using locationmap in sitemap.xmap [ In reply to ]
Den 23. sep. 2008 kl. 20.58 skrev Pablo Barrera:

> 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}" />

To me, this looks like a typo. It should be 'transform.X.Y', not
'transformation.X.y'.

Try that, and report back:)

Best regards,
Sjur
Re: Using locationmap in sitemap.xmap [ In reply to ]
Sjur Moshagen wrote:
> Den 23. sep. 2008 kl. 20.58 skrev Pablo Barrera:
>
>> 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}" />
>
> To me, this looks like a typo. It should be 'transform.X.Y', not
> 'transformation.X.y'.
>
> Try that, and report back:)
>


Ahhh... good spot I missed that.

Ross
Re: Using locationmap in sitemap.xmap [ In reply to ]
On 24/09/2008, at 7:30:48, Sjur Moshagen wrote:

> Den 23. sep. 2008 kl. 20.58 skrev Pablo Barrera:
>
>> 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}" />
>
> To me, this looks like a typo. It should be 'transform.X.Y', not
> 'transformation.X.y'.
>
> Try that, and report back:)
>

Is not working with this change either.

Thanks

Pablo


--
Pablo Barrera
http://gsyc.es/~barrera/
Re: Using locationmap in sitemap.xmap [ In reply to ]
On 23/09/2008, at 23:34:51, Ross Gardler wrote:

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

The former solution is not working for me. I don't know way. So I will
go for the second one.

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

Do you think so? Maybe it could be part of the tei input plugin, but I
am not sure.

My idea (but I am still missing some things in forrest) is that tei
input plugin should read the change record and include this
information into the metadata of the internal document. Other part
should read the content of a directory with different formats but
providing a change record. So I don't know if right location is the
plugin directory or a new plugin.

Anyone, the first step is to have this thing working. :-)

> 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}">
>

Where is [4]?

> 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

--
Pablo Barrera
http://gsyc.es/~barrera/
Re: Using locationmap in sitemap.xmap [ In reply to ]
Pablo Barrera wrote:
>
> On 23/09/2008, at 23:34:51, Ross Gardler wrote:
>
>> 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.
>>
>
> The former solution is not working for me. I don't know way. So I will
> go for the second one.

The implication there is the second, more general solution is working -
is that correct?

>> 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.
>>
>
> Do you think so? Maybe it could be part of the tei input plugin, but I
> am not sure.
>
> My idea (but I am still missing some things in forrest) is that tei
> input plugin should read the change record and include this information
> into the metadata of the internal document. Other part should read the
> content of a directory with different formats but providing a change
> record. So I don't know if right location is the plugin directory or a
> new plugin.

I'm sorry, I was second guesing what you are doing. I thought you were
working on the TEI output plugin. You are correct, this should not be
part of the TEI input plugin.

>> 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}">
>>
>
> Where is [4]?

Not sure it is relevant now as I was getting my inputs and outputs mixed
up. But for completeness [4] is the output.xmap in the PDF plugin - the
clue is in the locationmap naming convention of PLUGIN.***

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
>>
>
> --
> Pablo Barrera
> http://gsyc.es/~barrera/
>
RE: Using locationmap in sitemap.xmap [ In reply to ]
> -----Original Message-----
> From: Pablo Barrera [mailto:barrera@gsyc.es]
> Sent: Wednesday, 24 September 2008 11:42 PM
> To: user@forrest.apache.org
> Subject: Re: Using locationmap in sitemap.xmap
>
>
> On 24/09/2008, at 7:30:48, Sjur Moshagen wrote:
>
> > Den 23. sep. 2008 kl. 20.58 skrev Pablo Barrera:
> >
> >> 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}" />
> >
> > To me, this looks like a typo. It should be 'transform.X.Y', not
> > 'transformation.X.y'.
> >
> > Try that, and report back:)
> >
>
> Is not working with this change either.

Ok, I'll give it one go assuming you haven't solved it already.

Are you talking about in the input.xmap (or output.xmap) of the plugin.

In the case of the tei input plugin ,currently the locationmap.xml has
a match pattern entry of :-

match pattern="tei.transform.*.*"

so the corresponding entry in input.xmap should look something like

<map:transform src="{lm:tei.transform.alldocs.revisions}" />

Not sure if that helps.

Gav...


>
> Thanks
>
> Pablo
>
>
> --
> Pablo Barrera
> http://gsyc.es/~barrera/
>
>
> --
> Internal Virus Database is out-of-date.
> Checked by AVG.
> Version: 7.5.524 / Virus Database: 270.6.21 - Release Date: 9/11/2008
> 12:00 AM
Re: Using locationmap in sitemap.xmap [ In reply to ]
On 25/09/2008, at 6:12:36, Gavin wrote:

>
>
>> -----Original Message-----
>> From: Pablo Barrera [mailto:barrera@gsyc.es]
>> Sent: Wednesday, 24 September 2008 11:42 PM
>> To: user@forrest.apache.org
>> Subject: Re: Using locationmap in sitemap.xmap
>>
>>
>> On 24/09/2008, at 7:30:48, Sjur Moshagen wrote:
>>
>>> Den 23. sep. 2008 kl. 20.58 skrev Pablo Barrera:
>>>
>>>> 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}" />
>>>
>>> To me, this looks like a typo. It should be 'transform.X.Y', not
>>> 'transformation.X.y'.
>>>
>>> Try that, and report back:)
>>>
>>
>> Is not working with this change either.
>
> Ok, I'll give it one go assuming you haven't solved it already.
>
> Are you talking about in the input.xmap (or output.xmap) of the
> plugin.
>

Is still broken for me. I will try to explain a little bit more what I
am trying to do. I have a lot of TEI documents in one directory. Each
document includes a section with a change record. I want to show a
page with links to each document and the information for each revision
(stored in the change record).

For doing so I looked into the Resume plugin just to get ideas. I am
working in my local site instead of changing any plugin. I though it
should be easier :-)

The changes are in src/documentation/sitemap.xmap b/wiki2tei/src/
documentation/sitemap.xmap and they look like this:

<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components>
<map:generators>
<map:generator name="directory"
src="org.apache.cocoon.generation.DirectoryGenerator"/>
</map:generators>
<map:transformers>
<map:transformer name="cinclude"
src="org.apache.cocoon.transformation.CIncludeTransformer"/>
</map:transformers>
<map:actions>
<map:action logger="sitemap.action.sourcetype"
name="sourcetype" src="org.apache.forrest.sourcetype.SourceTypeAction">
<sourcetype name="hello-v1.0">
<document-declaration public-id="-//Acme//DTD Hello
Document V1.0//EN" />
</sourcetype>
</map:action>
</map:actions>
<map:selectors default="parameter">
<map:selector logger="sitemap.selector.parameter"
name="parameter" src="org.apache.cocoon.selection.ParameterSelector" />
</map:selectors>
</map:components>
<map:resources>
<map:resource name="source-file-resolver">
<map:select type="exists">
<map:when test="{uri}.xml">
<map:generate src="{properties:content.xdocs}{uri}.xml"/>
<map:transform type="xinclude"/>
<map:serialize type="xml"/>
</map:when>
<map:when test="{properties:content.xdocs}{uri}.xml">
<map:generate src="{properties:content.xdocs}{uri}.xml"/>
<map:transform type="xinclude"/>
<map:serialize type="xml"/>
</map:when>
</map:select>
</map:resource>
<map:resource name="transform-to-document">
<map:act type="sourcetype" src="{src}">
<map:select type="parameter">
<map:parameter name="parameter-selector-test"
value="{sourcetype}" />
<map:when test="hello-v1.0">
<map:generate src="{properties:content.xdocs}{../../
1}.xml" />
<map:transform src="{properties:resources.stylesheets}/
hello2document.xsl" />
<map:serialize type="xml-document"/>
</map:when>
</map:select>
</map:act>
</map:resource>
</map:resources>
<map:pipelines>
<map:pipeline>
<map:match pattern="old_site/*.html">
<map:select type="exists">
<map:when test="{properties:content}{1}.html">
<map:read src="{properties:content}{1}.html" mime-
type="text/html"/>
<!--
Use this instead if you want JTidy to clean up your HTML
<map:generate type="html" src="{properties:content}/{0}" />
<map:serialize type="html"/>
-->
</map:when>
</map:select>
</map:match>

<map:match pattern="wiki/**.xml">
<map:generate src="{lm:project.wiki/{1}.xml}" />
<map:transform
src="{lm:simplifiedDocbook.transform.sdocbook.document}" />
<map:serialize type="xml-document"/>
</map:match>

<map:match pattern="**.xml">
<map:call resource="transform-to-document">
<map:parameter name="src" value="{properties:content.xdocs}
{1}.xml" />
</map:call>
</map:match>

<map:match pattern="resources/resume.source.xml">
<map:generate src="cocoon:/resources/all.source.xml"/>
<map:transform src="{lm:transform.alldocs.revisions}">
<map:parameter name="candidateSkill" value="{1}"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>

<map:match pattern="resources/all.source.xml">
<map:generate type="directory"
src="{properties:content.xdocs}/resources/">
<map:parameter name="include" value=".*\.xml$"/>
</map:generate>
<map:transform src="{lm:transform.revisions.directory}"/>
<map:transform type="cinclude"/>
<map:serialize type="xml"/>
</map:match>

</map:pipeline>
</map:pipelines>
</map:sitemap>

The stylesheets use cinclude to put all the content of files together
and the filter it to show just the change record. If I use the path I
mentioned before the system is working correctly.


Further work:
My idea is to change a little bit the TEI input module to read the
change record and put it as metadata in the internal representation
and use this information instead of the original TEI documents.


> In the case of the tei input plugin ,currently the locationmap.xml has
> a match pattern entry of :-
>
> match pattern="tei.transform.*.*"
>
> so the corresponding entry in input.xmap should look something like
>
> <map:transform src="{lm:tei.transform.alldocs.revisions}" />
>
> Not sure if that helps.
>

My stylesheets are at MYSITE/src/documentation/resources/stylesheets
so I can't use the locationmap for the plugin.

Thanks

Pablo



--
Pablo Barrera
http://gsyc.es/~barrera/