Re: Date problem: StringIndexOutOfBoundsException when parsing
"James Fuller" <[email protected]> Sun, 6 Jan 2008 10:16:48 +0100
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
Hello Ronald, How are u using EXSLT ... I recommend using a built in implementation (e.g. Saxon, Xalan, and even Firefox Beta, Safari, and Opera are starting to support some of exslt natively). Otherwise, you will have to import one of the implementations (XSLT, EXSLT function, or scripting) hth, Jim Fuller On Jan 4, 2008 4:32 PM, Ronald Johnson <[email protected]> wrote: > 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> > _______________________________________________ > exslt mailing list > [email protected] > http://www.exslt.org/list >