You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Daniel Süpke <su...@gmx.de> on 2007/01/07 13:27:52 UTC

including multiple xml files into transformation

Hi,

I read a couple of websites about Cocoon and took a look inside the
samples and Cocoon seems to be really nice, especially since I need to
have various output formats later (pdf, html, ...).

But right now, I am having a rather basic question (I guess). I want to
include and transform contents of a xml-file into another xml-file,
e.g.: xml1 is the generator with all the contents for the
overall-structure of the page, being transformed by some xsl-file. The
contents has various block with headings etc. Inside these blocks I want
to parse external xml-files, which contain the actual data to be
represented.

Its like some newssite, where content like menus... is created by xml1
and the news need to be parsed somewhere into the output by other xml-files.

What is the best way doing that? I thought of aggregation, but that's
not really that good since the xml-file's output does not need to be
concatenated, instead the second file's output should be included
somewhere in the first file's.

Hope I could explain the problem somewhat understandable ;).

Greeting,
Daniel Süpke

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


Re: including multiple xml files into transformation

Posted by Benjamin Boksa <ma...@boksa.de>.
Hi Daniel,

> Hope I could explain the problem somewhat understandable ;).

If I understood your question you might want to take a look at:

http://cocoon.apache.org/2.1/userdocs/xinclude-transformer.html
http://cocoon.apache.org/2.1/userdocs/cinclude-transformer.html

HTH,

Benjamin

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


Re: including multiple xml files into transformation

Posted by Daniel Süpke <su...@gmx.de>.
Hey, thanks for all your help! That's seems to be pretty much what I
searched for :).

Regards,
Daniel Süpke

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


Re: including multiple xml files into transformation

Posted by Tobia <to...@linux.it>.
Mark Lundquist wrote:
> The use of document() in Cocoon is discouraged, because it doesn't
> play nice with cache validity.  If the content supplied by the
> included resource changes, Cocoon has no way of knowing it and will
> serve stale content from the cache.

What if I only reference static files, as in document('data.xml'), and
not Cocoon urls?  I just did a test and there doesn't seem to be any
cache problem, probably because the XSLT processor reads the file from
disk every time.  Is this kind of usage discouraged/inefficient?


Tobia

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


Re: including multiple xml files into transformation

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Jan 7, 2007, at 6:13 AM, Toby wrote:

> 2. XSLT's (actually XPath's) document() function
>
> The document() function allows you to access more than one xml source
> file from within a XSLT.  See for example the "styleless stylesheet"
> approach (it was on some blog... I don't have the link handy right now)

Hi guys,

The use of document() in Cocoon is discouraged, because it doesn't play 
nice with cache validity.  If the content supplied by the included 
resource changes, Cocoon has no way of knowing it and will serve stale 
content from the cache.  At least, that was the case at one time, and 
as far as I know it still is.

best regards,
—ml—


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


Re: including multiple xml files into transformation

Posted by Toby <to...@linux.it>.
Daniel Süpke wrote:
> xml1 is the generator with all the contents for the overall-structure
> of the page, being transformed by some xsl-file. The contents has
> various block with headings etc. Inside these blocks I want to parse
> external xml-files, which contain the actual data to be represented.

I know of two easy ways to accomplish it.  Maybe there are more.

1. Cocoon's CInclude transformer

You can use an xsl file to add cinclude tags to the relevant blocks in
the first file, then pass it all through the cinclude transformer, then
maybe through another xsl transformation, to prune unnecessary tags left
over from the cinclude step.

2. XSLT's (actually XPath's) document() function

The document() function allows you to access more than one xml source
file from within a XSLT.  See for example the "styleless stylesheet"
approach (it was on some blog... I don't have the link handy right now)


Toby

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


RE: including multiple xml files into transformation

Posted by Andrew Stevens <at...@hotmail.com>.
>From: Daniel Süpke <su...@gmx.de>
>Date: Sun, 07 Jan 2007 13:27:52 +0100
>
>Hi,
>
>I read a couple of websites about Cocoon and took a look inside the
>samples and Cocoon seems to be really nice, especially since I need to
>have various output formats later (pdf, html, ...).
>
>But right now, I am having a rather basic question (I guess). I want to
>include and transform contents of a xml-file into another xml-file,
>e.g.: xml1 is the generator with all the contents for the
>overall-structure of the page, being transformed by some xsl-file. The
>contents has various block with headings etc. Inside these blocks I want
>to parse external xml-files, which contain the actual data to be
>represented.
>
>Its like some newssite, where content like menus... is created by xml1
>and the news need to be parsed somewhere into the output by other 
>xml-files.
>
>What is the best way doing that? I thought of aggregation, but that's
>not really that good since the xml-file's output does not need to be
>concatenated, instead the second file's output should be included
>somewhere in the first file's.

That doesn't necessarily rule out sitemap aggregation, though.  Just follow 
the map:aggregate with an XSL transformation that reorders the combined 
document to move the later parts into the correct places within the first 
one.

On the other hand, if the files to be included are determined dynamically by 
the first document (or, say, the output from the directory generator), then 
the include transformers that Benjamin mentioned are probably a better 
solution.

>Hope I could explain the problem somewhat understandable ;).
>
>Greeting,
>Daniel Süpke


Andrew.
--
http://pseudoq.sourceforge.net/  Open source Java Sudoku generator/solver.

_________________________________________________________________
MSN Hotmail is evolving – check out the new Windows Live Mail 
http://ideas.live.com


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