On Sat, Oct 12, 2002 at 02:08:16PM +0100, Alex McLintock wrote:
> Hi folks,
> 
> I am trying to figure out how to get Cocoon to display all the xml files in 
> a directory without being explicitly told each of their names in the 
> sitemap.

Have a look at the XPathDirectoryGenerator in the scratchpad. With it,
you can generate a directory listing, with a node extracted from each
file. Eg, I used it to extract <description> elements from a list of Ant
scripts:

http://aft.sourceforge.net/examples/

The relevant config was:

<map:sitemap ..
  <map:components ..
    <map:generators ..
      <map:generator  name="xpathdirectory"
        src="org.apache.cocoon.generation.XPathDirectoryGenerator"/>

  .....
  <!-- examples/index.html, listing all scripts -->
  <map:match pattern="examples/index.xml">
    <map:generate type="xpathdirectory"
      src="content/xdocs/examples#/project/description"/>
    <map:transform
      src="resources/stylesheets/antdirectory2document.xsl"/>
    <map:serialize type="xml"/>
  </map:match>


--Jeff


> I guess I need a combination of the Directory Generator and the Aggregation 
> tools.
> 
> I am not too worried about the order of the files otherwise I would have to 
> use an XML database - which I would like to avoid if possible.
> 
> PS I have looked in the Langham/Ziegeler book but can't find anything 
> useful.
> 
> Do I need to write a DirectoryAggregation Generator in Java? perhaps others 
> would find it useful too.
> 
> Alex

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to