You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Cocoon User <co...@eng.gr> on 2002/12/28 12:53:53 UTC

i18n catalogue and sql

hy people

i have found very usefull the i18n processing
but what happend when you  have large text?



is it possible for catalogues to retrieve data from an sql server
mySQL for example


xml page -ID-> catalogue -ID-> data from SQL


thnx

stavros



---------------------------------------------------------------------
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: i18n catalogue and sql [act howto]

Posted by Konstantin Piroumian <kp...@apache.org>.
From: "Cocoon User" <co...@eng.gr>

>
> hi konstantin
>
> i plan to create an action that will create sitiemap variables for
> specific request-parameters not for use only with i18n

There is already such action in Cocoon:
src\java\org\apache\cocoon\acting\RequestParamAction.java

But I'd prefer to use already implemented input module, which looks much
better in the sitemap.

Konstantin

>
> is there any simple action or any howto create an action for cocoon?
> i need just a point to start form (something for example)
>
>
> thnx
> stavros
>
> On Wed, 8 Jan 2003, Konstantin Piroumian wrote:
>
> > From: "Cocoon User" <co...@eng.gr>
> >
> > > hi martin this is a way to send a parameter inside your xsl file
(pretty
> > > good) but i need something else
> > >
> > > i want to use a request parameter as a variable inside my sitemap
> > >
> > > example
> > >
> > > if i have http://../...?locale=el
> > >
> > > src="{locale}_data.xml"
> > >
> > > point to el_data.xml
> > >
> > > (i have do something similar using a action just like in i18n example
from
> > > 2.1 version of cocoon but i'm wondering if there is another way to do
this
> > > without action)
> >
> > Another possibility is to create an InputModule that will act exactly
like
> > the LocaleAction, so you'll be able to use it like this:
> >
> > src="{i18n:locale}_data.xml"
> >
> > and even now you can use the 'request-param' module for that:
> >
> > src="{request-param:locale}_data.xml"
> >
> > Konstantin
> >
> > >
> > > thnx stavros
> > >
> > >
> > > On 5 Jan 2003, Martin Lüthi wrote:
> > >
> > > >
> > > > You can use the request parameter like this:
> > > >
> > > >   <map:transform src="stylesheets/mystyle.xsl">
> > > >      <map:parameter name="use-request-parameters" value="true"/>
> > > >      <map:parameter name="region" value="{request:locale}"/>
> > > >   </map:transform>
> > > >
> > > > Cheers Martin
> > > >
> > > >
> > > > Cocoon User <co...@eng.gr> writes:
> > > >
> > > > > i know how to make a src file selection based to requested url
using
> > > > > matches
> > > > >
> > > > > http://...../el/test
> > > > > http://...../en/test
> > > > >
> > > > > <map:match pattern="*/*">
> > > > > <map:generate src="{1}_{2}.xml"/>
> > > > > </map:patch>
> > > > >
> > > > > but how can do  something similar using parameter?
> > > > >
> > > > > http://..../test?locale=el
> > > > > http://..../test?locale=en
> > > > >
> > > > > using {1} or {2} i refer to first or second * in pattern
> > > > > but how can i refer to locale prameter value inside <map:match/> ?
> > > >
> > > >
> >
> >
> > ---------------------------------------------------------------------
> > 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: i18n catalogue and sql [act howto]

Posted by Cocoon User <co...@eng.gr>.
hi konstantin

i plan to create an action that will create sitiemap variables for
specific request-parameters not for use only with i18n

is there any simple action or any howto create an action for cocoon?
i need just a point to start form (something for example)


thnx
stavros

On Wed, 8 Jan 2003, Konstantin Piroumian wrote:

