You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Joern Nettingsmeier <po...@uni-due.de> on 2006/08/15 15:58:12 UTC

how can i implement language switchers with latest trunk?

hi andreas, hi everyone!


after the recent migration to uuids, my language switching buttons are
broken. i used to do this in my page2xhtml.xsl:

<a href="{$root}{$document-id}_en.html">english</a>, where the variables are
<!-- /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
<map:match pattern="lenyabody-*/*/*/*/**">
...
  <map:transform...>
     <map:parameter name="root" value="{base-url:{2}:{3}}"/>
     <map:parameter name="document-id"
            value="{page-envelope:document-id}"/>

of course, this now produces links like
http://localhost:8888/soziologie/authoringba4ba940-2b8f-11db-8109-9e43e820a3df_en.html.

what is the new way to do it?


thanks,

jörn



-- 
"I don't need backups. I need restore!" - Trad.

--
Jörn Nettingsmeier, EDV-Administrator
Institut für Politikwissenschaft
Universität Duisburg-Essen, Standort Duisburg
Mail: pol-admin@uni-due.de, Telefon: 0203/379-2736


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: how can i implement language switchers with latest trunk?

Posted by so...@apache.org.
On 8/19/06, Jörn Nettingsmeier <po...@uni-duisburg.de> wrote:
> solprovider@apache.org wrote:
> > On 8/18/06, Andreas Hartmann <an...@apache.org> wrote:
> >> solprovider@apache.org wrote:
> >> > On 8/17/06, Andreas Hartmann <an...@apache.org> wrote:
> >> >> solprovider@apache.org wrote:
> >> >> > We can fix that for 1.3, and pass the improvements to Cocoon.  How
> >> >> > about changing the wildcard matcher so it can name variables?
> >> >> >      <!--
> >> >> > /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
> >> >> >      <map:match
> >> pattern="lenyabody-%rendertype%/%pub%/%area%/%doctype%/%%documentpath%%">
> >> >>
> >> >> Just a random thought - another option might be to use "named
> >> matchers",
> >> >> maybe with default values for parameters:
> >> >>
> >> >> <map:match name="content">
> >> >>    <map:param name="pubId" default="{page-envelope:publication-id}"/>
> >> >>    <map:param name="uuid" default="{page-envelope:document-uuid}"/>
> >> >>    <map:generate src="lenyadoc://{$pubId}/{$uuid} ..."
> >> >>    ...
> >> >> </map:match>
> >> >>
> >> >> <map:generate type="matcher" src="content">
> >> >>    <map:parameter name="pubId" value="{1}"/>
> >> >>    <map:parameter name="uuid" value="{2}"/>
> >> >> </map:generate>
> >> >> <map:transform ...
> >> > I do not understand.  How does this apply to naming parts of the URL?
> >> It doesn't, it is to provide parameterized pipelines - similar to
> >> method calls (name + parameters).
> >> > The code in your example does not have a pattern.for the matching.
> >> No, the parameters are passed explicitely, not encoded as a URL string.
> >
> > OK.  You were not answering Jörn's complaint.
>
> i think he did, and i like andreas' approach.
>
> it combines the clarity of your named matcher with a clean separation
> between parameters and URL matching. this has been my greatest grudge
> with cocoon and lenya in particular: how the URL matcher is abused to
> pass internal variables until it bleeds, with magic tokens like
> "lenyabody-" or even worse, "something.xml", that correspond neither to
> files or to actual requests, being only internal hacks to allow for
> parameterisation, without really saying so.
>
> in my own code, i have tried to make such hacks explicit by using the
> "internal-only" attribute of map:pipeline, which in my personal cocoon
> dialect translates to "here be dragons: something clever but
> syntactically ugly is being done."
>
> iiuc correctly, andreas' approach would separate the URL space from the
> internal parameter space, which is very nice imho.

