|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to access to a node content randomly in xsl:fo
Hi Cihan,
> I m trying to access the content of a node in random order each time
> when I run the XSL script, is it possible?
XPath doesn't have a random() function, so it isn't possible without
using an extension function. Your processor probably has facilities
for either writing your own extension functions or using Java methods
that would enable you to get hold of a random number. You could then
use that random number to access a single node. Read your processor's
documentation to find out what's available for you.
Once you've created a random() function (I'll call it math:random()),
you can get hold of all the answer elements in a random order by
sorting them based on random numbers with:
<xsl:for-each select="answer">
<xsl:sort select="math:random()" />
...
</xsl:for-each>
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








