cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oscar Picasso <oscgoo...@yahoo.com>
Subject Functional programming (kind of)
Date Sat, 17 Jul 2004 04:35:13 GMT
Hi,

Is it possible to do some kind of functional programming with Cocoon.

May be it's not the right term, so let me try to explain.

I have the following pseudo sitemap:

<!-- example http://localhost/copy?src=mysource&dest=my-destination -->
<map:match pattern="copy">
  <map:action type="copy-action" src="{request-param:src}">
    <map:parameter name="dest" value="{request-param:dest}"/>
    <map:generate src="copy-was-a-success-or-failure"/>
    <map:serialize/>
  </map:action>
</map:math>

<-- example http://http://localhost/pic.jpg?src=my-svg-source -->
<map:match pattern="*.jpg">
  <map:generate src="{request-param:src}"/>
  <map:serialize type="svg2jpeg"/>
</map:match>

<!-- Replace place-holders in a 'template' svg file with actual values -->
<!-- example
http://http://localhost/merge?svg-src=my-template-svg&data-src=my-data-source
-->
<map:match pattern="merge">
  <map:generate type="merge" src="{request-param:svg-src}"/>
    <map:parameter data-src="{request-param:data-src}"/>
  <map:serialize/>
</map:match>

1- I would like to do something like:
http://localhost/copy?src=(cocoon:/my-pic.jpg?src=(cocoon:/merge?src=my-svg-template&data-src=some-sql-source))&dest=/home/my-saved-pic.jpg

2- I would like also to do this in a cinclude transformation:
....
<cinclude:include>    
http://localhost/copy?src=(cocoon:/my-pic1.jpg?src=(cocoon:/merge?src=my-svg-template&data-src=first-data))&dest=/home/my-saved-pic2.jpg
</cinclude:include>

<cinclude:include>
http://localhost/copy?src=(cocoon:/my-pic2.jpg?src=(cocoon:/merge?src=my-svg-template&data-src=second))&dest=/home/my-saved-pic2.jpg
</cinclude:include>
...

Obviously it's not possible this way.

I have tried different approaches mainly focused on playing with the urls.

For example to avoid parameter names collision (ex: src) I have tried something
like the following kind of syntax:

cocoon:/copy(my-pic2.jpg, cocoon:/merge(my-svg-template, second),
/home/my-saved-pic2.jpg)

and enclosed the pipelines with an action that decodes the "url".

It almost works but it's not very clean and there is surely a better way.

Thanks.




		
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message