You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jos Snellings <jo...@upperware.biz> on 2012/05/24 16:31:19 UTC

Sitemap: path matching

Hi all,

I am looking for a way to pass a variable number of sitemap parameters to a
sitemap component:
I explain the use case:

"**" stands for non-greedy multiple segment matcher, no?

<map:match pattern="retrievebypath/**/{name}.{extension}">
      <map:generate type="retrieve">
            <map:parameter ?
      </map:generate>
</map:match>

Of course you could {1}, {2}, {3} .... but that is a clutch.
Is there an elegant way?

Kind regards,
Jos


-- 
The doctrine of human equality reposes on this: that there is no man
really clever who has not found that he is stupid.
        -- Gilbert K. Chesterson

RE: Sitemap: path matching

Posted by Robby Pelssers <Ro...@nxp.com>.
But as a little side note:

If all files in these folders were treated uniformely.. let's say with a map:read

You could just as well do

<Map:match pattern=" matchbypath/**">
  <map:read src="{1}"/>


From: Robby Pelssers [mailto:Robby.Pelssers@nxp.com]
Sent: Thursday, May 24, 2012 4:48 PM
To: users@cocoon.apache.org
Subject: RE: Sitemap: path matching

The only way to work around this is what I've used in the past.

matchbypath/index.html/virtualrootfolder/themes/conservation

pattern="matchbypath/*.*/**"


From: Jos Snellings [mailto:jos.snellings@upperware.biz]
Sent: Thursday, May 24, 2012 4:45 PM
To: users@cocoon.apache.org
Subject: Re: Sitemap: path matching

Hi Robby,

Here's an example:

       <a href="matchbypath/virtualrootfolder/themes/conservation/index.html"> conservation </a>

               => this is to be a hit for a matcher, and what I would like to pass to the generator:

               "matchbypath/{path}/{name}.{extension}"

           Of course, the pipeline matcher cannot know how many segments there will be.

Cheers,
Jos

On Thu, May 24, 2012 at 4:38 PM, Robby Pelssers <Ro...@nxp.com>> wrote:
Can you give a few possible examples of the pattern that you're trying to match?

Ps.  Maybe a bit nasty as solution but let's say you want to handle multiple productId's


Pattern="generateProduct/*"

Example

generateProduct/[P1, P2, P3]

You just pass '[P1,P2,P3]' to your generator as a single argument and let the generator extract the ids.

Robby

From: Jos Snellings [mailto:jos.snellings@upperware.biz<ma...@upperware.biz>]
Sent: Thursday, May 24, 2012 4:31 PM
To: cocoon-users@apache.org<ma...@apache.org>
Subject: Sitemap: path matching

Hi all,

I am looking for a way to pass a variable number of sitemap parameters to a sitemap component:
I explain the use case:

"**" stands for non-greedy multiple segment matcher, no?

<map:match pattern="retrievebypath/**/{name}.{extension}">
      <map:generate type="retrieve">
            <map:parameter ?
      </map:generate>
</map:match>

Of course you could {1}, {2}, {3} .... but that is a clutch.
Is there an elegant way?

Kind regards,
Jos


--
The doctrine of human equality reposes on this: that there is no man
really clever who has not found that he is stupid.
        -- Gilbert K. Chesterson



--
The doctrine of human equality reposes on this: that there is no man
really clever who has not found that he is stupid.
        -- Gilbert K. Chesterson

Re: Sitemap: path matching

Posted by Jos Snellings <jo...@upperware.biz>.
Yep, I will give that a try !

Thanks, Robby,
Jos

RE: Sitemap: path matching

Posted by Robby Pelssers <Ro...@nxp.com>.
The only way to work around this is what I've used in the past.

matchbypath/index.html/virtualrootfolder/themes/conservation

pattern="matchbypath/*.*/**"


From: Jos Snellings [mailto:jos.snellings@upperware.biz]
Sent: Thursday, May 24, 2012 4:45 PM
To: users@cocoon.apache.org
Subject: Re: Sitemap: path matching

Hi Robby,

Here's an example:

       <a href="matchbypath/virtualrootfolder/themes/conservation/index.html"> conservation </a>

               => this is to be a hit for a matcher, and what I would like to pass to the generator:

               "matchbypath/{path}/{name}.{extension}"

           Of course, the pipeline matcher cannot know how many segments there will be.

