Re: A little Divinitation with generate-id()?

Subject: Re: A little Divinitation with generate-id()?
From: Eric van der Vlist <vdv@xxxxxxxxxxxx>
Date: Fri, 12 May 2000 12:05:56 +0200
> If you don't care about good randomness, you could use "string-length(/) mod
> 8", but really I think you need an external function here.

Yes, I do agree !

It's XT specific, but on <XML>fr, I am rotating banners like this with
the following template :

<xsl:template match="document-banner">
	<xsl:param name="cnt" select="count($layout/layout/site/banner)"/>
	<xsl:param name="rnd" select="math:random()"/>
	<xsl:param name="idx" select="round(($cnt -1) * $rnd) +1"/>
	<xsl:apply-templates
select="$layout/layout/site/banner[position()=$idx]/*"/>
</xsl:template>

where the math prefix is defined as :
  xmlns:math="http://www.jclark.com/xt/java/java.lang.Math";
and $layout is assigned to a document describing the site and pages
layout.

Hope this helps

Eric
-- 
------------------------------------------------------------------------
Eric van der Vlist       Dyomedea                    http://dyomedea.com
http://xmlfr.org         http://4xt.org              http://ducotede.com
------------------------------------------------------------------------


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread