You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ludovic Desforges <lu...@waika9.com> on 2005/07/06 10:46:06 UTC

passing parameter to tab.xsl from sitemap.xmap

My question is about passing parameter to tab.xsl from sitemap.xmap
How can I do this process ?


After a clic on the portal tab, I have : (see locale parameter)
origine : 
http://www.abc.com/portal/portal?cocoon-portal-action=0&cocoon-portal-event=0
now     : 
http://www.abc.com/portal/portal?cocoon-portal-action=0&cocoon-portal-event=0&locale=
expect  : 
http://www.abc.com/portal/portal?cocoon-portal-action=0&cocoon-portal-event=0&locale=es


As you see, I have modified tab.xsl using <xsl:param name="localeUsed"/> 
to receive locale value.

With sitemap.xmap : warning : this block fail : how can I do to succeed?
<map:act type="locale">
<map:match pattern="portal">
...
<map:parameter name="localeUsed" value="{../../locale}"/> ???
...


related subjects :
- cocoon\WEB-INF\cocoon.xconf
- cocoon\samples\blocks\portal\skins\common\styles\tab.xsl
- for me     : cocoon\portal\sitemap.xmap
   for others : cocoon\samples\blocks\portal\sitemap.xmap


Thank you for your help,

Regards,

Ludovic

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


Re: passing parameter to tab.xsl from sitemap.xmap

Posted by Ralph Goers <Ra...@dslextreme.com>.
You can pass parameters to the various stylesheets.  One way to do this:

Parameters can be specified in the layout. The parameters are passed to 
stylesheets called via the XSLTAspect, and are added to the generated 
layout XML as parameter elements via the ParameterAspect.  The 
"parameters" specified in the layout can use input modules so you can 
get at request attributes, etc. this way.

Ralph

Ludovic Desforges wrote:

> Solution of : passing parameter to tab.xsl from sitemap.xmap
>
> Bart Molenkamp gives me this precious help :
> "As far as I know, it isn't possible to pass any of these parameters to
> the stylesheet. These stylesheets are called by the portal generator,
> and you won't see it. You can pass this parameter to any stylesheet that
> is called after the generator, in my case, portal-page.xsl. I created
> special tags in tabs.xsl, window.xsl, etc, which I pick up in
> portal-page.xsl and replace them with correct tags. E.g. in tabs.xsl I
> create a tag <my-locale-here/>, and in portal-page.xsl I replace it."
>
> =================================
> == an explicit sample :
> =================================
> objective : passing parameter to tab.xsl from sitemap.xmap
> result    : 
> http://www.abc.com/portal/portal?cocoon-portal-action=0&cocoon-portal-event=0&locale=es 
>
> note      : parameter is locale. I need it for my specific database 
> queries. Of course for common I18n translations, you should use common 
> process, I mean <i18n:text i18n:key=... . This sample uses these two 
> notions.
>
>
> extract of tab.xsl :
> <my-locale-here>
> <a style=" font-size : 2; border: 0; color: #FF0000;">
>    <xsl:attribute name="href"><xsl:value-of 
> select="@parameter"/></xsl:attribute>
>    <i18n:text><xsl:attribute name="i18n:key"><xsl:value-of 
> select="./@name"/></xsl:attribute><xsl:value-of 
> select="@name"/></i18n:text>
> </a>
> </my-locale-here>
>
> extract of portal-page.xsl :
> <xsl:param name="localeUsed"/>
> <xsl:template match="my-locale-here/a/@href">
>    <xsl:attribute name="href"><xsl:value-of 
> select="."/>&amp;locale=<xsl:value-of 
> select="$localeUsed"/></xsl:attribute>
> </xsl:template>
>
> extract of sitemap.xmap :
> <map:transform src="{portal-skin:skin.basepath}/styles/portal-page.xsl">
>    <map:parameter name="user" value="{ID}"/>
>    <map:parameter name="localeUsed" value="{../../locale}"/>
> </map:transform>
> ...
> <map:transform type="i18n">
> ...
>
> Note : another solution exists : Carsten Ziegeler :
> http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=109680369924780&w=2
>
>
> Regards,
>
> Ludovic Desforges
>
>
> Ludovic Desforges wrote:
>
>> My question is about passing parameter to tab.xsl from sitemap.xmap
>> How can I do this process ?
>>
>>
>> After a clic on the portal tab, I have : (see locale parameter)
>> origine : 
>> http://www.abc.com/portal/portal?cocoon-portal-action=0&cocoon-portal-event=0 
>>
>> now     : 
>> http://www.abc.com/portal/portal?cocoon-portal-action=0&cocoon-portal-event=0&locale= 
>>
>> expect  : 
>> http://www.abc.com/portal/portal?cocoon-portal-action=0&cocoon-portal-event=0&locale=es 
>>
>>
>>
>> As you see, I have modified tab.xsl using <xsl:param 
>> name="localeUsed"/> to receive locale value.
>>
>> With sitemap.xmap : warning : this block fail : how can I do to succeed?
>> <map:act type="locale">
>> <map:match pattern="portal">
>> ...
>> <map:parameter name="localeUsed" value="{../../locale}"/> ???
>> ...
>>
>>
>> related subjects :
>> - cocoon\WEB-INF\cocoon.xconf
>> - cocoon\samples\blocks\portal\skins\common\styles\tab.xsl
>> - for me     : cocoon\portal\sitemap.xmap
>>   for others : cocoon\samples\blocks\portal\sitemap.xmap
>>
>>
>> Thank you for your help,
>>
>> Regards,
>>
>> Ludovic
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


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


