[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
java math 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.