On 25/09/2008, at 6:12:36, Gavin wrote:



-----Original Message-----
From: Pablo Barrera [mailto:[EMAIL PROTECTED]
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/