Re: [xsl] Randomly displaying articles from RSS feed

Subject: Re: [xsl] Randomly displaying articles from RSS feed
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Fri, 11 Jan 2008 19:03:42 +0100
Colin Paul Adams wrote:
"Andrew" == Andrew Welch <andrew.j.welch@xxxxxxxxx> writes:

Andrew> I think Abel was implying that you would need to append a Andrew> timestamp to the query string to make it a unique url per Andrew> request, ensuring a new number would be returned each time Andrew> (avoiding the rules of the doc() function and perhaps Andrew> caching along the way)

How are you going to do this?

fn:current-dateTime() will return the same value each time.

No, I was implying adding a unique number, not necessarily a timestamp. One way (and imho the preferred way) is doing this by retrieving the id of a newly created node:


<xsl:function name="f:my-id">
   <xsl:variable name="new-node">
         <node />
    </xsl:variable>
    <xsl:sequence select="generate-id($new-node)" />
</xsl:function>

Now, calling f:my-id() will always return a unique id within the session. If you also need a unique id globally, add a timestamp or use my GUID techniques.

Cheers,
-- Abel Braaksma

Current Thread