RE: Random Number Generator

There's also the system property "p:episode".

http://www.w3.org/TR/xproc/#f.system-property

Quote:
 p:episode

    Returns a string which should be unique for each
    invocation of the pipeline processor. In other 
    words, if a processor is run several times in 
    succession, or if several processors are running
    simultaneously, each invocation of each 
    processor should get a distinct value from 
    p:episode.

    The unique identifier must be a valid XML name.

So it's not a number, and it may not have a great pseudo-random distribution, but maybe it could be a seed for a random number generator in XSLT?

Con

-----Original Message-----
From: xproc-dev-request@w3.org on behalf of Betty Harvey
Sent: Tue 30/11/2010 7:38 AM
To: XProc Dev
Subject: Random Number Generator
 
I have included the following variable in my XSLT for generating a
random number:

  <xsl:variable name="seed">
            <xsl:value-of select="math:random() * 1000"
                xmlns:math="java:java.lang.Math"/>
  </xsl:variable>

This is working well in the XSLT and Saxon 9.  However, when I call the
XSLT from Calabash I get the following error:

Description: XPath syntax error at char 14 on line 89 in {math:random() *
1000}:
    Cannot find a matching 0-argument function named
{java:java.lang.Math}random()

Are there any tricks of the trade in XProc to get a random number generator
working in XSLT.

TIA!

Betty

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Betty Harvey                         | Phone:  410-787-9200  FAX: 9830
Electronic Commerce Connection, Inc. |
harvey@eccnet.com                    | Washington,DC XML Users Grp
URL:  http://www.eccnet.com          | http://www.eccnet.com/xmlug
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\/\/
Member of XML Guild (www.xmlguild.org)

Received on Wednesday, 1 December 2010 09:31:06 UTC