[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Randomly displaying articles from RSS feed


Subject: Re: [xsl] Randomly displaying articles from RSS feed
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 10 Jan 2008 14:58:23 -0500

Brent,

The only hard part of what you're describing is the "randomly" part. XSLT by itself provides no random or pseudo-random number generation. You can get around this, or through it, by:

* calling out to your environment, e.g. with an extension function, to get a random number
* passing in a random or virtually-random number as a parameter, and using that
* using FXSL, which provides support for generating pseudo-random numbers (this requires
invoking FXSL libraries)
* other possibilities I may be neglecting


Which of these is best will depend on externals, such as which processor you're using, whether an extension function or (say) FXSL is more feasible for you, and so forth.

Lick that problem and the rest is straightforward, as XSLT can handle the weighting part of it (providing, of course, the weights are available as source data).

For FXSL on this, see http://fxsl.sourceforge.net/articles/Random/Casting%20the%20Dice%20with%20FXSL-htm.htm.

Cheers,
Wendell


At 02:34 PM 1/10/2008, you wrote:
Hi,

I have an RSS feed that I use to display articles on
my website.  I would like to randomly display one
article at a time, but I want to be able to
artificially weight the articles so that article 1
comes up %50 of the time, article 2 comes up 25% of
the time, etc.

Is this something that XSL is capable of doing?

Please and thank you.



Brent Wilcox



____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page.
http://www.yahoo.com/r/hs


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


Current Thread
Keywords