| << | March, 2003 | >> | ||||
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
| 23 | 24 | 25 | 26 | 27 | 28 | 1 |
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 | 1 | 2 | 3 | 4 | 5 |
Rachel and I hit the Boise trifecta last night: Bowling, Bud Light and Butt Rock. All Van Halen all the time.
In talking with Jorge about how he does his site, he pointed me to his XSLT source. I'll let him post links to those on his own site ifi he wants to. However, he knows some advanced moves that I haven't discovered yet. Here is one of them: http://www.w3.org/TR/xslt#dt-attribute-value-template. This is a huge keystroke saver. It lets me go from this:
<A class="ArchiveLink">
<xsl:attribute name="href">
<xsl:value-of select="$SiteRoot"/><xsl:value-of
select="user:FormatArchiveLink(LocalPubDate)"/>#a<xsl:value-of
select="BlogEntryNumber"/>
</xsl:attribute>
<!--....-->
</A>
To this:
<A class="ArchiveLink" href="{$SiteRoot}{user:FormatArchiveLink(LocalPubDate)}#a{BlogentryNumber}">
<!--....-->
</A>
Very cool!
Jorge Curioso posted on his blog some comments around dealing with dates in RSS and the .Net framework. I figure I'd put some more detail up here on how I handle dates in JoeBlogger.
// The PubDate here is in universal time -- UTC
[XmlIgnore]
public DateTime PubDate;
[XmlElement(ElementName="PubDate")]
public string PubDateString
{
get
{
return PubDate.ToString("r");
}
set
{
PubDate = DateTime.ParseExact(value,"r", null);
}
}
[XmlIgnore]
public DateTime LocalPubDate;
[XmlElement(ElementName="LocalPubDate")]
public string LocalPubDateString
{
get
{
return LocalPubDate.ToString("ddd, dd MMM yyyy HH':'mm':'ss");
}
set
{
try
{
LocalPubDate = DateTime.ParseExact(value,"ddd, dd MMM yyyy HH':'mm':'ss", null);
}
catch (FormatException)
{
LocalPubDate = DateTime.MinValue;
}
}
}
<msxsl:script implements-prefix='user' language='CSharp'>
<![CDATA[
public string FormatTime(string input)
{
DateTime dt = DateTime.ParseExact(input, "ddd, dd MMM yyyy HH':'mm':'ss", null);
return dt.ToString("h':'mm':'ss tt");
}
public string FormatArchiveLink(string input)
{
DateTime dt = DateTime.ParseExact(input, "ddd, dd MMM yyyy HH':'mm':'ss", null);
return String.Format(@"/Archive/{0:D4}/{1:D2}/{2:D2}.html", dt.Date.Year, dt.Date.Month, dt.Date.Day);
}
]]>
</msxsl:script>
And then use that in the output like this:
<xsl:value-of select="user:FormatTime(LocalPubDate)"/>
It might be a good thing if we someone came up with a namespaced extension for RSS to speicfy local time along with GMT. Having "First published" and "Last changed" times might be interesting also. Perhaps I'll write something up at some point.