Re: passing parameter to tab.xsl from sitemap.xmap

Posted by Ludovic Desforges <lu...@waika9.com>.
Solution of : passing parameter to tab.xsl from sitemap.xmap

Bart Molenkamp gives me this precious help :
"As far as I know, it isn't possible to pass any of these parameters to
the stylesheet. These stylesheets are called by the portal generator,
and you won't see it. You can pass this parameter to any stylesheet that
is called after the generator, in my case, portal-page.xsl. I created
special tags in tabs.xsl, window.xsl, etc, which I pick up in
portal-page.xsl and replace them with correct tags. E.g. in tabs.xsl I
create a tag <my-locale-here/>, and in portal-page.xsl I replace it."

=================================
== an explicit sample :
=================================
objective : passing parameter to tab.xsl from sitemap.xmap
result    : 
http://www.abc.com/portal/portal?cocoon-portal-action=0&cocoon-portal-event=0&locale=es
note      : parameter is locale. I need it for my specific database 
queries. Of course for common I18n translations, you should use common 
process, I mean <i18n:text i18n:key=... . This sample uses these two 
notions.


extract of tab.xsl :
<my-locale-here>
<a style=" font-size : 2; border: 0; color: #FF0000;">
    <xsl:attribute name="href"><xsl:value-of 
select="@parameter"/></xsl:attribute>
    <i18n:text><xsl:attribute name="i18n:key"><xsl:value-of 
select="./@name"/></xsl:attribute><xsl:value-of select="@name"/></i18n:text>
</a>
</my-locale-here>

extract of portal-page.xsl :
<xsl:param name="localeUsed"/>
<xsl:template match="my-locale-here/a/@href">
    <xsl:attribute name="href"><xsl:value-of 
select="."/>&amp;locale=<xsl:value-of select="$localeUsed"/></xsl:attribute>
</xsl:template>

extract of sitemap.xmap :
<map:transform src="{portal-skin:skin.basepath}/styles/portal-page.xsl">
    <map:parameter name="user" value="{ID}"/>
    <map:parameter name="localeUsed" value="{../../locale}"/>
</map:transform>
...
<map:transform type="i18n">
...

Note : another solution exists : Carsten Ziegeler :
http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=109680369924780&w=2


Regards,

Ludovic Desforges


Ludovic Desforges wrote:
> My question is about passing parameter to tab.xsl from sitemap.xmap
> How can I do this process ?
> 
> 
> After a clic on the portal tab, I have : (see locale parameter)
> origine : 
> http://www.abc.com/portal/portal?cocoon-portal-action=0&cocoon-portal-event=0 
> 
> now     : 
> http://www.abc.com/portal/portal?cocoon-portal-action=0&cocoon-portal-event=0&locale= 
> 
> expect  : 
> http://www.abc.com/portal/portal?cocoon-portal-action=0&cocoon-portal-event=0&locale=es 
> 
> 
> 
> As you see, I have modified tab.xsl using <xsl:param name="localeUsed"/> 
> to receive locale value.
> 
> With sitemap.xmap : warning : this block fail : how can I do to succeed?
> <map:act type="locale">
> <map:match pattern="portal">
> ...
> <map:parameter name="localeUsed" value="{../../locale}"/> ???
> ...
> 
> 
> related subjects :
> - cocoon\WEB-INF\cocoon.xconf
> - cocoon\samples\blocks\portal\skins\common\styles\tab.xsl
> - for me     : cocoon\portal\sitemap.xmap
>   for others : cocoon\samples\blocks\portal\sitemap.xmap
> 
> 
> Thank you for your help,
> 
> Regards,
> 
> Ludovic
> 


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