cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <coc...@lojjic.net>
Subject Re: accessing xml files
Date Wed, 28 Dec 2005 14:44:17 GMT
As Bertrand suggested, you can use the CIncludeTransformer (or XInclude) 
to aggregate the 3 sources.  <map:aggregate> is not the only way to 
perform an aggregation (see the "Content Syndication and Aggregation" 
section in the Cocoon samples[1] for several approaches).

So from your directory generator output, feed it through a simple XSLT 
to create your include-statements, something like this:

<xsl:stylesheet xmlns:dir="..." xmlns:ci="..." xmlns:xsl="...">
   <xsl:template match="dir:directory">
     <newroot>
       <xsl:apply-templates>
         <xsl:with-param name="path" select="@test" />
       </xsl:apply-templates>
     </newroot>
   </xsl:template>
   <xsl:template match="dir:file">
     <xsl:param name="path" />
     <ci:include src="{$path}/{@name}" />
   </xsl:template>
</xsl:stylesheet>

Then pass that through the CIncludeTransformer and your content will be 
aggregated.

Hope that helps
--Jason

[1] http://cocoon.zones.apache.org/demos/release/samples/aggregation/


kavitha ramesh wrote:
> by using the directory generator i got the result:
>  
>  <?xml version="1.0" encoding="ISO-8859-1" ?>
>  <dir:directory name="test" lastModified="1135688164000" date="12/27/05 
> 1:56 PM" size="0" sort="name" reverse="false" requested="true" 
> xmlns:dir="http://apache.org/cocoon/directory/2.0">
>   <dir:file name="A.xml" lastModified="1135774358000" date="12/28/05 
> 1:52 PM" size="718" />
>   <dir:file name="B.xml" lastModified="1135774358000" date="12/28/05 
> 1:52 PM" size="718" />
>   <dir:file name="C.xml" lastModified="1135774300000" date="12/28/05 
> 1:51 PM" size="735" />
>   </dir:directory>
>  
> Now I would like to aggregate A.xml, B.xml and C.xml and then do xslt 
> transformation,,,say,,,
>  
>  <map:match pattern="ABC.html">
>  <map:aggregate element="newroot">
>   <map:part src="A.xml"/>
>   <map:part src="B.xml"/>
>   <map:part src="C.xml"/>
>    </map:aggregate>
>   <map:transform src="style/xsl/ABC.xsl"/>
>   <map:serialize type="html"/>
> How do I perform this???
>  
> Please help me,,,
>  
> Rgds
> Kavitha
>  
>  
> 
> */Bertrand Delacretaz <bdelacretaz@apache.org>/* wrote:
> 
>     Le 27 déc. 05, à 14:22, kavitha ramesh a écrit :
> 
>      > ...I have 3 xml files in a directory say A.xml,B.xml,C.xml.The names
>      > A, B, C changes into A1,B1,C1 after 5 minutes.And after 5 minutes it
>      > changes to A2,B2, C2 and so on...Now my sitemap looks like this,,,
> 
>     Cocoo n's DirectoryGenerator allows you to list the contents of a
>     directory.
> 
>     See http://cocoon.apache.org/2.1/userdocs/directory-generator.html
> 
>     You can then filter the output to keep the names of the files that are
>     of interest to you, and generate an input document for the
>     CIncludeTransformer, which will get the file contents.
> 
>     See http://cocoon.apache.org/2.1/userdocs/cinclude-transformer.html
> 
>     -Bertrand
> 
> 
> ------------------------------------------------------------------------
> Yahoo! for Good - Make a difference this year. 
> <http://us.rd.yahoo.com/mail_us/taglines/charity/*http://brand.yahoo.com/cybergivingweek2005/>

> 


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


Mime
View raw message