[This discussion probably belongs on the Cocoon Dev ML, rather than
the Lenya User ML.  But we could add the features and passs them back.
 While it might help to get input from Lenya Users, it definitely
belongs on a Dev list.

To be fair to Cocoon, pipeline matching is designed for matching URLs
from visitors, and it does that pretty well.  It was us Lenya users
that bounce the processing through many internal pipelines.]

I like Andreas' approach.  It changes map:match so multiple parameters
including more than one slash are possible.  The downside is the API
for a pipeline may not be apparent unless the parameters are specified
in the pipeline.  We should require that:

<map:generate src="cocoon:/myPipeline">
<map:param name="id" value="someValue"/>
<map:param name="language" default="de"/>
<map:param name="revision" default="edit"/>
</map:generate>

<map:match pattern="myPipeline">
<map:param name="id" default="/index"/>
<map:param name="language" default="{page-envelope:document-language}"/>
<map:param name="revision" default="live"/>

---
Another approach would be local variables in a pipeline.  It allows
explicit naming to the pipeline that uses the variable, rather than
the calling pipeline, but it does not change the calling of a pipeline
with all the variables.  This could be used as a verbose version of
the % syntax:
<map:match pattern="myPipeline/*/*/**">
<map:param name="id" default="{1}"/>
<map:param name="language" default="{2}"/>
<map:param name="revision" default="{3}"/>

