Hi Konstantin,

>> I thought that I've already answered to this. See my previous post on
your question.
>> Generally, the 'type' attribute cannot be dynamic, because the pipeline
is
>> constructed before processing.

I asked because you posted this before:

***********************************************************************

This won't work, you should use nested actions in such cases. Actions work
like an if ... else ... statement: if an action returns a non-null value
then it's contents is processed, otherwise the following part is processed.

In your particular case it'd be much better to return two values from the
action, just you different keys in the HashMap to do it:

results.put("xsl-choice", "style.xsl");
results.put("format", "pdf");  //shouldn't it be fo2pdf

and then use it in your sitemap like this:

<map:match pattern="blabla">
             <map:act type="allSelect">
                    <map:generate src="sampleoutput.xml"/>
                    <map:transform src="stylesheets/{xsl-choice}.xsl"/>
                    <map:serialize type="{format}"/>
             </map:act>
  </map:match>

This one should work fine. But it'd be even better if you've used input
modules instead of an action. Something like this:

<map:match pattern="blabla">
              <map:generate src="sampleoutput.xml"/>
              <map:transform
src="stylesheets/{request-param:report_id}{request-param:service_id}
_{reques
t-param:output_id}.xsl"/>
              <map:serialize type="{request-param:output_id}"/>
  </map:match>

--
  Konstantin

****************************************************************************************************************

Ok. Now I know that its impossible.

Thanks
Jonny

----------------------------------------------------------------------------------------------------

This electronic message contains information from the mmo2 plc Group which
may be
privileged or confidential. The information is intended to be for the use
of the
individual(s) or entity named above. If you are not the intended recipient
be aware
that any disclosure, copying, distribution or use of the contents of this
information
is prohibited. If you have received this electronic message in error,
please notify
us by telephone or email (to the numbers or address above) immediately.



|---------+---------------------------->
|         |           "Konstantin      |
|         |           Piroumian"       |
|         |           <kpiroumian@apach|
|         |           e.org>           |
|         |                            |
|         |           01/31/03 09:17 AM|
|         |           Please respond to|
|         |           cocoon-users     |
|         |                            |
|---------+---------------------------->
  
>------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                    
                                          |
  |       To:       <[EMAIL PROTECTED]>                                      
                                          |
  |       cc:                                                                          
                                          |
  |       Subject:  Re: name an output-file dynamically in cocoon?                     
                                          |
  
>------------------------------------------------------------------------------------------------------------------------------|




From: <[EMAIL PROTECTED]>

> Hi again,
>
> is it possible to name an output-file dynamically in cocoon.
>
> E.g. a pdf is created that has the name report_31_01_2003.pdf because its
> the 31 Jan 2003 (or report_GSM.pdf because I got a parameter with the
value
> "GSM").
>
> Is this possible at runntime?

What do you mean by the output file name? Is it the Content-Disposition
header? For this you should use an action, otherwise you would need to
extend the serializer, but serializers cannot get runtime parameters (at
lease it was so in 2.0.3).

>
> To keep up an other question, about why "<map:serialize type" doesn't
like
> my {xxx}-"returns":

I thought that I've already answered to this. See my previous post on your
question.
Generally, the 'type' attribute cannot be dynamic, because the pipeline is
constructed before processing.

--
  Konstantin

>
> >>In your particular case it'd be much better to return two values from
the
> >>action, just you different keys in the HashMap to do it:
>
> >>results.put("xsl-choice", "style _16");
> >>results.put("format", "fo2pdf");
>
> >>and then use it in your sitemap like this:
>
> <map:match pattern="blabla">
>              <map:act type="allSelect">
>                     <map:generate src="sampleoutput.xml"/>
>                     <map:transform src="stylesheets/{xsl-choice}
> _{format}.xsl"/>
>                     <map:serialize type="{format}"/>
>              </map:act>
> </map:match>
>
>
> The " <map:transform src="{xsl-choice}_{format}.xsl"/> " part works
great.
>
> But the " <map:serialize type="{format}"/> " doesnt work. I always get a
> "Resource not found" error.
> If I type in the type manually (e.g. " <map:serialize type="fo2pdf"/> ")
it
> works.
>
> What could cause this problem?
> I wonder especially because the {format} in " <map:transform src
> ="stylesheets/{xsl-choice}_{format}.xsl"/> " works.
>
> Cheers
> Jonny
>
>
>
--------------------------------------------------------------------------
--------------------------
>
> This electronic message contains information from the mmo2 plc Group
which
> may be
> privileged or confidential. The information is intended to be for the use
> of the
> individual(s) or entity named above. If you are not the intended
recipient
> be aware
> that any disclosure, copying, distribution or use of the contents of this
> information
> is prohibited. If you have received this electronic message in error,
> please notify
> us by telephone or email (to the numbers or address above) immediately.
>
>
>
>
> ---------------------------------------------------------------------
> 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:     <[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/faq/index.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/faq/index.html>

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

Reply via email to