Gasper,

Try this:

  <map:selectors>
   ...
   <map:selector name="parameter-xsl" logger="sitemap.selector.request"
                 src="org.apache.cocoon.selection.RequestSelector">
     <parameter-name>xsl</parameter-name>
   <map:selector>
  </map:selectors>

...

<map:match src="mypage">
<map:generate src="mypage.xml"/>
<map:select type="parameter-xsl">
  <map:when test="one">
    <map:transform src="stylesheets/one.xsl"/>
  </map:when>
  <map:when test="two">
    <map:transform src="stylesheets/two.xsl"/>
  </map:when>
  <map:otherwise>
    <map:transform src="stylesheets/default.xsl"/>
  </map:otherwise>
</map:select>
<map:serialize/>
</map:match>

This will choose one.xsl if you request http://localhost/mypage?xsl=one,
two.xsl if http://localhost/mypage?xsl=two, and default.xsl in all other
cases.

Matcher's syntax is quite different from selectors. You can try
RequestParamMatcher, it is defined in stock sitemap. Usage is:

  <map:match pattern="mypage">
    <map:generate src="mypage.xml"/>
    <map:match type="request" pattern="xsl">
      <map:transform src="{1}"/>
    </map:match>
    <map:serialize type="xml"/>
  </map:match>

This will choose one.xsl if you request http://localhost/mypage?xsl=one,
two.xsl if http://localhost/mypage?xsl=two, and it will fail with
exception in all other cases.

Vadim

> From: Gasper [mailto:[EMAIL PROTECTED]]
> 
> Hi
> 
> Thanks for the answer. I can't figure out a working configuration. Is
there
> an example other than the browser selection one in the docs. Maybe one
with
> a request parameter for decideing which xsl will do the
transformation.
> 
> Thanks.
> 
> Gasper
> 
> ----- Original Message -----
> From: "Vadim Gritsenko" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, January 09, 2002 5:18 PM
> Subject: RE: Does cocoon2 support xslt translation through
> <?xml-stylesheet?> tag inside xml?
> 
> 
> > > From: Gasper [mailto:[EMAIL PROTECTED]]
> > >
> > > Hi
> > >
> > > The question is:
> > > Can I have an xml document written as jsp or xsp that has
different
> > xslt
> > > translations denpended on the http parameters the page gets. Can
> > cocoon be
> > > cofigured to do this and how to do it.
> > >
> >
> > Please, read more on sitemap and available matchers and selectors.
> > WildcardParameterValueMatcher or ParameterSelector whould work for
you
> > just fine. Sample sitemap have usage example of the first one.
> >
> > Vadim
> >
> >
> >
---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> > To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> > For additional commands, e-mail: <[EMAIL PROTECTED]>
> >
> >
> 
> 
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> 
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to