You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jonathan Coe <jo...@onemind.com> on 2001/02/22 20:10:49 UTC

random stylesheets

Is it possible for an xml file to choose its stylesheet at random?  perhaps
using an xsp solution?  i'd like to do a site that works similar to
www.davidbowie.com (hit refresh several times) - same content, different
looks and styles.  i realise a server redirect or javascript solution could
work to achieve the same effect, but i'd like to contain everything in the
xml doc. if at all possible.

cheers,
JC



----- Original Message -----
From: <co...@xml.apache.org>
To: <co...@xml.apache.org>
Sent: Thursday, February 22, 2001 1:47 PM
Subject: cocoon-users Digest 22 Feb 2001 18:47:28 -0000 Issue 604




SV: random stylesheets

Posted by Pål Wester <pa...@florence.never.no>.
Have several stylesheets called: stylesheet1.xsl -> sylesheet10.xsl,
then try this:

<xsp:logic>
	int random = (Math.random()*10)+1;
</xsp:logic>
<xsp:pi target="xml-stylesheet">
                href="stylesheet<xsp:expr>random</xsp:expr>.xsl"
                type="text/xsl"
</xsp:pi>


Math.random isn't the best thing to use to get real-randomness,
so you should use something else... but this is just as an example.

mvh:
Pål Wester, programmerer
never.no as, stortingsgt 30, 0161 Oslo
direkte: 22 01 66 34, 906 900 62
tlf: 22 01 66 34, fax: 22 01 66 21
http://never.no - icq:103476059
~ hvis du ikke klarer det på første forsøk vil jeg ikke anbefale hangliding
~

> -----Opprinnelig melding-----
> Fra: Jonathan Coe [mailto:jonathan@onemind.com]
> Sendt: 22. februar 2001 20:11
> Til: cocoon-users@xml.apache.org
> Emne: random stylesheets
>
>
> Is it possible for an xml file to choose its stylesheet at
> random?  perhaps
> using an xsp solution?  i'd like to do a site that works similar to
> www.davidbowie.com (hit refresh several times) - same content, different
> looks and styles.  i realise a server redirect or javascript
> solution could
> work to achieve the same effect, but i'd like to contain everything in the
> xml doc. if at all possible.
>
> cheers,
> JC
>
>
>
> ----- Original Message -----
> From: <co...@xml.apache.org>
> To: <co...@xml.apache.org>
> Sent: Thursday, February 22, 2001 1:47 PM
> Subject: cocoon-users Digest 22 Feb 2001 18:47:28 -0000 Issue 604
>
>
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>