[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
And then, after shutting the computer down to go to bed i realise:
<xsl:template match="Context">
<xsl:choose>
<xsl:when test="substring(Date, 10, 1) = ' '">
<xsl:value-of select="substring(Date, 5, 4)" /><xsl:value-of select="substring(Date, 9, 2)" /> <xsl:value-of select="substring(Date, (string-length(Date) - 3), 4)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring(Date, 5, 4)" /><xsl:value-of select="substring(Date, 9, 3)" /> <xsl:value-of select="substring(Date, (string-length(Date) - 3), 4)" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Re: [xsl] splitting the date field in xml
Subject: Re: [xsl] splitting the date field in xml From: jim smith <jim@xxxxxxxxx> Date: Wed, 14 Feb 2001 01:03:17 +0000 |
Hi
I have a xml file which looks like this
<Context> <Date>Tue Jan 11 16:00:00 PST 1949</Date> </Context>
I need to show the date in 3 textfields as
Jan 11 1949
And then, after shutting the computer down to go to bed i realise:
<xsl:template match="Context">
<xsl:choose>
<xsl:when test="substring(Date, 10, 1) = ' '">
<xsl:value-of select="substring(Date, 5, 4)" /><xsl:value-of select="substring(Date, 9, 2)" /> <xsl:value-of select="substring(Date, (string-length(Date) - 3), 4)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring(Date, 5, 4)" /><xsl:value-of select="substring(Date, 9, 3)" /> <xsl:value-of select="substring(Date, (string-length(Date) - 3), 4)" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Doesn't look very elegant, but works... --
jim smith 020 7837 0377
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] splitting the date field , jim smith | Thread | Re: [xsl] splitting the date field , Jeni Tennison |
RE: [xsl] Microsoft CLR (was: XSLT , Stu Bloom | Date | Re: [xsl] Dillemma when creating an, JoshMEagle |
Month |
Keywords