forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Baramov" <Stefan.Bara...@trx.com>
Subject RE: Aggregation Example
Date Mon, 31 Jan 2005 23:41:12 GMT
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?

Thanks
Stefan 

-----Original Message-----
From: David Crossley [mailto:crossley@apache.org]
Sent: Monday, January 31, 2005 4:43 PM
To: user@forrest.apache.org
Subject: Re: Aggregation Example


Stefan Baramov wrote:
> Can someone post a simple aggregation example. I've read the user mail list, I've searched
Forrest and Cocoon documentation on aggregation, and I found very little information. It has
to be simple but I can get it right. I have no experience with Cocoon and I am getting lost.

> 
> I would like to aggregate several XML files in a single one. 
> How do I define my pipeline (in sitemap.xmap)? 
> Or do I need multiple piplelines? 

http://cocoon.apache.org/2.1/userdocs/concepts/sitemap.html#Aggregating
http://cocoon.apache.org/2.1/userdocs/concepts/sitemap.html#Protocols

There is an example in the Forrest core, but perhaps we should
put a very basic example in the "forrest seed" site.

You have not told us which version of forrest you are using.
For the current trunk (i.e. 0.7-dev) see webapp/sitemap.xmap
around line 490 and follow the aggregation where it gets its
parts from other sitemap matches using the "cocoon:" protocol.

> How do I link the generate document with site.xml?

Aggregation is done in the sitemap.xmap ... that is nothing
to do with site.xml ... We need an FAQ to reduce the
confusion caused by the name site.xml

--David

Mime
View raw message