This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: A little Divinitation with generate-id()?
> 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