You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jo Bourne <ve...@va.com.au> on 2002/07/30 04:39:55 UTC
using request selector to choose xsl
Hi,
I currently have a request selector working to choose which xsl to use based on a query string in the request. I built this using the method recommend repeatedly in the mailing list archives and it works but I would like it to simply test whether there is a style paramater and use it if there is, or otherwise use the default. Having to specify each possible stylesheet in a seperate case is annoying and wasteful. Is there another way to do this?
thanks in advance.
Jo
PS. here is an example of what I am using at present
<map:match pattern="**.xml">
<map:generate src="{1}.xml"/>
<map:select type="request">
<map:parameter name="parameter-name" value="style"/>
<map:when test="special_one.xsl">
<map:transform src="special_one.xsl"/>
</map:when>
<map:when test="special_two.xsl">
<map:transform src="special_two.xsl"/>
</map:when>
<map:when test="special_three.xsl">
<map:transform src="special_three.xsl"/>
</map:when>
<map:otherwise>
<map:transform src="default.xsl"/>
</map:otherwise>
</map:select>
<map:serialize/>
</map:match>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: using request selector to choose xsl
Posted by Jo Bourne <ve...@va.com.au>.
Hey Barbara,
thanks for your suggestion, unfortunately it won't work for us as sending a style all the time would require a massive rewrite of our system which generates all the urls automatically and it is really only occassional special cases we need to catch with a specified style
thanks though!
Jo
At 8:30 AM +0200 30/7/02, Barbara Post wrote:
>Hello,
>
>is this ok for your problem ? But if "style" is not specified this wouldn't
>be ok. So you would have to specify a default value anyway when
>submitting...
>
><map:match pattern="**.xml">
> <map:generate src="{1}.xml"/>
> <map:act type="request">
> <map:parameter name="parameters" value="true"/>
> <map:transform src="{style}.xsl"/>
> <map:serialize ... />
></map:act>
></map:match>
>
>Babs
>----- Original Message -----
>From: Jo Bourne <ve...@va.com.au>
>To: <co...@xml.apache.org>
>Sent: Tuesday, July 30, 2002 4:39 AM
>Subject: using request selector to choose xsl
>
>
>> Hi,
>>
>> I currently have a request selector working to choose which xsl to use
>based on a query string in the request. I built this using the method
>recommend repeatedly in the mailing list archives and it works but I would
>like it to simply test whether there is a style paramater and use it if
>there is, or otherwise use the default. Having to specify each possible
>stylesheet in a seperate case is annoying and wasteful. Is there another way
>to do this?
>>
>> thanks in advance.
>> Jo
>>
>> PS. here is an example of what I am using at present
>>
>> <map:match pattern="**.xml">
>> <map:generate src="{1}.xml"/>
>> <map:select type="request">
>> <map:parameter name="parameter-name" value="style"/>
>> <map:when test="special_one.xsl">
>> <map:transform src="special_one.xsl"/>
>> </map:when>
>> <map:when test="special_two.xsl">
>> <map:transform src="special_two.xsl"/>
>> </map:when>
>> <map:when test="special_three.xsl">
>> <map:transform src="special_three.xsl"/>
>> </map:when>
>> <map:otherwise>
>> <map:transform src="default.xsl"/>
>> </map:otherwise>
>> </map:select>
>> <map:serialize/>
>> </map:match>
>>
>> ---------------------------------------------------------------------
>> Please check that your question has not already been answered in the
>> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>>
>> To unsubscribe, e-mail: <co...@xml.apache.org>
>> For additional commands, e-mail: <co...@xml.apache.org>
>>
>
>
>---------------------------------------------------------------------
>Please check that your question has not already been answered in the
>FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
>To unsubscribe, e-mail: <co...@xml.apache.org>
>For additional commands, e-mail: <co...@xml.apache.org>
--
Jo Bourne
Virtual Artists Pty Ltd
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: using request selector to choose xsl
Posted by Jo Bourne <ve...@va.com.au>.
thanks so much for explaining! I had not understood that the serialise would always terminate the sitemap processing.
At 9:49 AM -0400 30/7/02, Vadim Gritsenko wrote:
> > From: Jo Bourne [mailto:venus@va.com.au]
>>
>> Hi Vadim,
>>
>> I am confused by your example, the way it reads to me the default xsl
>will
>> always run, even if the special one is detected and run first?
>
>You have not interpreted sitemap correctly.
>
>
>> ><map:match pattern="**.xml">
>> > <map:generate src="{1}.xml"/>
>
>Add generator.
>
>> > <!-- Here: "request" corresponds to RequestParameterMatcher -->
>
>Is "style" request parameter present?
>
>> > <map:match type="request" pattern="style">
>
>Yes:
>
>> > <map:transform src="{1}.xsl"/>
>
>Add transformer.
>
>> > <map:serialize ... />
>
>Add serializer and **stop** sitemap processing.
>
>> > </map:match>
>
>No:
>
>> > <map:transform src="default.xsl"/>
>
>Add transformer.
>
>> > <map:serialize ... />
>
>Add serializer and **stop** sitemap processing.
>
>> ></map:match>
>
>
>
>PS See lint.xmap, it will open your eyes.
>
>Vadim
>
>
>> thanks
>> Jo
>>
>> At 9:18 AM -0400 30/7/02, Vadim Gritsenko wrote:
>> > > From: Barbara Post [mailto:babs33@ifrance.com]
>> >>
>> >> Hello,
>> >>
>> >> is this ok for your problem ? But if "style" is not specified this
>> >> wouldn't
>> >> be ok. So you would have to specify a default value anyway when
>> >> submitting...
>> >
>> >Edited version:
>> >
>> ><map:match pattern="**.xml">
>> > <map:generate src="{1}.xml"/>
>> >
>> > <!-- Here: "request" corresponds to RequestParameterMatcher -->
>> > <map:match type="request" pattern="style">
>> > <map:transform src="{1}.xsl"/>
>> > <map:serialize ... />
>> > </map:match>
>> >
>> > <map:transform src="default.xsl"/>
>> > <map:serialize ... />
>> ></map:match>
>> >
>> >Vadim
>> >
>...
>
>
>---------------------------------------------------------------------
>Please check that your question has not already been answered in the
>FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
>To unsubscribe, e-mail: <co...@xml.apache.org>
>For additional commands, e-mail: <co...@xml.apache.org>
--
Jo Bourne
Virtual Artists Pty Ltd
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: using request selector to choose xsl
Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Jo Bourne [mailto:venus@va.com.au]
>
> Hi Vadim,
>
> I am confused by your example, the way it reads to me the default xsl
will
> always run, even if the special one is detected and run first?
You have not interpreted sitemap correctly.
> ><map:match pattern="**.xml">
> > <map:generate src="{1}.xml"/>
Add generator.
> > <!-- Here: "request" corresponds to RequestParameterMatcher -->
Is "style" request parameter present?
> > <map:match type="request" pattern="style">
Yes:
> > <map:transform src="{1}.xsl"/>
Add transformer.
> > <map:serialize ... />
Add serializer and **stop** sitemap processing.
> > </map:match>
No:
> > <map:transform src="default.xsl"/>
Add transformer.
> > <map:serialize ... />
Add serializer and **stop** sitemap processing.
> ></map:match>
PS See lint.xmap, it will open your eyes.
Vadim
> thanks
> Jo
>
> At 9:18 AM -0400 30/7/02, Vadim Gritsenko wrote:
> > > From: Barbara Post [mailto:babs33@ifrance.com]
> >>
> >> Hello,
> >>
> >> is this ok for your problem ? But if "style" is not specified this
> >> wouldn't
> >> be ok. So you would have to specify a default value anyway when
> >> submitting...
> >
> >Edited version:
> >
> ><map:match pattern="**.xml">
> > <map:generate src="{1}.xml"/>
> >
> > <!-- Here: "request" corresponds to RequestParameterMatcher -->
> > <map:match type="request" pattern="style">
> > <map:transform src="{1}.xsl"/>
> > <map:serialize ... />
> > </map:match>
> >
> > <map:transform src="default.xsl"/>
> > <map:serialize ... />
> ></map:match>
> >
> >Vadim
> >
...
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: using request selector to choose xsl
Posted by Jo Bourne <ve...@va.com.au>.
Hi Vadim,
I am confused by your example, the way it reads to me the default xsl will always run, even if the special one is detected and run first?
thanks
Jo
At 9:18 AM -0400 30/7/02, Vadim Gritsenko wrote:
> > From: Barbara Post [mailto:babs33@ifrance.com]
>>
>> Hello,
>>
>> is this ok for your problem ? But if "style" is not specified this
>wouldn't
>> be ok. So you would have to specify a default value anyway when
>> submitting...
>
>Edited version:
>
><map:match pattern="**.xml">
> <map:generate src="{1}.xml"/>
>
> <!-- Here: "request" corresponds to RequestParameterMatcher -->
> <map:match type="request" pattern="style">
> <map:transform src="{1}.xsl"/>
> <map:serialize ... />
> </map:match>
>
> <map:transform src="default.xsl"/>
> <map:serialize ... />
></map:match>
>
>Vadim
>
>
>> Babs
>> ----- Original Message -----
>> From: Jo Bourne <ve...@va.com.au>
>> To: <co...@xml.apache.org>
>> Sent: Tuesday, July 30, 2002 4:39 AM
>> Subject: using request selector to choose xsl
>>
>>
>> > Hi,
>> >
>> > I currently have a request selector working to choose which xsl to
>use
>> based on a query string in the request. I built this using the method
>> recommend repeatedly in the mailing list archives and it works but I
>would
>> like it to simply test whether there is a style paramater and use it
>if
>> there is, or otherwise use the default. Having to specify each
>possible
>> stylesheet in a seperate case is annoying and wasteful. Is there
>another way
>> to do this?
>> >
>> > thanks in advance.
>> > Jo
>> >
>> > PS. here is an example of what I am using at present
>> >
>> > <map:match pattern="**.xml">
>> > <map:generate src="{1}.xml"/>
>> > <map:select type="request">
>> > <map:parameter name="parameter-name" value="style"/>
>> > <map:when test="special_one.xsl">
>> > <map:transform src="special_one.xsl"/>
>> > </map:when>
>> > <map:when test="special_two.xsl">
>> > <map:transform src="special_two.xsl"/>
>> > </map:when>
>> > <map:when test="special_three.xsl">
>> > <map:transform src="special_three.xsl"/>
>> > </map:when>
>> > <map:otherwise>
>> > <map:transform src="default.xsl"/>
>> > </map:otherwise>
>> > </map:select>
>> > <map:serialize/>
>> > </map:match>
>
>
>---------------------------------------------------------------------
>Please check that your question has not already been answered in the
>FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
>To unsubscribe, e-mail: <co...@xml.apache.org>
>For additional commands, e-mail: <co...@xml.apache.org>
--
Jo Bourne
Virtual Artists Pty Ltd
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: using request selector to choose xsl
Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Barbara Post [mailto:babs33@ifrance.com]
>
> Hello,
>
> is this ok for your problem ? But if "style" is not specified this
wouldn't
> be ok. So you would have to specify a default value anyway when
> submitting...
Edited version:
<map:match pattern="**.xml">
<map:generate src="{1}.xml"/>
<!-- Here: "request" corresponds to RequestParameterMatcher -->
<map:match type="request" pattern="style">
<map:transform src="{1}.xsl"/>
<map:serialize ... />
</map:match>
<map:transform src="default.xsl"/>
<map:serialize ... />
</map:match>
Vadim
> Babs
> ----- Original Message -----
> From: Jo Bourne <ve...@va.com.au>
> To: <co...@xml.apache.org>
> Sent: Tuesday, July 30, 2002 4:39 AM
> Subject: using request selector to choose xsl
>
>
> > Hi,
> >
> > I currently have a request selector working to choose which xsl to
use
> based on a query string in the request. I built this using the method
> recommend repeatedly in the mailing list archives and it works but I
would
> like it to simply test whether there is a style paramater and use it
if
> there is, or otherwise use the default. Having to specify each
possible
> stylesheet in a seperate case is annoying and wasteful. Is there
another way
> to do this?
> >
> > thanks in advance.
> > Jo
> >
> > PS. here is an example of what I am using at present
> >
> > <map:match pattern="**.xml">
> > <map:generate src="{1}.xml"/>
> > <map:select type="request">
> > <map:parameter name="parameter-name" value="style"/>
> > <map:when test="special_one.xsl">
> > <map:transform src="special_one.xsl"/>
> > </map:when>
> > <map:when test="special_two.xsl">
> > <map:transform src="special_two.xsl"/>
> > </map:when>
> > <map:when test="special_three.xsl">
> > <map:transform src="special_three.xsl"/>
> > </map:when>
> > <map:otherwise>
> > <map:transform src="default.xsl"/>
> > </map:otherwise>
> > </map:select>
> > <map:serialize/>
> > </map:match>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: using request selector to choose xsl
Posted by Barbara Post <ba...@ifrance.com>.
Hello,
is this ok for your problem ? But if "style" is not specified this wouldn't
be ok. So you would have to specify a default value anyway when
submitting...
<map:match pattern="**.xml">
<map:generate src="{1}.xml"/>
<map:act type="request">
<map:parameter name="parameters" value="true"/>
<map:transform src="{style}.xsl"/>
<map:serialize ... />
</map:act>
</map:match>
Babs
----- Original Message -----
From: Jo Bourne <ve...@va.com.au>
To: <co...@xml.apache.org>
Sent: Tuesday, July 30, 2002 4:39 AM
Subject: using request selector to choose xsl
> Hi,
>
> I currently have a request selector working to choose which xsl to use
based on a query string in the request. I built this using the method
recommend repeatedly in the mailing list archives and it works but I would
like it to simply test whether there is a style paramater and use it if
there is, or otherwise use the default. Having to specify each possible
stylesheet in a seperate case is annoying and wasteful. Is there another way
to do this?
>
> thanks in advance.
> Jo
>
> PS. here is an example of what I am using at present
>
> <map:match pattern="**.xml">
> <map:generate src="{1}.xml"/>
> <map:select type="request">
> <map:parameter name="parameter-name" value="style"/>
> <map:when test="special_one.xsl">
> <map:transform src="special_one.xsl"/>
> </map:when>
> <map:when test="special_two.xsl">
> <map:transform src="special_two.xsl"/>
> </map:when>
> <map:when test="special_three.xsl">
> <map:transform src="special_three.xsl"/>
> </map:when>
> <map:otherwise>
> <map:transform src="default.xsl"/>
> </map:otherwise>
> </map:select>
> <map:serialize/>
> </map:match>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>