W3C home > Mailing lists > Public > xproc-dev@w3.org > November 2010

RE: Random Number Generator

From: Betty Harvey <harvey@eccnet.com>
Date: Mon, 29 Nov 2010 21:11:36 -0500 (EST)
Message-ID: <50446.207.168.47.25.1291083096.squirrel@www.eccnet.com>
To: "Conal Christopher Tuohy" <conal.tuohy@versi.edu.au>
Cc: "XProc Dev" <xproc-dev@w3.org>
Thanks Conal!

I will take a look at that feature.  I have approximately 5+ million
records I want to process and the random number needs to be between 1 and
2874. The variable in the XSLT is working well but without XProc
converting that many files is a challenge.

I am using Calabash within Oxygen.

I am ingesting them into MarkLogic and I am thinking about trying the
MarkLogic ingest transformation but I think I might run into the same
problem.

Thanks!

Betty

> 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)
>
>
>


/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
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 Tuesday, 30 November 2010 01:15:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 30 November 2010 01:15:56 GMT