Det afhænger lidt af hvilken xsl parser du bruger. Det lader til, at MSXML 4 har en format-date funktion, men jeg er ikke sikker på, at du vil kunne bruge den, da dit dato format ikke er korrekt XML dato-format (MM-DD-YYYYTHH:MM:SS (som jeg lige husker det))
Det er muligt, at ud kan komme rundt om det denne vej (har ikke testet det):
<xsl:stylesheet version="1.0"
xmlns:xsl="
http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:dates="urn:rdcpro-com:dates"
>
<xsl:output method="html" encoding="UTF-8"/>
<msxsl:script language="JScript" implements-prefix="dates">
<![CDATA[
function parseDate(oNodeList) {
// construct a dateString from your node
var dateString = oNodeList[0].text.substr(0, 4) + "-" + oNodeList[1].text.substr(4, 2) + "-" + oNodeList[2].text.substr(6, 2);
var t = Date.parse(dateString);
return t;
}
function formatDate(t) {
arrMonth = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var oDate = new Date(t);
return arrMonth[oDate.getMonth()] + " " + oDate.getDate() + "," + oDate.getFullYear();
}
]]>
</msxsl:script>
Call the extension function with:
<xsl:value-of select="dates:formatDate(dates:parseDate(Date))"/>
Eller en variant af denne (mon ikke du kan finde ud af at tilpasse det til dit eget datoformat?)
<xsl:variable name="date-only" select="substring-before($date, 'T')" />
<xsl:variable name="time-only" select="substring-after($date, 'T')" />
<xsl:variable name="year" select="substring-before($date-only, '-')" />
<xsl:variable name="month" select="substring-before(substring-after($date-only, '-'), '-')" />
<xsl:variable name="day" select="substring-after(substring-after($date-only, '-'), '-')" />
<xsl:variable name="hour" select="substring-before($time-only, ':')" />
<xsl:variable name="minutes" select="substring-before(substring-after($time-only, ':'), ':')" />
<xsl:variable name="seconds" select="substring-after(substring-after($time-only, ':'), ':')" />