Cheers,
Jos


On Thu, May 24, 2012 at 4:38 PM, Robby Pelssers <Ro...@nxp.com>> wrote:
Can you give a few possible examples of the pattern that you're trying to match?

Ps.  Maybe a bit nasty as solution but let's say you want to handle multiple productId's


Pattern="generateProduct/*"

Example

generateProduct/[P1, P2, P3]

You just pass '[P1,P2,P3]' to your generator as a single argument and let the generator extract the ids.

Robby

From: Jos Snellings [mailto:jos.snellings@upperware.biz<ma...@upperware.biz>]
Sent: Thursday, May 24, 2012 4:31 PM
To: cocoon-users@apache.org<ma...@apache.org>
Subject: Sitemap: path matching

Hi all,

I am looking for a way to pass a variable number of sitemap parameters to a sitemap component:
I explain the use case:

"**" stands for non-greedy multiple segment matcher, no?

<map:match pattern="retrievebypath/**/{name}.{extension}">
      <map:generate type="retrieve">
            <map:parameter ?
      </map:generate>
</map:match>

Of course you could {1}, {2}, {3} .... but that is a clutch.
Is there an elegant way?

Kind regards,
Jos


--
The doctrine of human equality reposes on this: that there is no man
really clever who has not found that he is stupid.
        -- Gilbert K. Chesterson



--
The doctrine of human equality reposes on this: that there is no man
really clever who has not found that he is stupid.
        -- Gilbert K. Chesterson


Re: Sitemap: path matching

Posted by Jos Snellings <jo...@upperware.biz>.
Hi Robby,

Here's an example:

       <a
href="matchbypath/virtualrootfolder/themes/conservation/index.html">
conservation </a>

               => this is to be a hit for a matcher, and what I would like
to pass to the generator:

               "matchbypath/{path}/{name}.{extension}"

           Of course, the pipeline matcher cannot know how many segments
there will be.

Cheers,
Jos



On Thu, May 24, 2012 at 4:38 PM, Robby Pelssers <Ro...@nxp.com>wrote:

> Can you give a few possible examples of the pattern that you’re trying to
> match?****
>
> ** **
>
> Ps.  Maybe a bit nasty as solution but let’s say you want to handle
> multiple productId’s****
>
> ** **
>
> ** **
>
> Pattern=”generateProduct/*”****
>
> ** **
>
> Example****
>
> ** **
>
> generateProduct/[P1, P2, P3]****
>
> ** **
>
> You just pass ‘[P1,P2,P3]’ to your generator as a single argument and let
> the generator extract the ids.****
>
> ** **
>
> Robby****
>
> ** **
>
> *From:* Jos Snellings [mailto:jos.snellings@upperware.biz]
> *Sent:* Thursday, May 24, 2012 4:31 PM
> *To:* cocoon-users@apache.org
> *Subject:* Sitemap: path matching****
>
> ** **
>
> Hi all,
>
> I am looking for a way to pass a variable number of sitemap parameters to
> a sitemap component:
> I explain the use case:
>
> "**" stands for non-greedy multiple segment matcher, no?
>
> <map:match pattern="retrievebypath/**/{name}.{extension}">
>       <map:generate type="retrieve">
>             <map:parameter ?
>       </map:generate>
> </map:match>
>
> Of course you could {1}, {2}, {3} .... but that is a clutch.
> Is there an elegant way?
>
> Kind regards,
> Jos
>
>
> --
> The doctrine of human equality reposes on this: that there is no man
> really clever who has not found that he is stupid.
>         -- Gilbert K. Chesterson
>
> ****
>



-- 
The doctrine of human equality reposes on this: that there is no man
really clever who has not found that he is stupid.
        -- Gilbert K. Chesterson

RE: Sitemap: path matching

Posted by Robby Pelssers <Ro...@nxp.com>.
Can you give a few possible examples of the pattern that you're trying to match?

Ps.  Maybe a bit nasty as solution but let's say you want to handle multiple productId's


Pattern="generateProduct/*"

Example

generateProduct/[P1, P2, P3]

You just pass '[P1,P2,P3]' to your generator as a single argument and let the generator extract the ids.

Robby

From: Jos Snellings [mailto:jos.snellings@upperware.biz]
Sent: Thursday, May 24, 2012 4:31 PM
To: cocoon-users@apache.org
Subject: Sitemap: path matching

