Date problem: StringIndexOutOfBoundsException when parsing
"Ronald Johnson" <[email protected]> Fri, 4 Jan 2008 16:32:06 +0100
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
Hi,
i have a problem with formatting date, my xml part where i got the
date looks like this:
<dateCreated>2008-01-04T15:02:57.72Z</dateCreated>
if I use the code below, i get the following error message from xsl-fo
(Location of error unknown)java.lang.StringIndexOutOfBoundsException:
String index out of range: 0
if I however change the code so date it takes the variable $someData
instead of dateCreated[node()] as input, it all works fine
To me it shouldnt be any difference....i would appreciate any tips for
what might be wrong, or alternative solutions
what i want to do is take the date and format it into something nicer,
e.g. turn it into
"Thu, 04.01.2008, 15:02"
<xsl:variable name="someData"
as="xs:dateTime">2008-01-04T14:34:07.868Z</xsl:variable>
<xsl:call-template name="format-date">
<xsl:with-param name="dateString" select="dateCreated[node()]"/>
</xsl:call-template>
<xsl:template name="format-date">
<xsl:param name="dateString"/>
<xsl:value-of select="date:day-in-month($dateString)"/>
</xsl:template>