You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mathias Wiegard <Ma...@student.uni-ulm.de> on 2003/07/21 11:16:40 UTC

Reading all XML-files of one folder

Hi,
I want to make something like the users' manual of cocoon. If You know its
sitemap then you will also know the system with book.xml.
Instead of using such a file I want to generate my menu items dynamically by
the articles (xml files) in the accordant folder, e.g. by getting a
"title"-XML-Element of each file in the folder.
Have someone done something like that or an idea how this could be done in
an easy and effective way?
Thanks in advance,
Mat



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Reading all XML-files of one folder

Posted by Upayavira <uv...@upaya.co.uk>.
On Mon, 21 Jul 2003 11:37:47 +0200, "Bruno PIERRE"
<br...@yahoo.fr> said:
> You can use an xsl transform
> 
> and the function document()
> 
> you wil have a stuff like
> 
> <xsl:for-each select="dir:file">
>     <xsl:copy-of select="document(@name)//title"/>
> </xsl:for-each>

You can, but this is not advised, as it breaks the Cocoon caching system.
The document() function therefore shouldn't be used in sites that make
use of Cocoon's caching functionality (which is switched on by default).
Instead xinclude or cinclude transformers should be used (or the
XPathDirectoryGenerator), all of which work with the caching system (that
doesn't mean that they will necessarily be cached, just that the caching
system will know whether or not they have).

Regards, Upayavira

> ----- Original Message -----
> From: "Upayavira" <uv...@upaya.co.uk>
> To: <us...@cocoon.apache.org>
> Sent: Monday, July 21, 2003 11:27 AM
> Subject: Re: Reading all XML-files of one folder
> 
> 
> > On Mon, 21 Jul 2003 11:16:40 +0200, "Mathias Wiegard"
> > <Ma...@student.uni-ulm.de> said:
> > > Hi,
> > > I want to make something like the users' manual of cocoon. If You know
> > > its
> > > sitemap then you will also know the system with book.xml.
> > > Instead of using such a file I want to generate my menu items
> dynamically
> > > by
> > > the articles (xml files) in the accordant folder, e.g. by getting a
> > > "title"-XML-Element of each file in the folder.
> > > Have someone done something like that or an idea how this could be done
> > > in
> > > an easy and effective way?
> >
> > That was the way I started building sites in Cocoon. You can use the
> > XPathDirectoryGenerator to extract specific nodes from files in a
> > specific directory.
> >
> > However, I found that approach to be far too complicated to manage, and
> > in the end opted for a separate 'linkmap', or book.xml file, which has
> > allowed my sites to grow more significantly than the previous approach
> > would have allowed (e.g. dynamically building links to hierarchically
> > organised pages across different levels of the hierarchy, and in
> > different file folders).
> >
> > Hope that helps.
> >
> > Upayavira
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Reading all XML-files of one folder

Posted by Bruno PIERRE <br...@yahoo.fr>.
You can use an xsl transform

and the function document()

you wil have a stuff like

<xsl:for-each select="dir:file">
    <xsl:copy-of select="document(@name)//title"/>
</xsl:for-each>

----- Original Message -----
From: "Upayavira" <uv...@upaya.co.uk>
To: <us...@cocoon.apache.org>
Sent: Monday, July 21, 2003 11:27 AM
Subject: Re: Reading all XML-files of one folder


> On Mon, 21 Jul 2003 11:16:40 +0200, "Mathias Wiegard"
> <Ma...@student.uni-ulm.de> said:
> > Hi,
> > I want to make something like the users' manual of cocoon. If You know
> > its
> > sitemap then you will also know the system with book.xml.
> > Instead of using such a file I want to generate my menu items
dynamically
> > by
> > the articles (xml files) in the accordant folder, e.g. by getting a
> > "title"-XML-Element of each file in the folder.
> > Have someone done something like that or an idea how this could be done
> > in
> > an easy and effective way?
>
> That was the way I started building sites in Cocoon. You can use the
> XPathDirectoryGenerator to extract specific nodes from files in a
> specific directory.
>
> However, I found that approach to be far too complicated to manage, and
> in the end opted for a separate 'linkmap', or book.xml file, which has
> allowed my sites to grow more significantly than the previous approach
> would have allowed (e.g. dynamically building links to hierarchically
> organised pages across different levels of the hierarchy, and in
> different file folders).
>
> Hope that helps.
>
> Upayavira
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Reading all XML-files of one folder

