Jonathan Britt
Jonathan Britt

Reputation: 53

XML - XSLT reload when XML data changes?

I need to display some XML data in real-time or as close to it as possible as I can get. I am a newbie programmer but have gotten the grasp of XSLT pretty quickly. I think this may be my best bet.

However I can only create static XSLT pages. I would like the output to reflect the changes that are made to the XML file. It is a sports statistics software package this is outputting the XML file I want to manipulate.

Any advice on how to go about doing this?

Upvotes: 0

Views: 1389

Answers (2)

Ian Roberts
Ian Roberts

Reputation: 122424

XSLT on its own doesn't really have any concept of modifying an existing XML tree or responding to events like asynchronous updates - it is simply a language to describe a mapping from one tree structure (generally XML) to another (XML, HTML, etc.).

You might want to take a look at Saxon CE, which is primarily an implementation of XSLT 2.0 in JavaScript, but also it adds extensions that let you hook XSLT templates into JavaScript events and then update parts of the page from those templates using <xsl:result-document href="#id_of_a_div">.

Upvotes: 3

Eric
Eric

Reputation: 97691

Inside your generated HTML, insert:

<script>
     setTimeout(function() { location.reload(); }, 5000);
</script>

Upvotes: 0

Related Questions