You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Nik Silver <or...@yahoo.co.uk> on 2004/10/24 22:51:39 UTC

Rendering an image based on an XML lookup

Hello all

I'm trying to do something which should be simple with Cocoon, and which
should therefore have a simple solution. But I cannot find any solution.
I hope someone can help...

I'm trying to render an image. The location of that image is obtained by
taking parameters from the request URI and then looking up the contents
in an XML file - the location of the XML file is also based on the
request URI. So the procedure should be:

(1) get request URI and its parameters;
(2) based on a parameter go to a particular XML lookup file;
(3) based on another parameter pick out some data from that XML lookup file;
(4) that data tells us what image to output.

Does anyone know how to do this?

I should be able to use the <map:read> element, but can't because
by earlier reading in the lookup file using <map:generate> I'm prevented
from doing any more reading. So this fails on the <map:read>...

   <!-- Match a URL requesting an image -->
   <map:match pattern="album/*/page*/*">
     <!-- Use the relevant album.xml file to work out the image's location -->
     <map:generate src="content/photos/{1}/album.xml"/>
     <map:transform src="style/album2imagedata.xsl" label="style1">
       <map:parameter name="page-number" value="{2}"/>
     </map:transform>
     <!-- Put that information into the session -->
     <map:transform type="session"/>
     <!-- Now use the information in the session to pick out the right image,
          but it throws an exception -->
     <map:read
       type="image"
       src="album/{1}/{session-context:mycontext/image/@dir}/{3}"/>
   </map:match>

Also, I really think this ought to be done without touching cocoon.xconf.

Any help is very welcome. Thanks a lot
Nik



	
	
		
___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun!  http://uk.messenger.yahoo.com

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