cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Goupinets <>
Subject Re: Pass a parameter from generator/transformer to the sitemap
Date Mon, 29 Aug 2005 13:52:26 GMT
Hi Irv, Eric,

Thank you very much for your replies. I guess I need to explain what I 
am trying to achieve. There is a Bibliography object that encapsulates 
an xml document  (meta information about a text) together with its 
presentation type (xml, html, tei, dublin core, etc.). Both are defined 
by the user. There are style sheets for each of the presentation types.

I created a generator that gets the xml for bibliographies. Now the only 
thing that's left is to convert the generic text meta-data into 
appropriate format. I can easily do that by creating an action that 
would return the presentation type:

<map:act type="text-presentation">
   <map:parameter name="bibliography" value="{request-param:biblId}"/>
   <map:generate type="bibliographies" src="{request-param:biblId}"/>
   <map:select type="parameter">
      <map:parameter name="parameter-selector-test" 
      <map:when test="tei">
         <map:transform src="styles/text2tei.xsl"/>
         <map:serialize type="xml"/>
       <map:when test="html">
         <map:transform src="styles/text2html.xsl"/>
         <map:serialize type="html"/>

So in this case the action gets the bibl id, reads the bibl from the 
back end, and returns its type to the sitemap (available as 
{presentation}). The generator then reads the same object based on bibl 
id and generates the SAX event for the xml stored in it. Now, based on 
the parameter retrieved by the action, appropriate xsl is selected.

Sure enough it's possible to include the parameter into the XML produced 
by the generator, but in that case I will need to use cincludes to get 
the content that I want based on that parameter (AFAIK, SAX events can't 
affect the pipeline processing). It's an excellent idea, however, I will 
definitely apply it sometime later.

I really hoped that it is possible to send a param from a generator to 
the sitemap, this way I can save one db access and a few lines in the 
sitemap. If that is not possible, I guess, I will end up implementing 
what I just described here.

Thank you very much once again.


Irv Salisbury wrote:
> I think the other problem you are going to have in getting a solution
> to this is that the parameters, actions, etc are all evaluated before
> your sitemap is actually processed.  So, I can't think of a way to
> accomplish exactly what you are looking for.
> On 8/27/05, Eric Boisvert <> wrote:
>>it's probably a dumb question but... why don't you include this parameter
>>directly in the xml generated by the generator ?
>>maybe you have a good reason or some sort of limitation .. just a though.
>>Eric Boisvert
>>>-----Message d'origine-----
>>>De : Nick Goupinets []
>>>Envoyé : 27 août, 2005 16:50
>>>À :
>>>Objet : Pass a parameter from generator/transformer to the sitemap
>>>Hi everybody,
>>>I am trying to find out how to pass a parameter from generator /
>>>transformer code to the sitemap. Ultimately, I would want something like
>>><map:generate type="my-generator"/>
>>><map:transform type="some.xsl">
>>>   <map:parameter name="param" value="{param-created-by-my-generator}"/>
>>>That's pretty easy with actions (just get a HashMap returned), but how
>>>can this be achieved with generators/transformers? I guess there are
>>>always hacks with request/session attributes, but there must be a more
>>>elegant way.
>>>Thank you very much for your help.
>>>Best regards,
>>>Nick Goupinets.
>>>To unsubscribe, e-mail:
>>>For additional commands, e-mail:
>>To unsubscribe, e-mail:
>>For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message