Forum Moderators: open
Can somebody please help? I am a novice to XML-XSL and have trouble transforming a small XML document with a title, description, link and pubDate tags as item to a tidy html page. Here is what I want to do and an example of the XML doc I am dealing with.
XML doc example:
<channel>
<item>
<title>From Evidence to Action</title>
<description>Workshop report
</description>
<link>http://www.ifpri.org/events/seminars/2005/20050728RENEWAL.htm</link>
<pubDate>Thu, 2 Jun 2005 17:39:53 -0400</pubDate></item>
<item>
<title>From Evidence to Action 2</title>
<description>Workshop report 2
</description>
<link>http://www.ifpri.org/events/seminars/2005/20050728RENEWAL.htm</link>
<pubDate>Thu, 2 Jun 2005 17:39:53 -0400</pubDate></item>
</channel>
What I need is to have these list of items on an htm page where
Title (linked to the URL in the link tag)
Description of the item (the content of the description tag)
Publication date (the content of the pubDate)
I have looked at some of the posting on this forum. But it still seem not to work for me. Can some body please help? The actual XSL code with a little bit of explanation will be highly appreciated.
Mb.
What you can do is to use the xml it self to view like an html file.
put the line in the xml that tell the xml file to use an xsl file.
<?xml-stylesheet type="text/xsl" href="example.xsl"?>
and the example.xsl file should look like that...
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/">
<html>
<body>
<h2>My links page</h2>
<br/>
<xsl:for-each select="channel/item">
<a>
<xsl:attribute name="href">
<xsl:value-of select="link"/>
</xsl:attribute>
<xsl:value-of select="title"/>
</a> - <xsl:value-of select="description"/>
<br/><br/>
<xsl:for-each>
</body>
</html>
</xsl:template></xsl:stylesheet>
Pallaton.