You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by jerome iffrig <je...@anitesystems.de> on 2002/08/05 13:59:27 UTC

RE: === Cocoon + Localisation + Dynamic + database : Need point of view === FOLLOW-UP

What I mean by :-

"[...] I have been told that Cocoon was able to make this together very
efficiently (I have even been told that I could keep track [e.g. path of the
localized documents] and make them dynamically available in real time as the
content grows) using COCOON. [...]"

Is that I have been told that it was possible to use a database (which could
be updated anytime whenever content need to be added [e.g. containing to
path to the localized documents]) in association with Cocoon.
The reason being is that as far as I understand the sitemap file is a sort
of "hard codding of the content" - I would like to have a way to tell
Cocoon:
Ok, someone has asked for a document named "HollidaysInNice" in French -> I
would like to have a way to tell Cocoon to do the following:
A Document named "HollidaysInNice" in French has been requested - Let's have
a look in the database to see if a French rendition of this document has
been inserted recently - If so, lookup for the path of this rendition (ther
XML file containing the data itself of the document) in this very same
database - THEN, make a like between the XML document and the layout to be
applied to it (this last operation should be done in some way by sitemap as
I understand).

Is this still possible to be done by Cocoon? Do anyone has a sample or a
piece of code for me to practice this sort of operation?

Many thanks to Piroumin Konstantin for his previous (very quick) answer :o)

-----Original Message-----
From: Piroumian Konstantin [mailto:KPiroumian@protek.com]
Sent: Monday, August 05, 2002 12:59 PM
To: 'cocoon-users@xml.apache.org'
Subject: RE: === Cocoon + Localisation + Dynamic + database : Need point of
view ===


> From: jerome iffrig [mailto:jerome.iffrig@anitesystems.de]
>
> I am building an internationalized website.
>
> I would like all the pages (related to a given topic) to be
> displayed with a
> common layout.
> For instance, let's say I want to create a page about
> recycling paper - I
> would like the page to use the same layout for the French,
> German, English
> and Spanish languages - Hence ONE single presentation layer template
> associated with 4 versions of XML files representing the
> content of the page
> in different languages.

No problems with this, just use a single stylesheet to render all the pages.
This is done in the sitemap by using a pipeline which should process all
"*.xml" files with say "layout.xsl" stylesheet. Take a look at the Hello
world samples in Cocoon.

> Furthermore my user should be able do dynamically add new pages (new
> topics). This page will initially be entered by the user in
> any of the 4
> languages (let's say French) - the following hours (or days),
> some other
> users might decide to edit an other localized version of the
> same document -
> These now localized versions of the content of the document need to be
> dynamically available to the users.

Just place a new file under your application context and it will be
processed as all the rest.

>
> I have been told that Cocoon was able to make this together
> very efficiently
> (I have even been told that I could keep track [e.g. path of
> the localized
> documents] and make them dynamically available in real time
> as the content
> grows) using COCOON.

Don't quite understand this one. What does it mean 'path of the localized
documents'?

>
> I have installed cocoon, Have a database ready (MySQL),
> Servlet container
> and everything that is needed for the implementation - I have
> read some
> substantial documentation about cocoon (including official
> documentation and
> had a look at the sample codes) but cannot figure out how to
> glue everything
> together - Basically I don't know how and where to start :o(

Start from learning the sitemap. It is the point where you tie everything
together.

>
> Please let me know any comment - Let me know if Cocoon is
> really a solution
> for the things I want to implement - Even send me some sample
> code if you
> have any that could put me on track :o)

I think that Cocoon is the right choice for your case. There are some very
good samples in Cocoon distro. Just learn the sitemap and take a look at
them. Also, you can always ask here if you have any questions.

Konstantin

>
> Thanks in advance!
>
> Vidauabannais
>
>
> ---------------------------------------------------------------------
> 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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>

---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>



---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: === Cocoon + Localisation + Dynamic + database : Need point of view === FOLLOW-UP

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 05.Aug.2002 -- 01:59 PM, jerome iffrig wrote:
> What I mean by :-
> 
> "[...] I have been told that Cocoon was able to make this together very
> efficiently (I have even been told that I could keep track [e.g. path of the
> localized documents] and make them dynamically available in real time as the
> content grows) using COCOON. [...]"
> 
> Is that I have been told that it was possible to use a database (which could
> be updated anytime whenever content need to be added [e.g. containing to
> path to the localized documents]) in association with Cocoon.
> The reason being is that as far as I understand the sitemap file is a sort
> of "hard codding of the content" - I would like to have a way to tell
> Cocoon:
> Ok, someone has asked for a document named "HollidaysInNice" in French -> I
> would like to have a way to tell Cocoon to do the following:
> A Document named "HollidaysInNice" in French has been requested - Let's have
> a look in the database to see if a French rendition of this document has
> been inserted recently - If so, lookup for the path of this rendition (ther
> XML file containing the data itself of the document) in this very same
> database - THEN, make a like between the XML document and the layout to be
> applied to it (this last operation should be done in some way by sitemap as
> I understand).

Yes, you can query the database (i.e. via one of the
DatabaseSelectAction components) and use the returned value as path to
a file. E.g.

  <map:act type="db-sel">
     <map:parameter name="table-set" value="french"/>

	 <map:generate src="{documents.path[0]}"/>
	 <map:transform src="the_style.xsl"/>
     <map:serialize/>
  </map:act>

  <map:act type="db-sel">
     <map:parameter name="table-set" value="english"/>

	 <map:generate src="{documents.path[0]}"/>
	 <map:transform src="the_style.xsl"/>
     <map:serialize/>
  </map:act>

  <map:act type="db-sel">
     <map:parameter name="table-set" value="german"/>

	 <map:generate src="{documents.path[0]}"/>
	 <map:transform src="the_style.xsl"/>
     <map:serialize/>
  </map:act>

