You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Klaasen Tom <To...@the-ecorp.com> on 2001/03/07 18:08:12 UTC

[C2] Map passing through multiple levels

Hi,

I'm trying to pull this off:

   <map:match pattern="wimps/*">
   	<map:act type="parameter_select">
   		<parameter name="lang"/>
   		<parameter name="user"/>
   		<parameter name="version"/>
   		<map:match type="doctype" pattern="wepul">
   	 		<map:generate type="wimps" src="{1}"/>
			<map:transform type="xslt"
src="stylesheets/wimps/simple.xsl"/>
			<map:serialize type="html"/>
     		</map:match>    		
    	</map:act>
   </map:match>   

The question whether this "parameter_select" is the way to go aside, I want
the {1} in <map:generate type="wimps" src="{1}"/> to translate in the * from
<map:match pattern="wimps/*">. However, this doesn't work (because I've got
a nested matcher). Is there a way that I can get access to the value of the
* in this construct? Or do I have to put that {1} in the objectModel also
and retrieve it in the generate step? That solution doesn't seem very
attracting to me. Is there something like {../1}?

About the parameter_select: this is a class inspired on the LangSelect
action, but I tried to make it a bit more generic (it gets all parameters of
the <parameter...> tags, not only the hard coded "lang" parameter). I'm
still a bit unsecure whether this is a nice solution (it seems I've copied
the selector behaviour, but with a construct that is much easier to
implement).

Thanks for your comments.

Re: [C2] Map passing through multiple levels

Posted by Berin Loritsch <bl...@apache.org>.
Klaasen Tom wrote:
> 
> Hi,
> 
> I'm trying to pull this off:
> 
>    <map:match pattern="wimps/*">
>         <map:act type="parameter_select">
>                 <parameter name="lang"/>
>                 <parameter name="user"/>
>                 <parameter name="version"/>
>                 <map:match type="doctype" pattern="wepul">
>                         <map:generate type="wimps" src="{1}"/>
>                         <map:transform type="xslt"
> src="stylesheets/wimps/simple.xsl"/>
>                         <map:serialize type="html"/>
>                 </map:match>
>         </map:act>
>    </map:match>
> 
> The question whether this "parameter_select" is the way to go aside, I want
> the {1} in <map:generate type="wimps" src="{1}"/> to translate in the * from
> <map:match pattern="wimps/*">. However, this doesn't work (because I've got
> a nested matcher). Is there a way that I can get access to the value of the
> * in this construct? Or do I have to put that {1} in the objectModel also
> and retrieve it in the generate step? That solution doesn't seem very
> attracting to me. Is there something like {../1}?
> 
> About the parameter_select: this is a class inspired on the LangSelect
> action, but I tried to make it a bit more generic (it gets all parameters of
> the <parameter...> tags, not only the hard coded "lang" parameter). I'm
> still a bit unsecure whether this is a nice solution (it seems I've copied
> the selector behaviour, but with a construct that is much easier to
> implement).
> 
> Thanks for your comments.

In my proprietary Navigation action, I have an action react to the source
parameter, i.e. modifying the action will permit you to do this:

<map:act type="parameter_select" src="{1}">
     <parameter name="lang"/>
     <parameter name="user"/>
     <parameter name="version"/>
     <map:match type="doctype" pattern="wepul">
           <map:generate type="wimps" src="{destination}"/>
           <map:transform type="xslt" src="stylesheets/wimps/simple.xsl"/>
           <map:serialize type="html"/>
     </map:match>
</map:act>

The parameter_select Action will do something along the following:
------------------------------------------------------------------

actionMap.put("destination", source);
// .... Skip a few lines ....
return actionMap;

I use it for access control and such.

Re: [C2] Map passing through multiple levels

Posted by Giacomo Pati <gi...@apache.org>.
Klaasen Tom wrote:
> Hi,
>
> I'm trying to pull this off:
>
>    <map:match pattern="wimps/*">
>    	<map:act type="parameter_select">
>    		<parameter name="lang"/>
>    		<parameter name="user"/>
>    		<parameter name="version"/>
>    		<map:match type="doctype" pattern="wepul">
>    	 		<map:generate type="wimps" src="{1}"/>
> 			<map:transform type="xslt"
> src="stylesheets/wimps/simple.xsl"/>
> 			<map:serialize type="html"/>
>      		</map:match>
>     	</map:act>
>    </map:match>
>
> The question whether this "parameter_select" is the way to go aside, I want
> the {1} in <map:generate type="wimps" src="{1}"/> to translate in the *
> from <map:match pattern="wimps/*">. However, this doesn't work (because
> I've got a nested matcher). Is there a way that I can get access to the
> value of the * in this construct? Or do I have to put that {1} in the
> objectModel also and retrieve it in the generate step? That solution
> doesn't seem very attracting to me. Is there something like {../1}?

Exactly! you refer to the matchers pattern by {../1} because a Matcher and 
Actions return a Map and references are implemented similar to XPath back 
references

Giacomo