formatting data with XSL

admin

Administrator
Staff member
I'm trying to figure out how to format XML attributes using XSL (in thiscase I'm formatting a date attribute of the "z:row" element).The XSL code below returns the date if I use "<xsl:value-ofselect="@dtEntryDate" />" in place of"<xsl:apply-templates select="@dtEntryDate"/>" . However, as you probablyknow, the format of dates coming from SQL Server isn't pretty. So, I'mtrying to format it to a user friendly date.Can anyone help me figure out what I'm doing wrong??Thanks.<?xml version="1.0" ?><xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"><xsl:template match="/"><xsl:for-each select="//rs:data/z:row"><LABEL STYLE= "font: 12pt "> Entry Date: <xsl:apply-templatesselect="@dtEntryDate"/> <BR/></xsl:for-each></xsl:template><xsl:template match="@EntryDate"><xsl:eval>formatDate(this.nodeTypedValue, "MMMMdd','yyyy")</xsl:eval>at <xsl:eval>formatTime(this.nodeTypedValue, "hh:mm tt")</xsl:eval></xsl:template></xsl:stylesheet>
 
Back
Top