Doing with flow instead of sitemap would be a bit more elegant,
though.

	Chris.
-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: === Cocoon + Localisation + Dynamic + database : Need point of view === FOLLOW-UP

Posted by Conal Tuohy <co...@paradise.net.nz>.
Yes Jerome you can do this sort of thing quite easily, once you understand
the way Cocoon works.

You can take an HTTP request for "HolidaysInNice" and search your file
system for XML (or html) documents called "HolidaysInNice.*", find
"HolidaysInNice.fr", and "HolidaysInNice.en", and use an XSL stylesheet to
select one based on the user's language preferences, then use another
stylesheet to convert the XML documents to HTML. And this is just one way
you could do it.

See the RequestGenerator page for handling HTTP_ACCEPT_LANGUAGE:
http://xml.apache.org/cocoon/userdocs/generators/request-generator.html

But first you should read the overview and understand the pipeline concept,
and the sitemap: http://xml.apache.org/cocoon/userdocs/index.html

Basically the role of the sitemap is to define "pipelines" which accept HTTP
requests, process the requests, query databases, etc, format documents, and
finally return web pages and other resources to the browser. The processing
steps which make up a pipeline are connected together in the sitemap like
Unix pipes.

Good luck!

Con

> -----Original Message-----
> From: jerome iffrig [mailto:jerome.iffrig@anitesystems.de]
> Sent: Monday, 5 August 2002 23:59
> To: cocoon-users@xml.apache.org
> Subject: RE: === Cocoon + Localisation + Dynamic + database :
> Need point of view === FOLLOW-UP
>
>
> What I mean by :-
>
> "[...] I have been told that Cocoon was able to make this
> together very
> efficiently (I have even been told that I could keep track
> [e.g. path of the
> localized documents] and make them dynamically available in
> real time as the
> content grows) using COCOON. [...]"
>
> Is that I have been told that it was possible to use a
> database (which could
> be updated anytime whenever content need to be added [e.g.
> containing to
> path to the localized documents]) in association with Cocoon.
> The reason being is that as far as I understand the sitemap
> file is a sort
> of "hard codding of the content" - I would like to have a way to tell
> Cocoon:
> Ok, someone has asked for a document named "HollidaysInNice"
> in French -> I
> would like to have a way to tell Cocoon to do the following:
> A Document named "HollidaysInNice" in French has been
> requested - Let's have
> a look in the database to see if a French rendition of this
> document has
> been inserted recently - If so, lookup for the path of this
> rendition (ther
> XML file containing the data itself of the document) in this very same
> database - THEN, make a like between the XML document and the
> layout to be
> applied to it (this last operation should be done in some way
> by sitemap as
> I understand).
>
> Is this still possible to be done by Cocoon? Do anyone has a
> sample or a
> piece of code for me to practice this sort of operation?
>
> Many thanks to Piroumin Konstantin for his previous (very
> quick) answer :o)
>
> -----Original Message-----
> From: Piroumian Konstantin [mailto:KPiroumian@protek.com]
> Sent: Monday, August 05, 2002 12:59 PM
> To: 'cocoon-users@xml.apache.org'
> Subject: RE: === Cocoon + Localisation + Dynamic + database :
> Need point of
> view ===
>
>
> > From: jerome iffrig [mailto:jerome.iffrig@anitesystems.de]
> >
> > I am building an internationalized website.
> >
> > I would like all the pages (related to a given topic) to be
> > displayed with a
> > common layout.
> > For instance, let's say I want to create a page about
> > recycling paper - I
> > would like the page to use the same layout for the French,
> > German, English
> > and Spanish languages - Hence ONE single presentation layer template
> > associated with 4 versions of XML files representing the
> > content of the page
> > in different languages.
>
> No problems with this, just use a single stylesheet to render
> all the pages.
> This is done in the sitemap by using a pipeline which should
> process all
> "*.xml" files with say "layout.xsl" stylesheet. Take a look
> at the Hello
> world samples in Cocoon.
>
> > Furthermore my user should be able do dynamically add new pages (new
> > topics). This page will initially be entered by the user in
> > any of the 4
> > languages (let's say French) - the following hours (or days),
> > some other
> > users might decide to edit an other localized version of the
> > same document -
> > These now localized versions of the content of the document
> need to be
> > dynamically available to the users.
>
> Just place a new file under your application context and it will be
> processed as all the rest.
>
> >
> > I have been told that Cocoon was able to make this together
> > very efficiently
> > (I have even been told that I could keep track [e.g. path of
> > the localized
> > documents] and make them dynamically available in real time
> > as the content
> > grows) using COCOON.
>
> Don't quite understand this one. What does it mean 'path of
> the localized
> documents'?
>
> >
> > I have installed cocoon, Have a database ready (MySQL),
> > Servlet container
> > and everything that is needed for the implementation - I have
> > read some
> > substantial documentation about cocoon (including official
> > documentation and
> > had a look at the sample codes) but cannot figure out how to
> > glue everything
> > together - Basically I don't know how and where to start :o(
>
> Start from learning the sitemap. It is the point where you
> tie everything
> together.
>
> >
> > Please let me know any comment - Let me know if Cocoon is
> > really a solution
> > for the things I want to implement - Even send me some sample
> > code if you
> > have any that could put me on track :o)
>
> I think that Cocoon is the right choice for your case. There
> are some very
> good samples in Cocoon distro. Just learn the sitemap and
> take a look at
> them. Also, you can always ask here if you have any questions.
>
> Konstantin
>
> >
> > Thanks in advance!
> >
> > Vidauabannais
> >
> >
> >
> ---------------------------------------------------------------------
> > 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:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>

---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>



---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>



---------------------------------------------------------------------
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:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>