This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
how to output elements in random order?
- From: Massimo Santini - mailing list address <mm14ss at yahoo dot it>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 31 Jan 2002 22:18:51 +0100 (CET)
- Subject: [xsl] how to output elements in random order?
- Reply-to: xsl-list at lists dot mulberrytech dot com
Is there a standard (clean) way to process (output) elements in random
order, possibliy specifiyng a "seed" as a parameter to the stylesheet?
It's not just a speculation. One motivation, for example, is that I'm
tryng to use XSLT to produce randomly premuted multiple choice tests for
grading students. Given a set of questions each one with a various number
of possible answers, I wuold like to output questions in random order and
answers within a quastion in random order too.
Now I'm basically using something like
<xsl:for-each select="question">
<xsl:sort select="ext:rnd()"/>
...
</xsl:for-each>
where ext:rnd() is an extension function returing a random integer. It
works with Xalan, but I know it is an ugly ugly hack...
Is there any clean way to do such a thing (note that STFW seems to lead
no useful result)?
Thank you for any suggestion...
Massimo
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list