This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RE: Extending xsltproc?


"Michael Kay" <michael dot h dot kay at ntlworld dot com> wrote:

> > and I'd also like to be able to present
> > a node-set in a new random order on each call.
> 
> There's no random() function in XSLT, but you can pass a random 
> number into the stylesheet as a parameter and use it to pseudo-
> randomize the output order, e.g. by doing
> 
> <xsl:sort select="translate(generate-id(), "1234567890", string
> ($random))"

Seems an interesting idea, but this will most probably not change the
document order of the nodes in a nodeset, in case generate-id() returns
something like:

"IDAFAYHC"

which is what MSXML3 gives me. What if in the next version they change
the way they calculate the result of generate-id()?

Not to speak that someone could need to have more than one random
(dynamically determined number of) orderings of a node-set during the
same transformation.

Cheers,
Dimitre Novatchev.




__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]