Hi all,

I am looking for a way to pass a variable number of sitemap parameters to a sitemap component:
I explain the use case:

"**" stands for non-greedy multiple segment matcher, no?

<map:match pattern="retrievebypath/**/{name}.{extension}">
      <map:generate type="retrieve">
            <map:parameter ?
      </map:generate>
</map:match>

Of course you could {1}, {2}, {3} .... but that is a clutch.
Is there an elegant way?

Kind regards,
Jos


--
The doctrine of human equality reposes on this: that there is no man
really clever who has not found that he is stupid.
        -- Gilbert K. Chesterson


RE: Sitemap: path matching

Posted by Robby Pelssers <Ro...@nxp.com>.
That won't solve Jos's issue I'm afraid. From the docs it states: 'If set to true the values of a request parameter is available using a variable in the xslt with the name of the parameter.'  Jos doesn’t know which parameters will be passed upfront. This is merely a shortcut that prevents you from typing all parameters as  <map:parameter .../>

Robby

-----Original Message-----
From: ktorres@agssa.net [mailto:ktorres@agssa.net] 
Sent: Thursday, May 24, 2012 6:55 PM
To: users@cocoon.apache.org
Cc: cocoon-users@apache.org
Subject: Re: Sitemap: path matching

Hello Gilbert,

A way to catch multiple parameter is to have your own stylesheet where you
define as many parameters as you need and then you use the XSLT
Transformer[1] to get them on your pipeline.

The way to retrieve your parameters is setting to "true" the property
"use-request-parameters"  at your pipeline, eg:

 <map:match pattern="retrievebypath/**/{name}.{extension}>
        <map:generate type="retrieve"/>
        <map:transform src="my_xslt.xslt">
          <map:parameter name="use-request-parameters" value="true"/>
        </map:transform>
      </map:match>

BTW - The '**' wildcard is greedy and thus the following sample matches as
{"foo/bar","baz","bug"}.

[1] http://cocoon.apache.org/2.1/userdocs/xslt-transformer.html

Thanks.

Kind regards,
Karen Torres.

> Hi all,
>
> I am looking for a way to pass a variable number of sitemap parameters to
> a
> sitemap component:
> I explain the use case:
>
> "**" stands for non-greedy multiple segment matcher, no?
>
> <map:match pattern="retrievebypath/**/{name}.{extension}">
>       <map:generate type="retrieve">
>             <map:parameter ?
>       </map:generate>
> </map:match>
>
> Of course you could {1}, {2}, {3} .... but that is a clutch.
> Is there an elegant way?
>
> Kind regards,
> Jos
>
>
> --
> The doctrine of human equality reposes on this: that there is no man
> really clever who has not found that he is stupid.
>         -- Gilbert K. Chesterson
>


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


Re: Sitemap: path matching

Posted by kt...@agssa.net.
Hello Gilbert,

A way to catch multiple parameter is to have your own stylesheet where you
define as many parameters as you need and then you use the XSLT
Transformer[1] to get them on your pipeline.

The way to retrieve your parameters is setting to "true" the property
"use-request-parameters"  at your pipeline, eg:

 <map:match pattern="retrievebypath/**/{name}.{extension}>
        <map:generate type="retrieve"/>
        <map:transform src="my_xslt.xslt">
          <map:parameter name="use-request-parameters" value="true"/>
        </map:transform>
      </map:match>

BTW - The '**' wildcard is greedy and thus the following sample matches as
{"foo/bar","baz","bug"}.

[1] http://cocoon.apache.org/2.1/userdocs/xslt-transformer.html

Thanks.

Kind regards,
Karen Torres.

> Hi all,
>
> I am looking for a way to pass a variable number of sitemap parameters to
> a
> sitemap component:
> I explain the use case:
>
> "**" stands for non-greedy multiple segment matcher, no?
>
> <map:match pattern="retrievebypath/**/{name}.{extension}">
>       <map:generate type="retrieve">
>             <map:parameter ?
>       </map:generate>
> </map:match>
>
> Of course you could {1}, {2}, {3} .... but that is a clutch.
> Is there an elegant way?
>
> Kind regards,
> Jos
>
>
> --
> The doctrine of human equality reposes on this: that there is no man
> really clever who has not found that he is stupid.
>         -- Gilbert K. Chesterson
>


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