Subject: how to generate random numbers in xslt
Posted By: anboss Post Date: 7/22/2008 2:14:59 PM
how to generate random numbers between 1 and 5 in xslt (without using the java script template)?
Reply By: samjudson Reply Date: 7/22/2008 3:57:02 PM
Due to one of the the definitions of functional programming languages being that given the same inputs they always produce the same output this isn't part of the standard XSLT language.

Your best bet is to either pass the random number in as a parameter, or to call an extension function.

/- Sam Judson : Wrox Technical Editor -/
Reply By: mhkay Reply Date: 7/22/2008 5:26:29 PM
Some XSLT processors implement the function random:random-sequence() described at http://www.exslt.org/random/index.html

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
Reply By: anboss Reply Date: 7/23/2008 9:10:00 AM
thanks Kay thanks Sam. for developers this strictness of XSLT is going to be a handicap. but afterall what this conveys is that there is a different way of achieving things other than the regular way of looking for builtin functions.


Go to topic 72499

Return to index page 1