forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ross Gardler <rgard...@apache.org>
Subject Re: Aggregation Example
Date Tue, 01 Feb 2005 10:16:12 GMT
David Crossley wrote:

>Stefan Baramov wrote:
>  
>
>>Okay, my real question is how to aggregate unknown number of documents?
>>
>>Here is my case (using Forrest 0.6): In my xdocs folder I have a folder called tasks.
It contains a collection of XML formatted files, where each file describes a single task.
I like to aggregate them all in one single document "Task Summary". Here is what I have in
site.xml file:
>>
>>--- site.xml ---
>>
>>  <about label="MyProd" tab="home">
>>    <index label="Welcome" href="index.html" description="Welcome to MyProd"/>
>>    <tasksummary label="Task Summary" href="tasksummary.html"/>
>>  </about>
>>
>>Here the tasksummary.html points to a tasksummary.xml pipeline defined in sitemap.xmap
(It took me a significant time to figure out that a pipeline is matched by its "pattern" instead
of sort of ID)
>>
>><map:pipeline>
>>	<map:match pattern="teamtask2section">
>>		<map:generate src="{project:content.xdocs}/tasks/B001.teamtask" />
>>		<map:transform src="{project:resources.stylesheets}/teamtask2sec.xsl" />
>>		<map:serialize type="xml"/>
>>	</map:match>
>></map:pipeline>
>>	
>><map:pipeline>
>>	<map:match pattern="tasksummary.xml">
>>		<map:aggregate element="document">
>>			<map:part src="{project:content.xdocs}/task_header.xml" element="header"/>
>>			<map:part src="cocoon:/teamtask2section" element="body"/>
>>			<map:part src="{project:content.xdocs}/footer.xml" element="footer"/>
>>		</map:aggregate>
>>		<map:serialize type="xml"/>
>>	</map:match>
>></map:pipeline>
>>
>>where:
>>	task_header.xml is a generic header file. 
>>	footer.xml is a generic footer XML file
>>
>>The real problem is that in the teamtask2section pipeline I can specify only one task
file B001.teamtask. And I have multiple: B002, B003 and so on. I tried wildcards such as :

>>	<map:generate src="{project:content.xdocs}/tasks/*.teamtask" />
>>But it does not work. So how do I aggregate unknown number of XML files located in
subdirectory of xdocs?
>>    
>>
>
>Oh that is easy. Use the Cocoon "Directory generator".
>http://cocoon.apache.org/2.1/userdocs/generators/directory-generator.html
>
>  
>
In addition to these docs you can see an example of it used in Forrest 
in the photoGallery plugin.

Ross


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.2 - Release Date: 28/01/2005


Mime
View raw message