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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: A little Divinitation with gene, Kay Michael | Thread | Mail Merge w/XML/XSL, Rob Williams |
Re: Server-side Transformations usi, Eric van der Vlist | Date | HELP: How to get the value of the n, Cheun N Chong |
Month |