xsl-list
[Top] [All Lists]

Re: [xsl] Randomly displaying articles from RSS feed

2008-01-11 11:03:54
Colin Paul Adams wrote:
"Andrew" == Andrew Welch <andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com> 
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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>