The important part (to me) is for the variable names to survive into
nested pipelines, so the {../#} syntax can be forgotten.

---
We may want a new element so internal pipelines do not overload the
map:generate, which is already overloaded with "type".  Calling
internal pipelines is very different than calling serverpages, jx, and
other generators.  Using map:generate disables some abilities such as
map:read.  map:resource/map:call already uses named parameters.  We
should use that as a template, maybe overloading it with
type="resource" and type="pipeline".


> > Your suggestion is for internal pipelines to have the same options as
> > map:call/map:resource.  Combined with map:match, it could have the
> > same effect as my suggestion, sometimes at the cost of having an
> > additional pipeline just to name the parameters.
> that is a question of the syntax, which certainly can be improved (it
> should definitely not be split up into two blocks for something that has
> a 1:1 relation.
> but the grand concept is "separation of URL matching and parameter
> passing", and i'll gratefully trade verbosity for clean separation and
> clarity.
>
> > I cannot decide
> > which is easier for users to understand.  We could implement both as
> > they are not mutually exclusive.  There is the issue if a <map:param>
> > and a %param% have the same name, but let one syntax win the conflicts
> > (and do not make any effort to choose one.)  Any complaints because
> > someone insists on using the same variable name in both syntaxes wins
> > a free missile on same-day delivery.
> woops. i take the blame for introducing the term "shooting offense" into
> the lenya discussion, but to give credit it is solprovider who has
> brought that concept to perfection. :)
Thanks.  Sorry.  I'll stop bombing people.

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: how can i implement language switchers with latest trunk?

Posted by Jörn Nettingsmeier <po...@uni-duisburg.de>.
solprovider@apache.org wrote:
> On 8/18/06, Andreas Hartmann <an...@apache.org> wrote:
>> solprovider@apache.org wrote:
>> > On 8/17/06, Andreas Hartmann <an...@apache.org> wrote:
>> >> solprovider@apache.org wrote:
>> >> > We can fix that for 1.3, and pass the improvements to Cocoon.  How
>> >> > about changing the wildcard matcher so it can name variables?
>> >> >      <!--
>> >> > /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
>> >> >      <map:match 
>> pattern="lenyabody-%rendertype%/%pub%/%area%/%doctype%/%%documentpath%%">
>> >>
>> >> Just a random thought - another option might be to use "named 
>> matchers",
>> >> maybe with default values for parameters:
>> >>
>> >> <map:match name="content">
>> >>    <map:param name="pubId" default="{page-envelope:publication-id}"/>
>> >>    <map:param name="uuid" default="{page-envelope:document-uuid}"/>
>> >>    <map:generate src="lenyadoc://{$pubId}/{$uuid} ..."
>> >>    ...
>> >> </map:match>
>> >>
>> >> <map:generate type="matcher" src="content">
>> >>    <map:parameter name="pubId" value="{1}"/>
>> >>    <map:parameter name="uuid" value="{2}"/>
>> >> </map:generate>
>> >> <map:transform ...
>> > I do not understand.  How does this apply to naming parts of the URL?
>> It doesn't, it is to provide parameterized pipelines - similar to
>> method calls (name + parameters).
>> > The code in your example does not have a pattern.for the matching.
>> No, the parameters are passed explicitely, not encoded as a URL string.
> 
> OK.  You were not answering Jörn's complaint.

i think he did, and i like andreas' approach.

it combines the clarity of your named matcher with a clean separation 
between parameters and URL matching. this has been my greatest grudge 
with cocoon and lenya in particular: how the URL matcher is abused to 
pass internal variables until it bleeds, with magic tokens like 
"lenyabody-" or even worse, "something.xml", that correspond neither to 
files or to actual requests, being only internal hacks to allow for 
parameterisation, without really saying so.

in my own code, i have tried to make such hacks explicit by using the 
"internal-only" attribute of map:pipeline, which in my personal cocoon 
dialect translates to "here be dragons: something clever but 
syntactically ugly is being done."

iiuc correctly, andreas' approach would separate the URL space from the 
internal parameter space, which is very nice imho.

> Your suggestion is for internal pipelines to have the same options as
> map:call/map:resource.  Combined with map:match, it could have the
> same effect as my suggestion, sometimes at the cost of having an
> additional pipeline just to name the parameters. 

that is a question of the syntax, which certainly can be improved (it 
should definitely not be split up into two blocks for something that has 
a 1:1 relation.
but the grand concept is "separation of URL matching and parameter 
passing", and i'll gratefully trade verbosity for clean separation and 
clarity.

> I cannot decide
> which is easier for users to understand.  We could implement both as
> they are not mutually exclusive.  There is the issue if a <map:param>
> and a %param% have the same name, but let one syntax win the conflicts
> (and do not make any effort to choose one.)  Any complaints because
> someone insists on using the same variable name in both syntaxes wins
> a free missile on same-day delivery.

woops. i take the blame for introducing the term "shooting offense" into 
the lenya discussion, but to give credit it is solprovider who has 
brought that concept to perfection. :)

-- 
"Open source takes the bullshit out of software."
	- Charles Ferguson on TechnologyReview.com

--
Jörn Nettingsmeier, EDV-Administrator
Institut für Politikwissenschaft
Universität Duisburg-Essen, Standort Duisburg
Mail: pol-admin@uni-due.de, Telefon: 0203/379-2736

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: how can i implement language switchers with latest trunk?

Posted by so...@apache.org.
On 8/18/06, Andreas Hartmann <an...@apache.org> wrote:
> solprovider@apache.org wrote:
> > On 8/17/06, Andreas Hartmann <an...@apache.org> wrote:
> >> solprovider@apache.org wrote:
> >> > We can fix that for 1.3, and pass the improvements to Cocoon.  How
> >> > about changing the wildcard matcher so it can name variables?
> >> >      <!--
> >> > /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
> >> >      <map:match pattern="lenyabody-%rendertype%/%pub%/%area%/%doctype%/%%documentpath%%">
> >>
> >> Just a random thought - another option might be to use "named matchers",
> >> maybe with default values for parameters:
> >>
> >> <map:match name="content">
> >>    <map:param name="pubId" default="{page-envelope:publication-id}"/>
> >>    <map:param name="uuid" default="{page-envelope:document-uuid}"/>
> >>    <map:generate src="lenyadoc://{$pubId}/{$uuid} ..."
> >>    ...
> >> </map:match>
> >>
> >> <map:generate type="matcher" src="content">
> >>    <map:parameter name="pubId" value="{1}"/>
> >>    <map:parameter name="uuid" value="{2}"/>
> >> </map:generate>
> >> <map:transform ...
> > I do not understand.  How does this apply to naming parts of the URL?
> It doesn't, it is to provide parameterized pipelines - similar to
> method calls (name + parameters).
> > The code in your example does not have a pattern.for the matching.
> No, the parameters are passed explicitely, not encoded as a URL string.

OK.  You were not answering Jörn's complaint.  He thinks too much like
I do.  I have had several time-consuming errors because I added
map:act around some code and did not change {#} to {../#}.  Adding a
level for map:match is mostly obvious, but I do not know why map:act
adds a level to the variables.  Naming the variables removes the
possibility of this issue.

Your suggestion is for internal pipelines to have the same options as
map:call/map:resource.  Combined with map:match, it could have the
same effect as my suggestion, sometimes at the cost of having an
additional pipeline just to name the parameters.  I cannot decide
which is easier for users to understand.  We could implement both as
they are not mutually exclusive.  There is the issue if a <map:param>
and a %param% have the same name, but let one syntax win the conflicts
(and do not make any effort to choose one.)  Any complaints because
someone insists on using the same variable name in both syntaxes wins
a free missile on same-day delivery.

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: how can i implement language switchers with latest trunk?

Posted by Andreas Hartmann <an...@apache.org>.
solprovider@apache.org wrote:
> On 8/17/06, Andreas Hartmann <an...@apache.org> wrote:
>> solprovider@apache.org wrote:
>> > We can fix that for 1.3, and pass the improvements to Cocoon.  How
>> > about changing the wildcard matcher so it can name variables?
>> >      <!--
>> > /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
>> >      <map:match
>> > 
>> pattern="lenyabody-%rendertype%/%pub%/%area%/%doctype%/%%documentpath%%">
>>
>>
>> Just a random thought - another option might be to use "named matchers",
>> maybe with default values for parameters:
>>
>> <map:match name="content">
>>    <map:param name="pubId" default="{page-envelope:publication-id}"/>
>>    <map:param name="uuid" default="{page-envelope:document-uuid}"/>
>>    <map:generate src="lenyadoc://{$pubId}/{$uuid} ..."
>>    ...
>> </map:match>
>>
>> <map:generate type="matcher" src="content">
>>    <map:parameter name="pubId" value="{1}"/>
>>    <map:parameter name="uuid" value="{2}"/>
>> </map:generate>
>> <map:transform ...
> 
> I do not understand.  How does this apply to naming parts of the URL?

It doesn't, it is to provide parameterized pipelines - similar to
method calls (name + parameters).

> The code in your example does not have a pattern.for the matching.

No, the parameters are passed explicitely, not encoded as a URL string.

-- Andreas


-- 
Andreas Hartmann
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
andreas.hartmann@wyona.com                     andreas@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: how can i implement language switchers with latest trunk?

Posted by so...@apache.org.
On 8/17/06, Andreas Hartmann <an...@apache.org> wrote:
> solprovider@apache.org wrote:
> > We can fix that for 1.3, and pass the improvements to Cocoon.  How
> > about changing the wildcard matcher so it can name variables?
> >      <!--
> > /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
> >      <map:match
> > pattern="lenyabody-%rendertype%/%pub%/%area%/%doctype%/%%documentpath%%">
>
>
> Just a random thought - another option might be to use "named matchers",
> maybe with default values for parameters:
>
> <map:match name="content">
>    <map:param name="pubId" default="{page-envelope:publication-id}"/>
>    <map:param name="uuid" default="{page-envelope:document-uuid}"/>
>    <map:generate src="lenyadoc://{$pubId}/{$uuid} ..."
>    ...
> </map:match>
>
> <map:generate type="matcher" src="content">
>    <map:parameter name="pubId" value="{1}"/>
>    <map:parameter name="uuid" value="{2}"/>
> </map:generate>
> <map:transform ...

I do not understand.  How does this apply to naming parts of the URL?
The code in your example does not have a pattern.for the matching.

http://myserver/mypub/module/param1/param2/documentpath/doc.html
   reaches a 1.3 Module as:
module/param1/param2/documentpath/doc.html
   so use a normal match could be:
<map:match pattern="*/*/*/**.html">
   The same match with the % syntax could be:
<map:match pattern="*/%par1%/%par2/%%documentPathAndID%%.html">
{1} = "module"  (unneeded, so use numbered syntax)
{par1} = "param1"
{par2} = "param2"
{documentPathAndID} = "documentpath/doc"

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: how can i implement language switchers with latest trunk?

Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann wrote:
> solprovider@apache.org wrote:
> 
> [...]
> 
>>> oh well, the wildcard matcher was designed for simple request matching,
>>> not as a parameter passing mechanism...
>>
>> We can fix that for 1.3, and pass the improvements to Cocoon.  How
>> about changing the wildcard matcher so it can name variables?
>>      <!-- 
>> /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
>>      <map:match
>> pattern="lenyabody-%rendertype%/%pub%/%area%/%doctype%/%%documentpath%%">
> 
> 
> Just a random thought - another option might be to use "named matchers",
> maybe with default values for parameters:

Well, I guess this would be quite close to virtual pipeline components.

-- Andreas

> 
> <map:match name="content">
>   <map:param name="pubId" default="{page-envelope:publication-id}"/>
>   <map:param name="uuid" default="{page-envelope:document-uuid}"/>
>   <map:generate src="lenyadoc://{$pubId}/{$uuid} ..."
>   ...
> </map:match>
> 
> 
> <map:generate type="matcher" src="content">
>   <map:parameter name="pubId" value="{1}"/>
>   <map:parameter name="uuid" value="{2}"/>
> </map:generate>
> <map:transform ...
> 
> 
> -- Andreas
> 
> 
>>        <map:aggregate element="cmsbody">
>>          <map:part
>> src="cocoon://navigation/{pub}/{area}/breadcrumb/{documentpath}.xml"/>
>>
>> Would that syntax be useful? Could the Typical User understand it?  Is
>> '%' a good choice?
>>
>> DESIGN NOTES:
>> - If formats are mixed, the * and ** are still available in numbered
>> variables.  The % syntax variables are not assigned to numbered
>> variables.
>> - The named variables are available in nested pipelines without the
>> {../#} syntax.
>> - Variable names cannot contain colons.  The colon specifies the
>> variable is from an InputModule, not a pipeline variable.
>> - Reusing the name of a variable in nested pipelines is bad practice.
>> Variables must honor scope.  A parent pipeline's variables remain
>> available.  If a name is reused, the latest wins in the nested
>> pipeline.  Using parent pipeline's variables with the {../myvar}
>> syntax is silly and defeats the purpose, so the syntax is not
>> supported, and anybody who complains is sent an ICBM.  When leaving
>> the nested pipeline, its variables are not available.
>>
>> solprovider
> 
> 


-- 
Andreas Hartmann
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
andreas.hartmann@wyona.com                     andreas@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: how can i implement language switchers with latest trunk?

Posted by Andreas Hartmann <an...@apache.org>.
solprovider@apache.org wrote:

[...]

>> oh well, the wildcard matcher was designed for simple request matching,
>> not as a parameter passing mechanism...
> 
> We can fix that for 1.3, and pass the improvements to Cocoon.  How
> about changing the wildcard matcher so it can name variables?
>      <!-- 
> /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
>      <map:match
> pattern="lenyabody-%rendertype%/%pub%/%area%/%doctype%/%%documentpath%%">


Just a random thought - another option might be to use "named matchers",
maybe with default values for parameters:

<map:match name="content">
   <map:param name="pubId" default="{page-envelope:publication-id}"/>
   <map:param name="uuid" default="{page-envelope:document-uuid}"/>
   <map:generate src="lenyadoc://{$pubId}/{$uuid} ..."
   ...
</map:match>


<map:generate type="matcher" src="content">
   <map:parameter name="pubId" value="{1}"/>
   <map:parameter name="uuid" value="{2}"/>
</map:generate>
<map:transform ...


-- Andreas


>        <map:aggregate element="cmsbody">
>          <map:part
> src="cocoon://navigation/{pub}/{area}/breadcrumb/{documentpath}.xml"/>
> 
> Would that syntax be useful? Could the Typical User understand it?  Is
> '%' a good choice?
> 
> DESIGN NOTES:
> - If formats are mixed, the * and ** are still available in numbered
> variables.  The % syntax variables are not assigned to numbered
> variables.
> - The named variables are available in nested pipelines without the
> {../#} syntax.
> - Variable names cannot contain colons.  The colon specifies the
> variable is from an InputModule, not a pipeline variable.
> - Reusing the name of a variable in nested pipelines is bad practice.
> Variables must honor scope.  A parent pipeline's variables remain
> available.  If a name is reused, the latest wins in the nested
> pipeline.  Using parent pipeline's variables with the {../myvar}
> syntax is silly and defeats the purpose, so the syntax is not
> supported, and anybody who complains is sent an ICBM.  When leaving
> the nested pipeline, its variables are not available.
> 
> solprovider


-- 
Andreas Hartmann
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
andreas.hartmann@wyona.com                     andreas@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: how can i implement language switchers with latest trunk?

Posted by so...@apache.org.
On 8/16/06, Jörn Nettingsmeier <po...@uni-duisburg.de> wrote:
> Andreas Hartmann wrote:
> > Joern Nettingsmeier wrote:
> >>> You get the path in the site structure (formerly known as document
> >>> ID) with
> >>>   {doc-info:{pubId}:{area}:{uuid}:{language}:path}
> >>> I understand that this syntax is quite verbose, but the implicit
> >>> page envelope syntax caused some problems - you have to be very
> >>> careful when writing pipelines which can be accessed for arbitrary
> >>> documents.
> >> thanks for the help. can you elaborate on the problems with
> >> {page-envelope:*}? i've been using it a lot in module sitemaps, but i
> >> have this nagging feeling that i'm going to regret it some day.
> > The problem with the page envelope is that you assume that a pipeline
> > applies to the currently requested document. This way, you lose the
> > ability to call the pipeline for arbitrary documents. Actually, it
> > violates orthogonality - you put the mechanism of getting the parameter
> > (the document) and the actual functionality in the same place.
> > You should rather use a (reusable) pipeline like a method - by declaring
> > parameters in the method signature, you make it generic.
> thanks for clarifying.

In 1.3, the ContentInputModule {content:variable:document} retrieves
information about the specified Resource.  I think that satisfies
Andreas' requirement.  PageEnvelope is still used, mostly to decide
the current publication and language.

> the problem with cocoon is that there is a trade-off between
> re-usablility of pipelines and readability, and it's a crooked one.
> make your pipelines just a little more generic, and they immediately get
> extremely cluttered with a gazillion wildcard matchers and those
> oh-so-stupid-what-were-they-thinking magic variable numbers all over the
> place.
> oh well, the wildcard matcher was designed for simple request matching,
> not as a parameter passing mechanism...

We can fix that for 1.3, and pass the improvements to Cocoon.  How
about changing the wildcard matcher so it can name variables?
      <!-- /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
      <map:match
pattern="lenyabody-%rendertype%/%pub%/%area%/%doctype%/%%documentpath%%">
        <map:aggregate element="cmsbody">
          <map:part
src="cocoon://navigation/{pub}/{area}/breadcrumb/{documentpath}.xml"/>

Would that syntax be useful? Could the Typical User understand it?  Is
'%' a good choice?

DESIGN NOTES:
- If formats are mixed, the * and ** are still available in numbered
variables.  The % syntax variables are not assigned to numbered
variables.
- The named variables are available in nested pipelines without the
{../#} syntax.
- Variable names cannot contain colons.  The colon specifies the
variable is from an InputModule, not a pipeline variable.
- Reusing the name of a variable in nested pipelines is bad practice.
Variables must honor scope.  A parent pipeline's variables remain
available.  If a name is reused, the latest wins in the nested
pipeline.  Using parent pipeline's variables with the {../myvar}
syntax is silly and defeats the purpose, so the syntax is not
supported, and anybody who complains is sent an ICBM.  When leaving
the nested pipeline, its variables are not available.

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: how can i implement language switchers with latest trunk?

Posted by Jörn Nettingsmeier <po...@uni-duisburg.de>.
Andreas Hartmann wrote:
> Joern Nettingsmeier wrote:
> 
> [...]
> 
>>> You get the path in the site structure (formerly known as document 
>>> ID) with
>>>
>>>   {doc-info:{pubId}:{area}:{uuid}:{language}:path}
>>>
>>> I understand that this syntax is quite verbose, but the implicit
>>> page envelope syntax caused some problems - you have to be very
>>> careful when writing pipelines which can be accessed for arbitrary
>>> documents.
>>
>> thanks for the help. can you elaborate on the problems with
>> {page-envelope:*}? i've been using it a lot in module sitemaps, but i
>> have this nagging feeling that i'm going to regret it some day.
> 
> The problem with the page envelope is that you assume that a pipeline
> applies to the currently requested document. This way, you lose the
> ability to call the pipeline for arbitrary documents. Actually, it
> violates orthogonality - you put the mechanism of getting the parameter
> (the document) and the actual functionality in the same place.
> You should rather use a (reusable) pipeline like a method - by declaring
> parameters in the method signature, you make it generic.

thanks for clarifying.

the problem with cocoon is that there is a trade-off between 
re-usablility of pipelines and readability, and it's a crooked one.

make your pipelines just a little more generic, and they immediately get 
extremely cluttered with a gazillion wildcard matchers and those 
oh-so-stupid-what-were-they-thinking magic variable numbers all over the 
place.
oh well, the wildcard matcher was designed for simple request matching, 
not as a parameter passing mechanism...

>> some sort of "best practice" hints would be cool, maybe pointers to
>> publications or modules that Do It Right(tm) ?
> 
> A good example is indexing in the lucene module - the area, uuid etc.
> are passed to the pipeline, this way you can index arbitrary documents
> from the same page context.

hmm. i see the mechanism you were talking about, but still this is one 
of the more frightful sitemaps in lenya.
plus it contradicts your points in some of its pipelines.
for example, there's a matcher for "opensearch.xml", which looks like a 
user request for a file, but it's obviously not, since the pipeline uses 
{page-envelope:*} all over the place, so "opensearch.xml" is another 
internal magic token disguised as a file request out of sheer 
evil-mindedness. sigh.



-- 
"Open source takes the bullshit out of software."
	- Charles Ferguson on TechnologyReview.com

--
Jörn Nettingsmeier, EDV-Administrator
Institut für Politikwissenschaft
Universität Duisburg-Essen, Standort Duisburg
Mail: pol-admin@uni-due.de, Telefon: 0203/379-2736

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: how can i implement language switchers with latest trunk?

Posted by Andreas Hartmann <an...@apache.org>.
Joern Nettingsmeier wrote:

[...]

>> You get the path in the site structure (formerly known as document ID) with
>>
>>   {doc-info:{pubId}:{area}:{uuid}:{language}:path}
>>
>> I understand that this syntax is quite verbose, but the implicit
>> page envelope syntax caused some problems - you have to be very
>> careful when writing pipelines which can be accessed for arbitrary
>> documents.
> 
> thanks for the help. can you elaborate on the problems with
> {page-envelope:*}? i've been using it a lot in module sitemaps, but i
> have this nagging feeling that i'm going to regret it some day.

The problem with the page envelope is that you assume that a pipeline
applies to the currently requested document. This way, you lose the
ability to call the pipeline for arbitrary documents. Actually, it
violates orthogonality - you put the mechanism of getting the parameter
(the document) and the actual functionality in the same place.
You should rather use a (reusable) pipeline like a method - by declaring
parameters in the method signature, you make it generic.


> some sort of "best practice" hints would be cool, maybe pointers to
> publications or modules that Do It Right(tm) ?

A good example is indexing in the lucene module - the area, uuid etc.
are passed to the pipeline, this way you can index arbitrary documents
from the same page context.

-- Andreas


-- 
Andreas Hartmann
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
andreas.hartmann@wyona.com                     andreas@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: how can i implement language switchers with latest trunk?

Posted by Joern Nettingsmeier <po...@uni-due.de>.
Andreas Hartmann wrote:
> Joern Nettingsmeier wrote:
>> hi andreas, hi everyone!
>>
>>
>> after the recent migration to uuids, my language switching buttons are
>> broken. i used to do this in my page2xhtml.xsl:
>>
>> <a href="{$root}{$document-id}_en.html">english</a>, where the
>> variables are
>> <!-- /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
>> <map:match pattern="lenyabody-*/*/*/*/**">
>> ...
>>   <map:transform...>
>>      <map:parameter name="root" value="{base-url:{2}:{3}}"/>
>>      <map:parameter name="document-id"
>>             value="{page-envelope:document-id}"/>
>>
>> of course, this now produces links like
>> http://localhost:8888/soziologie/authoringba4ba940-2b8f-11db-8109-9e43e820a3df_en.html.
>>
>>
>> what is the new way to do it?
> 
> You get the path in the site structure (formerly known as document ID) with
> 
>   {doc-info:{pubId}:{area}:{uuid}:{language}:path}
> 
> I understand that this syntax is quite verbose, but the implicit
> page envelope syntax caused some problems - you have to be very
> careful when writing pipelines which can be accessed for arbitrary
> documents.

thanks for the help. can you elaborate on the problems with
{page-envelope:*}? i've been using it a lot in module sitemaps, but i
have this nagging feeling that i'm going to regret it some day.

some sort of "best practice" hints would be cool, maybe pointers to
publications or modules that Do It Right(tm) ?

best,

jörn




-- 
"I don't need backups. I need restore!" - Trad.

--
Jörn Nettingsmeier, EDV-Administrator
Institut für Politikwissenschaft
Universität Duisburg-Essen, Standort Duisburg
Mail: pol-admin@uni-due.de, Telefon: 0203/379-2736


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: how can i implement language switchers with latest trunk?

Posted by Andreas Hartmann <an...@apache.org>.
Joern Nettingsmeier wrote:
> hi andreas, hi everyone!
> 
> 
> after the recent migration to uuids, my language switching buttons are
> broken. i used to do this in my page2xhtml.xsl:
> 
> <a href="{$root}{$document-id}_en.html">english</a>, where the variables are
> <!-- /lenyabody-{rendertype}/{publication-id}/{area}/{doctype}/{url} -->
> <map:match pattern="lenyabody-*/*/*/*/**">
> ...
>   <map:transform...>
>      <map:parameter name="root" value="{base-url:{2}:{3}}"/>
>      <map:parameter name="document-id"
>             value="{page-envelope:document-id}"/>
> 
> of course, this now produces links like
> http://localhost:8888/soziologie/authoringba4ba940-2b8f-11db-8109-9e43e820a3df_en.html.
> 
> what is the new way to do it?

You get the path in the site structure (formerly known as document ID) with

   {doc-info:{pubId}:{area}:{uuid}:{language}:path}

I understand that this syntax is quite verbose, but the implicit
page envelope syntax caused some problems - you have to be very
careful when writing pipelines which can be accessed for arbitrary
documents.

-- Andreas


-- 
Andreas Hartmann
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
andreas.hartmann@wyona.com                     andreas@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org