Bertrand Delacretaz wrote:

[...]

<map:match pattern="random-image">
  <map:redirect-to uri="images/random/image{random:randomNumber}.jpg"/>
</map:match>


Damn - how does one keep track of all what we have in here, I missed that one ;-)

:) I saw it accidentally when I browsed the input modules.


I think you don't even need the redirect, this should work with map:read as well, shouldn't it?

Yes, of course ...


The min and max random number values would be configured in
cocoon.xconf.

That's the problem then, how do you keep track of a variable number of images?

OK, this is a problem.


So you might be back to java code in this case as well, or maybe:

-get the list of images (DirectoryGenerator)
-write an XSLT transform using java.util.random to select one

You could also pass a random number (e.g, [0..100]) to the stylesheet and calculate the image number:

<map:transform src="imagedirectory2html.xsl">
  <map:parameter name="random" value="{random:randomNumber}"/>
</map:transform>

<xsl:variable name="image-number"
   select="count(dir:file) * $random div 100"/>

-output an HTML page with an <img> instead of outputting the image directly, to avoid the need for a redirect

Andreas




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



Reply via email to