Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Mister_DNA
Visitor

Making an online program guide using your xml files

For channel creators who operate a website for their channel using the videoplayer example, here's a neat little trick that will allow you to make a program listing of your content that updates every time you edit your .xml files.

Step one: create a "stylesheet.xsl" that looks something like this:
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<body>
<h2 align="center">Sub-Category Listing</h2>
<table align="center" border="1" width="80%">
<tr bgcolor="#ffff80">
<th>Title</th>
<th>Synopsis</th>
<th>Runtime (in sec)</th>
</tr>
<xsl:for-each select="feed/item">
<tr>
<td width="35%"><xsl:value-of select="title"/></td>
<td width="50%"><xsl:value-of select="synopsis"/></td>
<td align="center" width="15%"><xsl:value-of select="runtime"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>

</xsl:stylesheet>


Step Two: Upload the file to the same directory your xml files are stored
Step Three: Add the following line at the top of all your xml files except the categories.xml:
<?xml-stylesheet type="text/xsl" href="stylesheet.xsl"?>

(Adding that to your xml files in no way effects playback on your videos)

Step Four: Make the program listing on your website, linking to your xml files. Any time someone clicks a link, they'll get a handy table listing all the content of a category leaf.

That's it. The great thing about this is once you've set it up, it requires almost zero maintenance. The only time you really need to do anything is if you remove an existing category leaf or add a new one. Anytime you add new content and edit your xml files, your program listing updates, too. Saves a lot of time.

In the example I used, the stylesheet pulls data from the "title", "synopsis" and "runtime" tags, but you can configure it to use any tag you wish. Here is what the finished product looks like.
If you want a vision of the future, imagine a boot stamping on a human face - forever. - George Orwell
0 Kudos