Hey all, got a tricky one for you.
I have an RSS web part which uses a custom ItemStyle.xsl stylesheet to transform the results of the RSS feed into a UL list.
I have some jQuery I want to inject into the page via this xsl (a jQuery plugin, to be more precise), but I need to physically call this function once the RSS web part has asynchronously did its job, got the XML, put it through the XSL and spat the output into the browser.
I know I probably should load the jQuery contents in the masterpage, but I would still have the issue that I want to call the jQuery function after the XSL has loaded and populated the web part.
The code looks a bit like this:
<xsl:template match="RSSMainTemplate">
<div id="container">
<ul id="a_list">
<xsl:apply-templates select="channel/item">
<!-- got a template here to render the LI tag for each item in the RSS feed -->
</xsl:apply-templates>
</ul>
</div>
</div>
<!-- Here's the issue, how do I get this to kick off? This is brought into the page & loaded into the DOM after what could be many seconds after the rest of the page has loaded, as the RSS web part gets its source XML asynchronously -->
<script type="text/javascript" language="javascript">
<![CDATA[
$(function(){
$("ul#a_list").doStuff();
});
]]>
</script>
</xsl:template>
Any ideas?