> From: "Cocoon User" <co...@eng.gr>
>
> > hi martin this is a way to send a parameter inside your xsl file (pretty
> > good) but i need something else
> >
> > i want to use a request parameter as a variable inside my sitemap
> >
> > example
> >
> > if i have http://../...?locale=el
> >
> > src="{locale}_data.xml"
> >
> > point to el_data.xml
> >
> > (i have do something similar using a action just like in i18n example from
> > 2.1 version of cocoon but i'm wondering if there is another way to do this
> > without action)
>
> Another possibility is to create an InputModule that will act exactly like
> the LocaleAction, so you'll be able to use it like this:
>
> src="{i18n:locale}_data.xml"
>
> and even now you can use the 'request-param' module for that:
>
> src="{request-param:locale}_data.xml"
>
> Konstantin
>
> >
> > thnx stavros
> >
> >
> > On 5 Jan 2003, Martin Lüthi wrote:
> >
> > >
> > > You can use the request parameter like this:
> > >
> > >   <map:transform src="stylesheets/mystyle.xsl">
> > >      <map:parameter name="use-request-parameters" value="true"/>
> > >      <map:parameter name="region" value="{request:locale}"/>
> > >   </map:transform>
> > >
> > > Cheers Martin
> > >
> > >
> > > Cocoon User <co...@eng.gr> writes:
> > >
> > > > i know how to make a src file selection based to requested url using
> > > > matches
> > > >
> > > > http://...../el/test
> > > > http://...../en/test
> > > >
> > > > <map:match pattern="*/*">
> > > > <map:generate src="{1}_{2}.xml"/>
> > > > </map:patch>
> > > >
> > > > but how can do  something similar using parameter?
> > > >
> > > > http://..../test?locale=el
> > > > http://..../test?locale=en
> > > >
> > > > using {1} or {2} i refer to first or second * in pattern
> > > > but how can i refer to locale prameter value inside <map:match/> ?
> > >
> > >
>
>
> ---------------------------------------------------------------------
> 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: i18n catalogue and sql

Posted by Konstantin Piroumian <kp...@apache.org>.
From: "Cocoon User" <co...@eng.gr>

> hi martin this is a way to send a parameter inside your xsl file (pretty
> good) but i need something else
>
> i want to use a request parameter as a variable inside my sitemap
>
> example
>
> if i have http://../...?locale=el
>
> src="{locale}_data.xml"
>
> point to el_data.xml
>
> (i have do something similar using a action just like in i18n example from
> 2.1 version of cocoon but i'm wondering if there is another way to do this
> without action)

Another possibility is to create an InputModule that will act exactly like
the LocaleAction, so you'll be able to use it like this:

src="{i18n:locale}_data.xml"

and even now you can use the 'request-param' module for that:

src="{request-param:locale}_data.xml"

Konstantin

>
> thnx stavros
>
>
> On 5 Jan 2003, Martin Lüthi wrote:
>
> >
> > You can use the request parameter like this:
> >
> >   <map:transform src="stylesheets/mystyle.xsl">
> >      <map:parameter name="use-request-parameters" value="true"/>
> >      <map:parameter name="region" value="{request:locale}"/>
> >   </map:transform>
> >
> > Cheers Martin
> >
> >
> > Cocoon User <co...@eng.gr> writes:
> >
> > > i know how to make a src file selection based to requested url using
> > > matches
> > >
> > > http://...../el/test
> > > http://...../en/test
> > >
> > > <map:match pattern="*/*">
> > > <map:generate src="{1}_{2}.xml"/>
> > > </map:patch>
> > >
> > > but how can do  something similar using parameter?
> > >
> > > http://..../test?locale=el
> > > http://..../test?locale=en
> > >
> > > using {1} or {2} i refer to first or second * in pattern
> > > but how can i refer to locale prameter value inside <map:match/> ?
> >
> >


---------------------------------------------------------------------
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: i18n catalogue and sql

Posted by Darren Petrie <dp...@anteon.com>.
You can access a request parameter variable inside your sitemap via a 
matcher or a selector

