You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Sjur Moshagen <sj...@mac.com> on 2006/06/12 15:45:54 UTC
For-each in sitemap?
Hello,
I would like to aggregate a dynamic list of documents following a
certain pattern, but I can't find a way of doing it. I have been
searching the user docs and the mailing lists, to no avail.
Here's what I would like to do, in some rough pseudo-code:
match on request parameter
aggregate:
for-each {value} in the {request parameter}
cocoon:{value}/file
end for-each
end aggregate
transform
serialise
The request parameter would come from a multiple-selection list.
Is something like this possible? If so, how?
Background/use case:
I have an XML db (eXist) with collections of xml documents I need to
query. Each collection contains different types of xml documents, and
the query and subsequent processing needs to be tailored to each
collection. As not all collections are public/searchable, or the user
can specify a subset of them, I can't know in advance which
collections I'm going to search, and subsequently aggregate the
results from. Thus the need to aggregate based on a dynamic list.
Any help greatly appreciated.
Best regards,
Sjur
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: For-each in sitemap?
Posted by Sjur Moshagen <sj...@mac.com>.
Hello Jeroen,
Thanks for your help. As I understand your suggestion, the idea is to
generate a document with the (C)Include elements required, and then
include the dynamically created list of documents with an include
transformation. I assume I can replace the JX-template with something
else that can dynamically create the Include document. This sounds
excellent.
My remaining question regarding this solution is whether the included
documents will be read as is from the db/file system, or whether I
can specify the "cocoon:" protocol in the src attribute in the
include statements, to have the requests processed by the sitemap (I
need the sitemap processing of each include for my application
logic)? I could use the external/extended version of the Include
statements, specifying the server and all, but that requires me to
either dynamically generate the correct server address, or change it
manually whenever I move the application from the development
computer to the deployment server. Not a big thing, but it would
definitely be nicer to just use the cocoon: protocoll:-)
Thanks again!
Best regards,
Sjur
Den 12. jun. 2006 kl. 17.06 skrev Jeroen Reijn:
> Hi Sjur,
>
> I do not know of any solution in the sitemap, but you are able to
> do this:
>
> It should be something like this in pseudo-code:
>
> <map:generate src="request.xml" type="jx/>
> <map:transform type="include"/>
> <map:serialize type="xml"/>
>
> Step1. JX template generator
>
> The generator generates a JX-template. The JX-template has the
> cocoon.request object available to iterate through.
> You can create <include src="file"/> elements for the include
> transformer.
>
> Step2. (C)Include transformer
>
> The (C)Include transformer will fetch your documents from your DB.
>
>
> For more information about both components please take a look at:
>
> http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html
>
> and
>
> http://cocoon.apache.org/2.1/userdocs/cinclude-transformer.html
>
> I hope this will help you out.
>
> Regards,
>
> Reijn
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: For-each in sitemap?
Posted by Jeroen Reijn <j....@hippo.nl>.
Hi Sjur,
I do not know of any solution in the sitemap, but you are able to do this:
It should be something like this in pseudo-code:
<map:generate src="request.xml" type="jx/>
<map:transform type="include"/>
<map:serialize type="xml"/>
Step1. JX template generator
The generator generates a JX-template. The JX-template has the cocoon.request object available to iterate through.
You can create <include src="file"/> elements for the include transformer.
Step2. (C)Include transformer
The (C)Include transformer will fetch your documents from your DB.
For more information about both components please take a look at:
http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html
and
http://cocoon.apache.org/2.1/userdocs/cinclude-transformer.html
I hope this will help you out.
Regards,
Reijn
Sjur Moshagen wrote:
> Hello,
>
> I would like to aggregate a dynamic list of documents following a
> certain pattern, but I can't find a way of doing it. I have been
> searching the user docs and the mailing lists, to no avail.
>
> Here's what I would like to do, in some rough pseudo-code:
>
> match on request parameter
> aggregate:
> for-each {value} in the {request parameter}
> cocoon:{value}/file
> end for-each
> end aggregate
> transform
> serialise
>
> The request parameter would come from a multiple-selection list.
>
> Is something like this possible? If so, how?
>
> Background/use case:
>
> I have an XML db (eXist) with collections of xml documents I need to
> query. Each collection contains different types of xml documents, and
> the query and subsequent processing needs to be tailored to each
> collection. As not all collections are public/searchable, or the user
> can specify a subset of them, I can't know in advance which collections
> I'm going to search, and subsequently aggregate the results from. Thus
> the need to aggregate based on a dynamic list.
>
> Any help greatly appreciated.
>
> Best regards,
> Sjur
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
--
Met vriendelijke groet,
Kind regards,
Jeroen Reijn
Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel +31 (0)20 5224466
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org