How to show XML links in web page?
Hi I wonder if anyone can help. I have an RSS XML file with 2 items:
Code:
<rss version="2.0">
<channel>
<title>Skills for OU Study</title>
<link>http://www.open.ac.uk/skillsforstudy</link>
<language>en-us</language>
<description>Helps you develop the study skills you need for your OU course, and get the confidence you need to succeed.</description>
<item>
<title>Mobile stats tool</title>
<link>http://www.open.ac.uk/skillsforstudy/using-maths-and-statistics.php</link>
<description> Get to grips with averages and graph types with the <a href="test.php">mobile</a> stats tool for your mobile phone.</description>
<pubDate>Mon, 13 Oct 2008 09:00:00 GMT</pubDate>
<author>ss-ldt@open.ac.uk (Learning Design & Technology)</author>
<guid isPermaLink="true">http://www.open.ac.uk/skillsforstudy/using-maths-and-statistics.php</guid>
<category>Using maths and statistics</category>
</item>
<item>
<title>Keep to schedule</title>
<link>http://www.open.ac.uk/skillsforstudy/helpful-time-management-tips.php</link>
<description>Learn how to keep a grip on time and keep to schedule.</description>
<pubDate>Mon, 13 Oct 2008 09:00:00 GMT</pubDate>
<author>ss-ldt@open.ac.uk (Learning Design & Technology)</author>
<guid isPermaLink="true">http://www.open.ac.uk/skillsforstudy/helpful-time-management-tips.php</guid>
<category>Develop effective study strategies</category>
</item>
</channel>
</rss>
This works fine but I want it to appear in a web page so I used this XSL file
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="channel">
<ul><xsl:apply-templates select="item" /></ul>
</xsl:template>
<xsl:template match="item">
<li><xsl:value-of select="description"/></li>
</xsl:template>
</xsl:stylesheet>
And this code on the home page:
PHP Code:
<?php
// Load the XML source
$xml = new DOMDocument;
$xml->load('rss.xml');
$xsl = new DOMDocument;
$xsl->load('rss.xsl');
// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules
echo $proc->transformToXML($xml);
?>
This works OK and both item descriptions are shown as list items on the home page. However I really want to show links in the description (list items) but when I put them in to the RSS file they are ignored. Is there anyway I can do this?
Thanks
Steven