<map:matcher  name="request-parameter" 
src="org.apache.cocoon.matching.RequestParameterMatcher"/>
<map:selector name="request-parameter" 
src="org.apache.cocoon.selection.RequestSelector"/>

As a matcher---

<map:match pattern="mydoc">
	<map:match type="request-parameter" pattern="locale">
		<map:generate src="xdocs/mydoc-{1}.xml"/>
	</map:match>
	<map:serialize type="xml"/>
</map:match>

As a selector---

<map:match pattern="mydoc">		
	<map:select type="request-parameter">
		<map:parameter name="parameter-name" value="locale"/>
			
		<map:when test="en">
			..do something
		</map:when>
			
		<map:otherwise>
			..do something else
		</map:otherwise>
	</map:select>
</map:match>

Hope that answers your question.

Darren



On Sunday, January 5, 2003, at 03:12 PM, Cocoon User wrote:

> hi martin this is a way to send a parameter inside your xsl file 
> (pretty
> good) but i need something else
>
> i want to use a request parameter as a variable inside my sitemap
>
> example
>
> if i have http://../...?locale=el
>
> src="{locale}_data.xml"
>
> point to el_data.xml
>
> (i have do something similar using a action just like in i18n example 
> from
> 2.1 version of cocoon but i'm wondering if there is another way to do 
> this
> without action)
>
> thnx stavros
>
>
> On 5 Jan 2003, Martin Lüthi wrote:
>
>>
>> You can use the request parameter like this:
>>
>>   <map:transform src="stylesheets/mystyle.xsl">
>>      <map:parameter name="use-request-parameters" value="true"/>
>>      <map:parameter name="region" value="{request:locale}"/>
>>   </map:transform>
>>
>> Cheers Martin
>>
>>
>> Cocoon User <co...@eng.gr> writes:
>>
>>> i know how to make a src file selection based to requested url using
>>> matches
>>>
>>> http://...../el/test
>>> http://...../en/test
>>>
>>> <map:match pattern="*/*">
>>> 	<map:generate src="{1}_{2}.xml"/>
>>> </map:patch>
>>>
>>> but how can do  something similar using parameter?
>>>
>>> http://..../test?locale=el
>>> http://..../test?locale=en
>>>
>>> using {1} or {2} i refer to first or second * in pattern
>>> but how can i refer to locale prameter value inside <map:match/> ?
>>
>>
>
>
> ---------------------------------------------------------------------
> 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>
>
>
Darren Petrie
dpetrie@anteon.com


---------------------------------------------------------------------
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: i18n catalogue and sql

Posted by Cocoon User <co...@eng.gr>.
hi martin this is a way to send a parameter inside your xsl file (pretty
good) but i need something else

i want to use a request parameter as a variable inside my sitemap

example

if i have http://../...?locale=el

src="{locale}_data.xml"

point to el_data.xml

(i have do something similar using a action just like in i18n example from
2.1 version of cocoon but i'm wondering if there is another way to do this
without action)

thnx stavros


On 5 Jan 2003, Martin Lüthi wrote:

>
> You can use the request parameter like this:
>
>   <map:transform src="stylesheets/mystyle.xsl">
>      <map:parameter name="use-request-parameters" value="true"/>
>      <map:parameter name="region" value="{request:locale}"/>
>   </map:transform>
>
> Cheers Martin
>
>
> Cocoon User <co...@eng.gr> writes:
>
> > i know how to make a src file selection based to requested url using
> > matches
> >
> > http://...../el/test
> > http://...../en/test
> >
> > <map:match pattern="*/*">
> > 	<map:generate src="{1}_{2}.xml"/>
> > </map:patch>
> >
> > but how can do  something similar using parameter?
> >
> > http://..../test?locale=el
> > http://..../test?locale=en
> >
> > using {1} or {2} i refer to first or second * in pattern
> > but how can i refer to locale prameter value inside <map:match/> ?
>
>


---------------------------------------------------------------------
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: i18n catalogue and sql

