Andy J wrote:
Has anyone done something to populate a tab from an aggregation of files in a directory? I read in the documentation (http://forrest.apache.org/docs/linking.html#menu_generation) about using an alternative tab generation method to select by directory - but I don't want that methodology for every tab, just one. That is, what I'm trying to do is have one tab that gets its entries from all the files in a certain directory, e.g.:
<foolist label="Foos" href="foos/" tab="foolist"> <!-- picks up all entries in foos/ and does their transformation as per the pipeline --> <summary label="Summary" href="foos/"/> </foolist>
If I understand the documentation, it's pretty clear on how to create a pipeline for processing the object files themselves into XML but I'm not sure how I'd go about getting the tab setup.
Could anyone offer anything with the tabs and/or sitemap entry?
This is not currently possible, although it has been discussed before as a possible enhancement. If you fancy having a go at creating this functionality that would be cool. Here are a few pointers:
- tab.xml is processed in tabs.xmap
- cocoon provides a directory generator http://cocoon.apache.org/2.1/userdocs/generators/directory-generator.html
Try something like:
<map:select type="exists">
<map:when test="{project:content.xdocs}tabs.xml">
<!-- process as per current behaviour -->
</map:when>
<map:otherwise>
<!-- use directory generator to read directory, transform with XSL an serialise -->
</map:otherwise>
</map:select>
Just realised this is too simple, I'm rushing to get through mail backlogs and not thinking it through properly. The above will only create the <!-- picks up all entries in foos/ and does their transformation as per the pipeline --> part of your requirement. It will not allow you to include this in an existing tabs.xml file. In order to do this you need to have the tabs.xml file include the relevant entries. The best way to do this would be to use XInclude so you would have something like:
<xi:include href="do/generateDirTabs/ROOT_DIR"/>
Then use the cocoon directory generator linked to above to generate the XML file to be included at this point.
Note that this is well beyond the scope of the user mail list, this is now developer stuff. If you want to pursue this further please move the discussion to the dev list.
Ross
-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.6.8 - Release Date: 03/01/2005
