Hi there,

I'm having some trouble formatting the date that appears underneath each "News" post on the following page - www.rjt-online.com/home.php

Here is the code for the XSL file that is being pulled into the above page with php. The xsl file is pulling in an RSS feed from my Wordpress blog:

<?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="http://www.rjt-online.com/wp/?feed=rss2&cat=23" -->
<!DOCTYPE xsl:stylesheet  [
	<!ENTITY nbsp   "&#160;">
	<!ENTITY copy   "&#169;">
	<!ENTITY reg    "&#174;">
	<!ENTITY trade  "&#8482;">
	<!ENTITY mdash  "&#8212;">
	<!ENTITY ldquo  "&#8220;">
	<!ENTITY rdquo  "&#8221;"> 
	<!ENTITY pound  "&#163;">
	<!ENTITY yen    "&#165;">
	<!ENTITY euro   "&#8364;">
]>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<xsl:output method="html" encoding="utf-8"/>
<!-- This is the latest blogs - Shows latest 3 blog posts -->
<!-- This is where you specify how many posts will display (select"x") -->
<xsl:param name="ItemsPerPage" select="2" />
<xsl:template match="/"><link href="css/rjt_new.css" rel="stylesheet" type="text/css" />
  <xsl:for-each select="rss/channel/item[position() &lt;= $ItemsPerPage]">
<span class="blogTitle"><xsl:value-of select="title"/></span><br />
<span class="blogpubdate"><xsl:value-of select="pubDate"/></span><br /><br />
<xsl:value-of select="content:encoded" disable-output-escaping="yes"/><br />
<br />
<br />
  </xsl:for-each>
</xsl:template>

</xsl:stylesheet>

Instead of the date format reading "Mon, 12 Jul 2010 10:00:48 +0000", I'd like it to read Monday, 12th July 2010.

I would appreciate any help you could give me with this. I'm a novice with websites in general and can't seem to get it to work correctly.

Thanks!

Date manipulation in XSLT 1.0 is tricky and can be complicated. There's no function that's built into XSLt to do that type of conversion in XSLT 1.0. However, there is an extensive set of extension function that have been written in 1.0 that you can use to get what you want.

Follow the instructions to bring these functions into your transformation and you can use them to get what you want.

http://www.exslt.org/date/index.html

Ok, I've had a peek through this but I don't really understand it (as I say I'm a novice with this stuff). Seems incredibly complicated to get the result. Is there a different way to import RSS feeds into sites that I can look into that might make it easier?

You're partially correct. In 1.0 date manipulation was difficult and cumbersome. Those extension functions that I referenced are the easiest way to get what you want. I don't understand the details of how your data is being provided, so I can't comment on the importing portion of your question.

Using XSLT 1.0 to convert data formats, no matter what your source data looks like, is not beginner stuff. I'd suggest you really look how to implement those extension functions provided. I would write something, but it wouldn't be a good use of time when someone has already done the work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.