Giacomo,
Either you are very busy, or you just can find words to describe this hack I suggested
;)))
But what do you think about another hack I thought of recently:
Allow recursive substitution in parameter values, i.e.:
<map:match pattern="get/*/*">
....
<map:transform src="filter.xsl">
<map:parameter name="stylesheet-param" value="{map-param-{1}}"/>
</map:transform>
....
</map:match>
Any suggestions are very welcome!
If nobody are against this, I can provide a patch.
Thanks,
Vadim
> -----Original Message-----
> From: Vadim Gritsenko [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 23, 2001 17:40
> To: [EMAIL PROTECTED]
> Subject: RE: [C2][Patch] Substitution for <map:parameter> names
>
>
> > -----Original Message-----
> > From: giacomo [mailto:[EMAIL PROTECTED]]
> > Subject: Re: [C2][Patch] Substitution for <map:parameter> names
> >
> >
> > On Wed, 23 May 2001, Vadim Gritsenko wrote:
> >
> > > Hello Everybody,
> > >
> > > I want to have an ability to substitute parameter names in the sitemap, like:
> > > <map:match pattern="get/*/*">
> > > <map:generate src="data.xml"/>
> > > <map:transform src="filter.xsl">
> > > <map:parameter name="{1}" value="{2}"/>
> > > </map:transform>
> > > <map:serialize type="xml"/>
> > > </map:match>
> > >
> > > This would higly decrease verbosity of my sitemap...
> > > It looks like that this is not breaking caching system, and if there is no
>objections
> > > against this feature, I attached patch to sitemap.xsl to implement this.
> >
> > Well, to be honest, I don't like it. It's a ugly hack, don't you think.
>
> Yep, kinda.
>
>
> > Have you thought about maintaining this and the problems that can arise
> > because you'll never know the names of the parameters you'll get?
>
> I'm planning to use this for internal pipelines. Let's say for example that I have
>some data file
> and I'm going to do some filtering on it, one or more steps. After that, I can do
>some computation also.
> So, if I have just three types of filters, I would write 7 pipelines for every
>combination of filters (/X,
> /Y, /Z, /X/Y, /X/Z, ...).
> Using this hack, I have only 3 pipelines (/*, /*/*, /*/*/*) - and which are
>extensible automatically once you add
> XSL in your directory.
>
>
> > How would you define the parameters in your sitemap if you don't know
> > them?
>
> Here is part of my sitemap:
> <map:match pattern="part/*/*">
> <map:generate src="data.xml"/>
> <map:act type="get-parameters">
> <parameter name="{1}1" value="a1"/>
> <parameter name="{1}2" value="a2"/>
> <parameter name="{1}3" value="a3"/>
> <parameter name="{2}1" value="b1"/>
> <parameter name="{2}2" value="b2"/>
> <parameter name="{2}3" value="b3"/>
> <map:transform src="filter-by-{../1}.xsl" type="fxslt">
> <parameter name="{../1}1" value="{a1}"/>
> <parameter name="{../1}2" value="{a2}"/>
> <parameter name="{../1}3" value="{a3}"/>
> </map:transform>
> <map:transform src="filter-by-{../2}.xsl" type="fxslt">
> <parameter name="{../2}1" value="{b1}"/>
> <parameter name="{../2}2" value="{b2}"/>
> <parameter name="{../2}3" value="{b3}"/>
> </map:transform>
> </map:act>
> <map:serialize type="xml"/>
> </map:match>
>
> Action get-parameters extracts parameter named "{1}1" (and so on) from request and
>propagates it into map as "a1".
> And stylesheet named "filter-by-XXX.xsl" expects three parameters: XXX1, XXX2, XXX3.
>I can not use generic names
> such as "param1", "param2" in stylesheets because request would have parameters for
>differrent stylesheets.
>
>
> Can you suggest another approach I can use? That would be great.
>
> PS: What do you think about optimizing substitute() calls? It looks like quite
>expensive operation to call it
> needlessly...
>
> Thanks,
> Vadim
>
> >
> > Giacomo
> >
> > >
> > > PS: As a side effect: substitute(...) for parameter names/values is called only
>when
> > > necessary, i.e. when '{' is present.
> > >
> > > Thanks,
> > > Vadim
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]