Posted by Justin Makeig <li...@makeig.com>.
Using the file system to organize xml snippets has been tricky in the portal
project on which I've been working. The solution I came up with was to write
a transformation on the xml output of the DirectoryGenerator that grabs
metadata from each file. This is done at design time and thus can be cached
at run time. Furthermore, when transforming individual documents, I
aggregate the table of contents doc with the requested doc. Thus, I can take
advantage of caching by not having to reference the toc document using
XSLT's document() function. It also allows me to use XSLT keys to
efficiently dereference cross-references.

- Justin Makeig

--
Center for Document Engineering
University of California, Berkeley



On 7/21/03 2:27 AM, "Upayavira" <uv...@upaya.co.uk> wrote:

> On Mon, 21 Jul 2003 11:16:40 +0200, "Mathias Wiegard"
> <Ma...@student.uni-ulm.de> said:
>> Hi,
>> I want to make something like the users' manual of cocoon. If You know
>> its
>> sitemap then you will also know the system with book.xml.
>> Instead of using such a file I want to generate my menu items dynamically
>> by
>> the articles (xml files) in the accordant folder, e.g. by getting a
>> "title"-XML-Element of each file in the folder.
>> Have someone done something like that or an idea how this could be done
>> in
>> an easy and effective way?
> 
> That was the way I started building sites in Cocoon. You can use the
> XPathDirectoryGenerator to extract specific nodes from files in a
> specific directory.
> 
> However, I found that approach to be far too complicated to manage, and
> in the end opted for a separate 'linkmap', or book.xml file, which has
> allowed my sites to grow more significantly than the previous approach
> would have allowed (e.g. dynamically building links to hierarchically
> organised pages across different levels of the hierarchy, and in
> different file folders).
> 
> Hope that helps.
> 
> Upayavira
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Reading all XML-files of one folder

Posted by Upayavira <uv...@upaya.co.uk>.
On Mon, 21 Jul 2003 11:16:40 +0200, "Mathias Wiegard"
<Ma...@student.uni-ulm.de> said:
> Hi,
> I want to make something like the users' manual of cocoon. If You know
> its
> sitemap then you will also know the system with book.xml.
> Instead of using such a file I want to generate my menu items dynamically
> by
> the articles (xml files) in the accordant folder, e.g. by getting a
> "title"-XML-Element of each file in the folder.
> Have someone done something like that or an idea how this could be done
> in
> an easy and effective way?

That was the way I started building sites in Cocoon. You can use the
XPathDirectoryGenerator to extract specific nodes from files in a
specific directory.

However, I found that approach to be far too complicated to manage, and
in the end opted for a separate 'linkmap', or book.xml file, which has
allowed my sites to grow more significantly than the previous approach
would have allowed (e.g. dynamically building links to hierarchically
organised pages across different levels of the hierarchy, and in
different file folders).

Hope that helps.

Upayavira

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Reading all XML-files of one folder

Posted by Alexander Schatten <al...@gmx.at>.
Mathias Wiegard wrote:

>Hi,
>I want to make something like the users' manual of cocoon. If You know its
>sitemap then you will also know the system with book.xml.
>Instead of using such a file I want to generate my menu items dynamically by
>the articles (xml files) in the accordant folder, e.g. by getting a
>"title"-XML-Element of each file in the folder.
>Have someone done something like that or an idea how this could be done in
>an easy and effective way?
>Thanks in advance,
>Mat
>
>
>
>  
>
I have written a Wiki article dealing precisely with this problem; maybe 
you want to consult this:

http://wiki.cocoondev.org/Wiki.jsp?page=ContentAggregationExample


alex



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org