Posted by Martin Lüthi <an...@tnoo.net>.
You can use the request parameter like this:

  <map:transform src="stylesheets/mystyle.xsl">
     <map:parameter name="use-request-parameters" value="true"/>
     <map:parameter name="region" value="{request:locale}"/>
  </map:transform>

Cheers Martin


Cocoon User <co...@eng.gr> writes:

> i know how to make a src file selection based to requested url using
> matches
> 
> http://...../el/test
> http://...../en/test
> 
> <map:match pattern="*/*">
> 	<map:generate src="{1}_{2}.xml"/>
> </map:patch>
> 
> but how can do  something similar using parameter?
> 
> http://..../test?locale=el
> http://..../test?locale=en
> 
> using {1} or {2} i refer to first or second * in pattern
> but how can i refer to locale prameter value inside <map:match/> ?

-- 
Martin L�thi                 answer@tnoo.net



---------------------------------------------------------------------
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: i18n catalogue and sql

Posted by Cocoon User <co...@eng.gr>.

hi konstantin

i know how to make a src file selection based to requested url using
matches

http://...../el/test
http://...../en/test

<map:match pattern="*/*">
	<map:generate src="{1}_{2}.xml"/>
</map:patch>

but how can do  something similar using parameter?

http://..../test?locale=el
http://..../test?locale=en

using {1} or {2} i refer to first or second * in pattern
but how can i refer to locale prameter value inside <map:match/> ?




thnx
stavros






On Mon, 30 Dec 2002, Konstantin Piroumian wrote:

> From: "Cocoon User" <co...@eng.gr>
>
> >
> > hy people
> >
> > i have found very usefull the i18n processing
> > but what happend when you  have large text?
>
> It's not recommended to use i18n transformer for large texts. There are
> several other ways to solve that task: use XInclude/CInclude, XSLT with
> document() function, sitemap aggregation, etc. Another possibility is to use
> separate content files for different languages, e.g: index_en.xml,
> index_ru.xml, ..., and then use an action or an input module to retrieve the
> needed one based on the user's locale (you can use LocaleAction and its
> 'language' sitemap parameter).
>
> >
> >
> >
> > is it possible for catalogues to retrieve data from an sql server
> > mySQL for example
>
> Recently there was commited a patch that allowed to use any source as input
> for the XML catalogue, so you can easily use 'cocoon:/' protocol or any
> other to retrieve your dictionary data from a database. Note, that
> implementation of i18n and especially the catalogue handling part is quite
> different in 2.0.x and 2.1-dev versions.
>
> Konstantin
>
> >
> >
> > xml page -ID-> catalogue -ID-> data from SQL
> >
> >
> > thnx
> >
> > stavros
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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: i18n catalogue and sql

Posted by Konstantin Piroumian <kp...@apache.org>.
From: "Cocoon User" <co...@eng.gr>

>
> hy people
>
> i have found very usefull the i18n processing
> but what happend when you  have large text?

It's not recommended to use i18n transformer for large texts. There are
several other ways to solve that task: use XInclude/CInclude, XSLT with
document() function, sitemap aggregation, etc. Another possibility is to use
separate content files for different languages, e.g: index_en.xml,
index_ru.xml, ..., and then use an action or an input module to retrieve the
needed one based on the user's locale (you can use LocaleAction and its
'language' sitemap parameter).

>
>
>
> is it possible for catalogues to retrieve data from an sql server
> mySQL for example

Recently there was commited a patch that allowed to use any source as input
for the XML catalogue, so you can easily use 'cocoon:/' protocol or any
other to retrieve your dictionary data from a database. Note, that
implementation of i18n and especially the catalogue handling part is quite
different in 2.0.x and 2.1-dev versions.

Konstantin

>
>
> xml page -ID-> catalogue -ID-> data from SQL
>
>
> thnx
>
> stavros
>
>
>
> ---------------------------------------------------------------------
> 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>