Re: Re: Re: Selecting a random node from source-tree
--- "Martin Lormes" <martin dot lormes at gmx dot net> wrote: > Oh boy I was blind. Thanks for opening my eyes on this: > > I cannot pass parameters. That would have made things fairly easy > because I > could have generated a random number outside the transformation. > > But -- using any number from the source doc as a seed was the clou. > There > will be one number in my source doc, that increments every time I run > the > transformation. That'll do! > > Unfortunately I may have to drop the FXSL stuff, due to performance > and > maintainability. I want to distribute a single XSLT file, which must > be > kept > as simple as possible. XSLT beginners must be able to apply changes > themselves. *sigh* Your random.xsl is fairly complex. However: using > that > incrementing number plus mod will do the trick in this case. > > > Thanks for the inspiration! You're welcome! Something necessary to note: ***One single*** number is never random. Random by definition applies to ***distribution*** -- that is an infinite sequence which (in this case) is uniformly distributed. In case you're looking only for a single number, you can pick whatever you need from your environment and it would do. As for the inability to use the "heavy" FXSL, well let me expose one more myth about FXSL, this is only seemingly so. It's true the library is rich and powerful. However, its dependency relations are quite simple and break down into small sets of interdependent templates. In the case of using random.xsl, only the following four stylesheet modules are part of the total import hierarchy and will have to be provided: - random.xsl - map.xsl - curry.xsl - iter.xsl Using only the randNext template doesn't actually require any of the above imports... ===== Cheers, Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.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