Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Timestamp formatting in XSLT

86 views
Skip to first unread message

jai

unread,
Oct 23, 2009, 8:08:12 AM10/23/09
to jka...@templeton.com
Hello,

I have a dateTime format as an XML element (<PDFTIMESTAMP>2009-10-09
13:10:58.00000</PDFTIMESTAMP>). This dateTime format is not accepted
by XSLT 2.0 using Saxon 9.

I came to know that 2009-10-09T13:10:58.00000 is proper format for
dateTime.

I actually do a sort using PDFTIMESTAMP inside a for-each loop as
below:

<xsl:for-each-group select="current-group()" group-by="RECEIPTTYPE">

<xsl:sort select="max(PDFTIMESTAMP/xs:dateTime(.)"
order="descending"/>

In xs:dateTime(.), the issue is comming as format of current dateTime
is not correct. If the XML element's value cannot be corrected to
acceptable format, what can i do to convert the the improper dateTime
comming in xs:dateTime(.) to work?

Any help is much appreciated.

Thanks!!

Jai

Martin Honnen

unread,
Oct 23, 2009, 11:00:37 AM10/23/09
to

jai wrote:

If only the 'T' is missing then you can certainly do e.g.
<xsl:sort
select="max(PDFTIMESTAMP/xs:dateTime(concat(substring(., 1, 10), 'T',
substring(., 11))))"/>

--

Martin Honnen --- MVP XML
http://msmvps.com/blogs/martin_honnen/

0 new messages