forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Evangelos Vlachogiannis <evl...@aegean.gr>
Subject Re: Generating an aggregated xml from all the files in a directory
Date Sat, 03 Mar 2007 21:19:56 GMT
Hi Vasili,

lets say you have n xml files in a dir with root elements 
<article></article>

<map:generate type="xpathdirectory" src="the/requested/directory">
    <map:parameter name="xpath" value="/article"/>
    <map:parameter name="xmlFiles" value="\.x.*$"/>
  </map:generate>

this will return something like:

<dir:directory xmlns:dir="http://apache.org/cocoon/directory/2.0"
    name="articles" lastModified="1057183738609" date="03.07.03 00:08" size="0"
    requested="true" sort="name" reverse="false">
  <dir:file name="article1.xml" lastModified="1057183738609" date="03.07.03 00:08" size="123">
    <dir:xpath query="/article">
      <article>My first article - whole xml!</article>
    </dir:xpath>
  </dir:file>
  <dir:file name="article2.xml" lastModified="1057183738609" date="03.07.03 00:08" size="123">
    <dir:xpath query="/article">
      <article>My second article - whole xml!</article>
    </dir:xpath>
  </dir:file>
</dir:directory>

Then you can play with 1 or more xslt files and get the serialization 
you need.

But remember you need to check if this generator is included in 
forrest... I do not know... I have used that with cocoon, no with 
forrest...

Vangelis

Vassilis Koutavas wrote:
> Thanks Vangeli,
>
> So let me get this straight. Can I write:
>
> <dir:directory xmlns:dir="http://apache.org/cocoon/directory/2.0"
>    name="the/dir/" sort="name" reverse="false">
>  <dir:file name="*.xml">
>    <dir:xpath query="*"/>
>  </dir:file>
> </dir:directory>
>
> to get all the contents of all files in the/directory? (I'm sorry but
> I'm ignorant about xpath)
>
> Then the question is how do I put this in a forrest's aggregation. Or
> I don't need an aggregation if I use this?
>
> --Vassilis
>
> On 3/3/07, Evangelos Vlachogiannis <evlach@aegean.gr> wrote:
>> Hi Vasili,
>>
>> I think you need Xpathdirectory Generator
>> (http://cocoon.apache.org/2.1/userdocs/xpathdirectory-generator.html). I
>> hope this is included in forrest..
>> Then you just have a root element (elements) and call an xpath
>> expression to include what ever elements you need from xmls in dir.
>>
>> hope that helps,
>> Vangelis
>>
>> Vassilis Koutavas wrote:
>> > What is the right way to create one aggregated xml file from all the
>> > xml files in a directory?
>> > I think I need to use map:aggregate, map:part, and dir:directory in my
>> > sitemap.xml, but I don't quite understand how to put them together. I
>> > don't know how many files will be in the directory, thus I don't know
>> > how many parts the aggregation will have.
>> >
>> > Let's say that in my xdocs I have the directory called "the/dir/" in
>> > which there are a number of xml files, and I want to create a file
>> > called "the-list.xml" (in the same direcory) which will contain the
>> > contents of all the xml files in that directory, under a common
>> > element called "elements". After I have this I know how to transform
>> > it using an xsl, and produce the final html file.
>> >
>> > Best
>>
>> -- 
>> ---------------------------------------------------------------
>> Evangelos Vlachogiannis
>> Researcher - PhD. Candidate
>> Contact: http://www.syros.aegean.gr/users/evlach/contactme.php
>> ---------------------------------------------------------------
>>
>>
>
>

-- 
---------------------------------------------------------------
Evangelos Vlachogiannis
Researcher - PhD. Candidate
Contact: http://www.syros.aegean.gr/users/evlach/contactme.php
--------------------------------------------------------------- 


Mime
View raw message