You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Cyril Vidal <cy...@planetexml.com> on 2003/01/31 16:07:49 UTC
How can the result of a pipeline be a parameter for a transformation in another pipeline?
Hello,
I would like to retrieve the language of the user's browser, so that I could
call the I18n Trasnformer in the right way (by passing the locales's value
equal to the browser's language).
To retrieve the language set up in the browser, I've used the Request
Generator, and applied the following simple stylesheet to it:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:req="http://xml.apache.org/cocoon/requestgenerator/2.0"
>
<xsl:template match="/">
<xsl:value-of
select="//req:requestHeaders/req:header[@name='accept-language']"/>
</xsl:template>
</xsl:stylesheet>
And this is working fine. By example, for my browser, the result is 'fr'.
But now, I don't know what really to do with this value: I would like to use
it as a parameter for a I18nTransformation in another pipeline.
Do you know how this can be achieved?
Thanks for your help,
Cyril.
---------------------------------------------------------------------
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>
AW: How can the result of a pipeline be a parameter for a transformation in another pipeline?
Posted by Marco Rolappe <m_...@web.de>.
maybe your user agent has several languages set in Accept-Language and maybe
the input module uses these (LocalAction using first encountered).
> -----Ursprüngliche Nachricht-----
> Von: cocoon-users-return-45940-m_rolappe=web.de@xml.apache.org
> [mailto:cocoon-users-return-45940-m_rolappe=web.de@xml.apache.org]Im
> Auftrag von Cyril Vidal
> Gesendet: Freitag, 31. Januar 2003 17:27
> An: cocoon-users@xml.apache.org; haul@informatik.tu-darmstadt.de
> Betreff: Re: How can the result of a pipeline be a parameter for a
> transformation in another pipeline?
>
>
> Hello Christian,
>
> First, thanks for your help!
> I think I've done what you told me concerning the input module.
> And in fact,
> I've just changed the value of the parameter 'locale', given the
> successfull pattern using localeAction:
>
> **** localeAction ***
> <map:pipeline>
>
> <map:act type="locale">
>
> <map:match pattern="localeAction">
>
> <map:generate src="documents/participants.xml"/>
>
> <map:transform src="stylesheets/participantsINT.xsl">
>
> <map:parameter name="use-request-parameters" value="true"/>
>
> </map:transform>
>
> <map:transform type="i18n">
>
> <map:parameter name="locale" value="{../locale}"/>
>
> </map:transform>
>
> <map:serialize type="html"/>
>
> </map:match>
>
> </map:act>
>
>
>
> *****input module *****************
>
>
> <map:match pattern="inputModule">
>
> <map:generate src="documents/participants.xml"/>
>
> <map:transform src="stylesheets/participantsINT.xsl">
>
> <map:parameter name="use-request-parameters" value="true"/>
>
> </map:transform>
>
> <map:transform type="i18n">
>
> <map:parameter name="locale" value="{request-header:accept-language}"/>
>
> </map:transform>
>
> <map:serialize type="html"/>
>
> </map:match>
>
> </map:pipeline>
>
> but unfortunately, I receive the following error message, that I
> didn't have
> with the preceding localAction:
>
> type fatal
>
> message Unable to locate resource: messages
>
> description org.apache.cocoon.ProcessingException: Unable to locate
> resource: messages:
> org.apache.avalon.framework.component.ComponentException: Unable to locate
> resource: messages
>
> sender org.apache.cocoon.servlet.CocoonServlet
>
> source Cocoon servlet
>
> stack-trace
>
> Is it normal?
>
> Thanks again for your help,
>
> Regards,
>
> Cyril.
>
> ----- Original Message -----
> From: "Christian Haul" <ha...@dvs1.informatik.tu-darmstadt.de>
> To: <co...@xml.apache.org>
> Sent: Friday, January 31, 2003 4:23 PM
> Subject: Re: How can the result of a pipeline be a parameter for a
> transformation in another pipeline?
>
>
> > On 31.Jan.2003 -- 04:07 PM, Cyril Vidal wrote:
> > > Hello,
> > >
> > > I would like to retrieve the language of the user's browser, so that I
> could
> > > call the I18n Trasnformer in the right way (by passing the locales's
> value
> > > equal to the browser's language).
> > >
> > > To retrieve the language set up in the browser, I've used the Request
> > > Generator, and applied the following simple stylesheet to it:
> >
> > Starting with version 2.0.4 you could try
> > {request-header:accept-language} for that. See input modules in
> > "concepts" and javadocs.
> >
> > 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>
> >
> >
>
>
>
> ---------------------------------------------------------------------
> 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: How can the result of a pipeline be a parameter for a transformation in another pipeline?
Posted by Cyril Vidal <cy...@planetexml.com>.
Hello Christian,
First, thanks for your help!
I think I've done what you told me concerning the input module. And in fact,
I've just changed the value of the parameter 'locale', given the
successfull pattern using localeAction:
**** localeAction ***
<map:pipeline>
<map:act type="locale">
<map:match pattern="localeAction">
<map:generate src="documents/participants.xml"/>
<map:transform src="stylesheets/participantsINT.xsl">
<map:parameter name="use-request-parameters" value="true"/>
</map:transform>
<map:transform type="i18n">
<map:parameter name="locale" value="{../locale}"/>
</map:transform>
<map:serialize type="html"/>
</map:match>
</map:act>
*****input module *****************
<map:match pattern="inputModule">
<map:generate src="documents/participants.xml"/>
<map:transform src="stylesheets/participantsINT.xsl">
<map:parameter name="use-request-parameters" value="true"/>
</map:transform>
<map:transform type="i18n">
<map:parameter name="locale" value="{request-header:accept-language}"/>
</map:transform>
<map:serialize type="html"/>
</map:match>
</map:pipeline>
but unfortunately, I receive the following error message, that I didn't have
with the preceding localAction:
type fatal
message Unable to locate resource: messages
description org.apache.cocoon.ProcessingException: Unable to locate
resource: messages:
org.apache.avalon.framework.component.ComponentException: Unable to locate
resource: messages
sender org.apache.cocoon.servlet.CocoonServlet
source Cocoon servlet
stack-trace
Is it normal?
Thanks again for your help,
Regards,
Cyril.
----- Original Message -----
From: "Christian Haul" <ha...@dvs1.informatik.tu-darmstadt.de>
To: <co...@xml.apache.org>
Sent: Friday, January 31, 2003 4:23 PM
Subject: Re: How can the result of a pipeline be a parameter for a
transformation in another pipeline?
> On 31.Jan.2003 -- 04:07 PM, Cyril Vidal wrote:
> > Hello,
> >
> > I would like to retrieve the language of the user's browser, so that I
could
> > call the I18n Trasnformer in the right way (by passing the locales's
value
> > equal to the browser's language).
> >
> > To retrieve the language set up in the browser, I've used the Request
> > Generator, and applied the following simple stylesheet to it:
>
> Starting with version 2.0.4 you could try
> {request-header:accept-language} for that. See input modules in
> "concepts" and javadocs.
>
> 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>
>
>
---------------------------------------------------------------------
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: How can the result of a pipeline be a parameter for a transformation in another pipeline?
Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 31.Jan.2003 -- 04:07 PM, Cyril Vidal wrote:
> Hello,
>
> I would like to retrieve the language of the user's browser, so that I could
> call the I18n Trasnformer in the right way (by passing the locales's value
> equal to the browser's language).
>
> To retrieve the language set up in the browser, I've used the Request
> Generator, and applied the following simple stylesheet to it:
Starting with version 2.0.4 you could try
{request-header:accept-language} for that. See input modules in
"concepts" and javadocs.
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: How can the result of a pipeline be a parameter for a transformation in another pipeline?
Posted by Cyril Vidal <cy...@planetexml.com>.
Thanks for your help Konstantin!
It's OK with LocaleAction.
Regards,
Cyril.
----- Original Message -----
From: "Konstantin Piroumian" <kp...@apache.org>
To: <co...@xml.apache.org>
Sent: Friday, January 31, 2003 4:12 PM
Subject: Re: How can the result of a pipeline be a parameter for a
transformation in another pipeline?
> From: "Cyril Vidal" <cy...@planetexml.com>
>
> > Hello,
> >
> > I would like to retrieve the language of the user's browser, so that I
> could
> > call the I18n Trasnformer in the right way (by passing the locales's
value
> > equal to the browser's language).
>
> Simply use the LocaleAction as it is done in i18n samples.
> AFAIK, you can setup it to use only the browser's locale and not take into
> account request params, session attributes or cookies. But I'm sure you'll
> need to allow users to change to language on fly or retain it in a cookie
on
> the client side to serve the last preferred language of the user. In all
> this cases LocaleAction will help you a lot.
>
> -- Konstantin
>
> >
> > To retrieve the language set up in the browser, I've used the Request
> > Generator, and applied the following simple stylesheet to it:
> >
> > <xsl:stylesheet version="1.0"
> >
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >
> > xmlns:req="http://xml.apache.org/cocoon/requestgenerator/2.0"
> >
> > >
> >
> > <xsl:template match="/">
> >
> > <xsl:value-of
> > select="//req:requestHeaders/req:header[@name='accept-language']"/>
> >
> > </xsl:template>
> >
> > </xsl:stylesheet>
> >
> >
> >
> > And this is working fine. By example, for my browser, the result is
'fr'.
> >
> > But now, I don't know what really to do with this value: I would like to
> use
> > it as a parameter for a I18nTransformation in another pipeline.
> >
> > Do you know how this can be achieved?
> >
> >
> >
> > Thanks for your help,
> >
> > Cyril.
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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: How can the result of a pipeline be a parameter for a transformation in another pipeline?
Posted by Konstantin Piroumian <kp...@apache.org>.
From: "Cyril Vidal" <cy...@planetexml.com>
> Hello,
>
> I would like to retrieve the language of the user's browser, so that I
could
> call the I18n Trasnformer in the right way (by passing the locales's value
> equal to the browser's language).
Simply use the LocaleAction as it is done in i18n samples.
AFAIK, you can setup it to use only the browser's locale and not take into
account request params, session attributes or cookies. But I'm sure you'll
need to allow users to change to language on fly or retain it in a cookie on
the client side to serve the last preferred language of the user. In all
this cases LocaleAction will help you a lot.
-- Konstantin
>
> To retrieve the language set up in the browser, I've used the Request
> Generator, and applied the following simple stylesheet to it:
>
> <xsl:stylesheet version="1.0"
>
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
> xmlns:req="http://xml.apache.org/cocoon/requestgenerator/2.0"
>
> >
>
> <xsl:template match="/">
>
> <xsl:value-of
> select="//req:requestHeaders/req:header[@name='accept-language']"/>
>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
>
> And this is working fine. By example, for my browser, the result is 'fr'.
>
> But now, I don't know what really to do with this value: I would like to
use
> it as a parameter for a I18nTransformation in another pipeline.
>
> Do you know how this can be achieved?
>
>
>
> Thanks for your help,
>
> Cyril.
>
>
>
> ---------------------------------------------------------------------
> 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>